service 增加权重 (#150)

* 服务增加权重

* 避免显示成 undefined

---------

Co-authored-by: huYang <306061454@qq.com>
This commit is contained in:
胡说丷刂
2026-02-14 10:10:24 +08:00
committed by GitHub
parent 78c63bce33
commit ff231da753
3 changed files with 20 additions and 1 deletions
+15
View File
@@ -54,6 +54,7 @@ interface ServiceCardProps {
const serviceFormSchema = z.object({
cover: z.coerce.number().int().min(0),
display_index: z.coerce.number().int(),
duration: z.coerce.number().int().min(30),
enable_show_in_service: asOptionalField(z.boolean()),
enable_trigger_task: asOptionalField(z.boolean()),
@@ -87,6 +88,7 @@ export const ServiceCard: React.FC<ServiceCardProps> = ({ data, mutate }) => {
: {
type: 1,
cover: 0,
display_index: 0,
name: "",
target: "",
max_latency: 0.0,
@@ -172,6 +174,19 @@ export const ServiceCard: React.FC<ServiceCardProps> = ({ data, mutate }) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="display_index"
render={({ field }) => (
<FormItem>
<FormLabel>{t("Weight")}</FormLabel>
<FormControl>
<Input type="number" placeholder="0" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="target"
+1 -1
View File
@@ -60,7 +60,7 @@ export default function ServicePage() {
{
header: "ID",
accessorKey: "id",
accessorFn: (row) => row.id,
accessorFn: (row) => `${row.id}(${row.display_index ?? 0})`,
},
{
header: t("Name"),
+4
View File
@@ -577,6 +577,8 @@ export interface ModelServerTaskResponse {
export interface ModelService {
cover: number
created_at: string
/** 展示排序,越大越靠前 */
display_index: number
duration: number
enable_show_in_service: boolean
enable_trigger_task: boolean
@@ -600,6 +602,8 @@ export interface ModelService {
export interface ModelServiceForm {
cover: number
/** 展示排序,越大越靠前 */
display_index: number
duration: number
enable_show_in_service?: boolean
enable_trigger_task?: boolean