From 1d79e929f97353eb53fe6d1f156aad21d5fd0c26 Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Fri, 29 May 2026 13:58:04 +0800 Subject: [PATCH] feat(chat): load allowed llms per agent --- src/api.ts | 9 + src/pages/AgentEditor.tsx | 39 +- src/pages/ChatPage.tsx | 732 +++++++++++++++++++------------------- src/styles.css | 76 +++- 4 files changed, 464 insertions(+), 392 deletions(-) diff --git a/src/api.ts b/src/api.ts index 948559e..99a635e 100644 --- a/src/api.ts +++ b/src/api.ts @@ -512,8 +512,17 @@ export interface LLMProvider { updatedAt: number; } +export interface AgentAllowedLLMResponse { + agentId: string; + model: string; +} + export const LLMProviderAPI = { list: () => api.get('/llm-providers').then((r) => r.data), + allowedModels: (agentId: string) => + api + .get('/llm-providers', { params: { agent_id: agentId } }) + .then((r) => r.data), create: (payload: Partial & { apiKey?: string }) => api.post<{ id: string }>('/llm-providers', payload).then((r) => r.data), update: (id: string, payload: Partial & { apiKey?: string }) => diff --git a/src/pages/AgentEditor.tsx b/src/pages/AgentEditor.tsx index 82f42c2..cd4efee 100644 --- a/src/pages/AgentEditor.tsx +++ b/src/pages/AgentEditor.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react'; -import { Button, Form, Input, InputNumber, Modal, Upload, App as AntApp, List, Popconfirm, Tag, Switch, Select, Collapse } from 'antd'; +import { Button, Form, Input, InputNumber, Modal, Upload, App as AntApp, List, Popconfirm, Tag, Switch, Select, Collapse, Checkbox } from 'antd'; import type { UploadFile } from 'antd/es/upload/interface'; import { useNavigate, useParams } from 'react-router-dom'; import { Agent, AgentAPI, ImageAPI, KnowledgeStatus, SkillType, Team, TeamAPI, AiModel, ModelAPI } from '../api'; @@ -493,33 +493,30 @@ export default function AgentEditor() { Array.isArray(value) ? value.map((item) => String(item).trim()).filter(Boolean).join(', ') : '' } > -