feat(admin): 模型管理 - 统一财务统计并支持已有分组选择
This commit is contained in:
1 parent
b9d60f9807
commit
04cb438869
13 files changed
+522
-427
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { Alert, App, Button, Form, Input, Segmented, Switch, Tabs } from "antd";
|
||||
import { Alert, App, AutoComplete, Button, Form, Input, Segmented, Switch, Tabs } from "antd";
|
||||
import { useAdminContext } from "../admin-context";
|
||||
import { AdminModal } from "@/pages/admin/ui/overlays";
|
||||
import { FlaskConical, Plus } from "lucide-react";
|
||||
import { ModelIconPicker } from "@/components/model-logo";
|
||||
@@ -34,6 +35,10 @@ export function ChannelModelEditor({
|
||||
onSaved: () => Promise<void>;
|
||||
}) {
|
||||
const { message, modal } = App.useApp();
|
||||
const { references } = useAdminContext();
|
||||
const displayNameOptions = [...new Set(references.channels.flatMap((item) => item.modelDisplayNames ?? []))]
|
||||
.sort((a, b) => a.localeCompare(b, "zh-CN"))
|
||||
.map((value) => ({ value }));
|
||||
const [form] = Form.useForm<FormValues>();
|
||||
const [initialValues] = useState(() => initialChannelModelValues(editing, protocols));
|
||||
const [activeSection, setActiveSection] = useState<EditorSection>("identity");
|
||||
@@ -248,7 +253,12 @@ export function ChannelModelEditor({
|
||||
<Input placeholder="留空则使用产品模型标识" />
|
||||
</Form.Item>
|
||||
<Form.Item name="displayName" label="模型展示名(一级目录)" tooltip="跨所有系统渠道按此名称分组,例如 MiniMax H3。同名模型归入同一组,不改变调用 ID。">
|
||||
<Input placeholder="不填则使用模型标识" />
|
||||
<AutoComplete
|
||||
options={displayNameOptions}
|
||||
filterOption={(input, option) => Boolean(option?.value.toLowerCase().includes(input.toLowerCase()))}
|
||||
placeholder="选择已有分组或输入新名称"
|
||||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="channelLabel" label="渠道展示名(二级目录)" tooltip="此模型下的渠道选项,例如秘塔(满血渠道)。留空使用所属渠道名称。" rules={[{ max: 80, message: "渠道展示名不能超过 80 字" }]}>
|
||||
<Input maxLength={80} placeholder="例如:正常渠道、优惠渠道-993、特惠渠道-730" />
|
||||
|
||||
Reference in new issue
Block a user