- 新增 providers/models 数据库表、迁移和数据访问层 - 新增 15 个后端 API 路由(供应商/模型 CRUD + 连通性测试) - 新增 AI 服务层(registry.ts: buildProviderRegistry + testProviderConnection) - 新增前端模型管理页面(Tabs: 供应商/模型,含表格、表单、工具栏) - 新增前端 hooks(use-providers, use-models) - 新增共享类型和 MODEL_CAPABILITIES 常量 - 新增 10 个测试文件(66 个测试用例,4 个因 bun test ESM 兼容问题待修复) - 更新开发文档(architecture, backend, frontend) - 附带 apply-review 修复:统一错误响应、提取共享常量、清理重复测试 注意:registry.test.ts 中 4 个测试因 bun test 无法解析 createProviderRegistry ESM 导出而失败,详情见 context.md
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { PlusOutlined } from "@ant-design/icons";
|
|
import { Button, Flex, Input } from "antd";
|
|
import { useState } from "react";
|
|
|
|
interface ModelToolbarProps {
|
|
keyword: string;
|
|
onSearch: (value: string) => void;
|
|
onSearchClear: () => void;
|
|
openCreateDialog: () => void;
|
|
}
|
|
|
|
export function ModelToolbar({ keyword, onSearch, onSearchClear, openCreateDialog }: ModelToolbarProps) {
|
|
const [draftKeyword, setDraftKeyword] = useState(keyword);
|
|
|
|
return (
|
|
<Flex align="center" gap="small" justify="space-between" wrap="wrap">
|
|
<Input.Search
|
|
allowClear
|
|
enterButton="搜索"
|
|
onChange={(event) => setDraftKeyword(event.target.value)}
|
|
onClear={() => {
|
|
setDraftKeyword("");
|
|
onSearchClear();
|
|
}}
|
|
onSearch={(value) => onSearch(value)}
|
|
placeholder="搜索模型名称或 ID"
|
|
value={draftKeyword}
|
|
/>
|
|
<Button icon={<PlusOutlined />} onClick={openCreateDialog} type="primary">
|
|
新建模型
|
|
</Button>
|
|
</Flex>
|
|
);
|
|
}
|