fix(config): 设置默认智能体ID为 ChatbotAgent,确保兼容旧配置
This commit is contained in:
parent
9fe24135a2
commit
d2c8d44daf
@ -70,7 +70,7 @@ class Config(BaseModel):
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# 智能体配置
|
# 智能体配置
|
||||||
# ============================================================
|
# ============================================================
|
||||||
default_agent_id: str = Field(default="", description="默认智能体ID")
|
default_agent_id: str = Field(default="ChatbotAgent", description="默认智能体ID")
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# 模型信息(只读,不持久化)
|
# 模型信息(只读,不持久化)
|
||||||
@ -149,6 +149,11 @@ class Config(BaseModel):
|
|||||||
else:
|
else:
|
||||||
logger.warning(f"Unknown config key: {key}")
|
logger.warning(f"Unknown config key: {key}")
|
||||||
|
|
||||||
|
# 确保默认智能体为 ChatbotAgent(兼容旧配置)
|
||||||
|
if not self.default_agent_id:
|
||||||
|
self.default_agent_id = "ChatbotAgent"
|
||||||
|
logger.info("default_agent_id not set, using default: ChatbotAgent")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to load config from {self._config_file}: {e}")
|
logger.error(f"Failed to load config from {self._config_file}: {e}")
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
<!-- Fixed Status Icon -->
|
<!-- Fixed Status Icon -->
|
||||||
<span v-if="toolCall.status === 'success' || toolCall.tool_call_result">
|
<span v-if="toolCall.status === 'success' || toolCall.tool_call_result">
|
||||||
<CircleCheckBig size="16" class="tool-loader tool-success" />
|
<component :is="toolIcon" size="16" class="tool-loader tool-success" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="toolCall.status === 'error'">
|
<span v-else-if="toolCall.status === 'error'">
|
||||||
<CircleCheckBig size="16" class="tool-loader tool-error" />
|
<XCircle size="16" class="tool-loader tool-error" />
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<Loader size="16" class="tool-loader rotate tool-loading" />
|
<Loader size="16" class="tool-loader rotate tool-loading" />
|
||||||
@ -93,7 +93,26 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { Loader, CircleCheckBig, ChevronsUpDown, ChevronsDownUp } from 'lucide-vue-next'
|
import {
|
||||||
|
Loader,
|
||||||
|
CircleCheckBig,
|
||||||
|
ChevronsUpDown,
|
||||||
|
ChevronsDownUp,
|
||||||
|
FileText,
|
||||||
|
FileEdit,
|
||||||
|
FilePen,
|
||||||
|
FolderSearch,
|
||||||
|
Folder,
|
||||||
|
Database,
|
||||||
|
BookOpen,
|
||||||
|
Globe,
|
||||||
|
BarChart3,
|
||||||
|
Image,
|
||||||
|
Calculator,
|
||||||
|
CheckSquare,
|
||||||
|
Wrench,
|
||||||
|
XCircle
|
||||||
|
} from 'lucide-vue-next'
|
||||||
import { useAgentStore } from '@/stores/agent'
|
import { useAgentStore } from '@/stores/agent'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
|
|
||||||
@ -129,6 +148,31 @@ const toolName = computed(() => {
|
|||||||
return tool ? tool.name : toolId
|
return tool ? tool.name : toolId
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Tool Icon Mapping
|
||||||
|
const toolIcon = computed(() => {
|
||||||
|
const name = toolName.value.toLowerCase()
|
||||||
|
// 文件操作
|
||||||
|
if (name.includes('read_file') || name.includes('file')) return FileText
|
||||||
|
if (name.includes('write_file')) return FileEdit
|
||||||
|
if (name.includes('edit_file') || name.includes('replace')) return FilePen
|
||||||
|
if (name.includes('glob') || name.includes('search_file')) return FolderSearch
|
||||||
|
if (name.includes('list_directory') || name.includes('ls')) return Folder
|
||||||
|
// 数据库
|
||||||
|
if (name.includes('mysql')) return Database
|
||||||
|
// 知识库/搜索
|
||||||
|
if (name.includes('kb') || name.includes('knowledge')) return BookOpen
|
||||||
|
if (name.includes('web_search') || name.includes('tavily')) return Globe
|
||||||
|
// 图表/图像
|
||||||
|
if (name.includes('chart')) return BarChart3
|
||||||
|
if (name.includes('image') || name.includes('img')) return Image
|
||||||
|
// 计算
|
||||||
|
if (name.includes('calc') || name.includes('math')) return Calculator
|
||||||
|
// 任务
|
||||||
|
if (name.includes('task') || name.includes('todo')) return CheckSquare
|
||||||
|
// 默认
|
||||||
|
return Wrench
|
||||||
|
})
|
||||||
|
|
||||||
// Args Logic
|
// Args Logic
|
||||||
const formattedArgs = computed(() => {
|
const formattedArgs = computed(() => {
|
||||||
const args = props.toolCall.args ? props.toolCall.args : props.toolCall.function?.arguments
|
const args = props.toolCall.args ? props.toolCall.args : props.toolCall.function?.arguments
|
||||||
@ -242,7 +286,7 @@ const formatResultData = (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tool-loader.tool-success {
|
.tool-loader.tool-success {
|
||||||
color: var(--color-success-500);
|
color: var(--main-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tool-loader.tool-error {
|
.tool-loader.tool-error {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user