From 4427e33567670ea0d4351e494060868eb9658a02 Mon Sep 17 00:00:00 2001 From: qixinbo Date: Sun, 29 Mar 2026 22:13:58 +0800 Subject: [PATCH] UI: chat interface remove skills list --- backend/main.py | 10 -- frontend/src/components/ChatInterface.tsx | 133 ++++++++-------------- frontend/src/i18n/locales/en.json | 6 +- frontend/src/i18n/locales/zh.json | 1 + 4 files changed, 51 insertions(+), 99 deletions(-) diff --git a/backend/main.py b/backend/main.py index 149cb83..33a62b8 100644 --- a/backend/main.py +++ b/backend/main.py @@ -415,11 +415,6 @@ async def nanobot_chat(request: ChatRequest): elif request.route_mode == "chat": instructions.append("Normal chat mode. Do NOT use the nl2sql tool") - # Inject instructions for selected skills - if request.skill_ids: - skill_list = ", ".join(request.skill_ids) - instructions.append(f"You must prioritize using the following skills/tools to answer the user's request: {skill_list}") - if instructions: instr_block = "\n".join(instructions) # If message already has Runtime Context, append to it, otherwise create new @@ -515,11 +510,6 @@ async def nanobot_chat_stream(request: ChatRequest): elif request.route_mode == "chat": instructions.append("Normal chat mode. Do NOT use the nl2sql tool") - # Inject instructions for selected skills - if request.skill_ids: - skill_list = ", ".join(request.skill_ids) - instructions.append(f"You must prioritize using the following skills/tools to answer the user's request: {skill_list}") - if instructions: instr_block = "\n".join(instructions) # If message already has Runtime Context, append to it, otherwise create new diff --git a/frontend/src/components/ChatInterface.tsx b/frontend/src/components/ChatInterface.tsx index d277fa3..ac82648 100644 --- a/frontend/src/components/ChatInterface.tsx +++ b/frontend/src/components/ChatInterface.tsx @@ -220,9 +220,7 @@ export function ChatInterface() { const [input, setInput] = useState(""); const [selectedDataSource, setSelectedDataSource] = useState(""); const [selectedKnowledgeBaseId, setSelectedKnowledgeBaseId] = useState(""); - const [availableSkills, setAvailableSkills] = useState([]); const [availableKnowledgeBases, setAvailableKnowledgeBases] = useState([]); - const [selectedSkillIds, setSelectedSkillIds] = useState([]); const [isMenuOpen, setIsMenuOpen] = useState(false); const [artifactPreview, setArtifactPreview] = useState(null); const [collapsedThinkingByMessage, setCollapsedThinkingByMessage] = useState>({}); @@ -235,10 +233,12 @@ export function ChatInterface() { const [slashQuery, setSlashQuery] = useState(null); const [slashIndex, setSlashIndex] = useState(0); + const [availableSkills, setAvailableSkills] = useState([]); + const [selectedSkillIds, setSelectedSkillIds] = useState([]); const filteredSlashSkills = slashQuery !== null ? availableSkills.filter(s => s.name.toLowerCase().includes(slashQuery.toLowerCase())) : []; - + const handleSelectSlashSkill = (skill: Skill) => { if (!selectedSkillIds.includes(skill.id)) { setSelectedSkillIds(prev => [...prev, skill.id]); @@ -747,7 +747,7 @@ export function ChatInterface() { }; const renderActiveSelections = () => { - if (!selectedDataSource && !selectedKnowledgeBaseId && selectedSkills.length === 0) return null; + if (!selectedDataSource && !selectedKnowledgeBaseId) return null; return (
@@ -1169,47 +1169,9 @@ export function ChatInterface() {
- {/* Left Column: Data Source */} -
-
- - {t('dataSource')} -
-
- {availableDataSources.map((ds) => ( - - ))} - {selectedDataSource && ( -
- -
- )} -
-
+ {/* Left Column: Knowledge Base */} +
+
{t('knowledgeBase')} @@ -1237,8 +1199,9 @@ export function ChatInterface() { )) ) : ( -
- {t('noKnowledgeBases')} +
+ +

{t('noKnowledgeBases')}

)} {selectedKnowledgeBaseId ? ( @@ -1257,57 +1220,55 @@ export function ChatInterface() {
- {/* Right Column: Skills */} -
-
- - Skills -
-
- {availableSkills.length > 0 ? ( - availableSkills.map((skill) => { - const isSelected = selectedSkillIds.includes(skill.id); - return ( + {/* Right Column: Data Source */} +
+
+
+ + {t('dataSource')} +
+
+ {availableDataSources.length > 0 ? ( + availableDataSources.map((ds) => ( - ); - }) - ) : ( -
- -

{t('noAvailableSkills')}

-
- )} -
- {selectedSkillIds.length > 0 && ( -
- + )) + ) : ( +
+ +

{t('noDataSources')}

+
+ )} + {selectedDataSource && ( +
+ +
+ )}
- )} +
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index c5d0787..94041a2 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -28,7 +28,7 @@ "modelNotFound": "Model not found", "availableModels": "Available Models", "dataSource": "Data Source", - "clearSelected": "Clear Selected", + "clearSelected": "Clear Selection", "clearSelectedWithCount": "Clear Selected ({{count}})", "noAvailableSkills": "No available skills", "askAnything": "Ask anything...", @@ -98,7 +98,7 @@ "dataSourceConfig": "Data Source Configuration", "manageDataSourceConnections": "Manage data source connections for Q&A", "newDataSource": "New Data Source", - "noDataSources": "No data sources", + "noDataSources": "No data source available in current project, please create one in settings", "clickTopRightToAddFirstDataSource": "Click the button on the top right to add your first data source", "newProject": "New Project", "projectList": "Project List", @@ -236,7 +236,7 @@ "knowledgeBaseReindexSuccess": "Knowledge base reindexed successfully", "knowledgeBaseReindexFailed": "Failed to reindex knowledge base", "selectProjectBeforeManageKnowledgeBase": "Please select a project before managing knowledge bases", - "noKnowledgeBases": "No knowledge bases in this project. Create one in Settings first.", + "noKnowledgeBases": "No knowledge base available in current project, please create one in settings", "confirmDeleteUser": "Are you sure you want to delete this user?", "newUserMustHavePassword": "New users must have a password", "anErrorOccurred": "An error occurred", diff --git a/frontend/src/i18n/locales/zh.json b/frontend/src/i18n/locales/zh.json index 1e0d2d5..185393f 100644 --- a/frontend/src/i18n/locales/zh.json +++ b/frontend/src/i18n/locales/zh.json @@ -251,6 +251,7 @@ "knowledgeBaseReindexFailed": "知识库重建索引失败", "selectProjectBeforeManageKnowledgeBase": "请先选择一个项目,再进行知识库管理", "noKnowledgeBases": "当前项目暂无知识库,请先在设置中创建", + "noDataSources": "当前项目暂无数据源,请先在设置中创建", "confirmDeleteUser": "确认删除该用户吗?", "newUserMustHavePassword": "新建用户必须填写密码", "anErrorOccurred": "发生错误",