mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-05 17:27:47 +00:00
feat: 新增AI模型配置功能,优化前端组件与代码规范
1. 新增Redis AI_MODEL_CONFIG枚举与后端AI模型配置CRUD接口 2. 升级vue-img-cutter到3.1.1版本,更新前端依赖 3. 重构前端多处ElMessage提示逻辑,统一由拦截器处理 4. 替换ElDrawer为FaDrawer组件,统一弹窗组件库 5. 重构文章详情、评论组件,新增租户切换器与AI配置面板 6. 优化代码生成模板、菜单树表格逻辑与代码高亮样式 7. 修复前端路由与组件命名问题,更新快速入口配置
This commit is contained in:
@@ -56,8 +56,64 @@ export const AiChatAPI = {
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
// ============ AI 模型配置 ============ //
|
||||
getModelConfig() {
|
||||
return request<ApiResponse<AiModelConfigList>>({
|
||||
url: `${API_PATH}/model`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createModelConfig(body: AiModelConfigInput) {
|
||||
return request<ApiResponse<AiModelConfigItem>>({
|
||||
url: `${API_PATH}/model`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateModelConfig(id: string, body: AiModelConfigInput) {
|
||||
return request<ApiResponse<AiModelConfigItem>>({
|
||||
url: `${API_PATH}/model/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteModelConfig(id: string) {
|
||||
return request<ApiResponse<null>>({
|
||||
url: `${API_PATH}/model/${id}`,
|
||||
method: "delete",
|
||||
});
|
||||
},
|
||||
|
||||
activateModelConfig(id: string) {
|
||||
return request<ApiResponse<null>>({
|
||||
url: `${API_PATH}/model/${id || "__default__"}/activate`,
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export interface AiModelConfigInput {
|
||||
name: string;
|
||||
base_url: string;
|
||||
api_key: string;
|
||||
model_id: string;
|
||||
temperature: number;
|
||||
}
|
||||
|
||||
export interface AiModelConfigItem extends AiModelConfigInput {
|
||||
id: string;
|
||||
created_time: string | null;
|
||||
}
|
||||
|
||||
export interface AiModelConfigList {
|
||||
items: AiModelConfigItem[];
|
||||
active_id: string | null;
|
||||
}
|
||||
|
||||
export default AiChatAPI;
|
||||
|
||||
export interface ChatSessionMessage {
|
||||
|
||||
Reference in New Issue
Block a user