Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
/**
* Tool Icons Utility
* Maps tool names and match types to icons for better UI display
*/
import i18n from '@/i18n'
const t = (key: string) => i18n.global.t(key)
// Tool name to icon mapping
export const toolIcons: Record<string, string> = {
multi_kb_search: 'π',
search_knowledge: 'π',
read_document: 'π§©',
list_documents: 'βΉοΈ',
get_chunk_detail: 'π',
list_knowledge_bases: 'π',
query_knowledge_graph: 'πΈοΈ',
think: 'π',
todo_write: 'π',
// Retired names (still present in stored chat history)
knowledge_search: 'π',
grep_chunks: 'π',
list_knowledge_chunks: 'π§©',
get_document_info: 'βΉοΈ',
};
// Match type internal keys for icon mapping
const matchTypeIconKeys: Record<string, string> = {
vector: 'π―',
keyword: 'π€',
adjacent: 'π',
history: 'π',
parent: 'β¬οΈ',
relation: 'π',
graph: 'πΈοΈ',
};
// Match type to icon mapping (keys match backend API response)
export const matchTypeIcons: Record<string, string> = {
'Vector Match': 'π―',
'Keyword Match': 'π€',
'Adjacent Chunk Match': 'π',
'History Match': 'π',
'Parent Chunk Match': 'β¬οΈ',
'Relation Chunk Match': 'π',
'Graph Match': 'πΈοΈ',
};
// Get icon for a tool name
export function getToolIcon(toolName: string): string {
return toolIcons[toolName] || 'π οΈ';
}
// Get icon for a match type
export function getMatchTypeIcon(matchType: string): string {
return matchTypeIcons[matchType] || matchTypeIconKeys[matchType] || 'π';
}
// Tool name to i18n key mapping
const toolDisplayNameKeys: Record<string, string> = {
multi_kb_search: 'tools.multiKbSearch',
search_knowledge: 'tools.searchKnowledge',
read_document: 'tools.readDocument',
list_documents: 'tools.listDocuments',
get_chunk_detail: 'tools.getChunkDetail',
list_knowledge_bases: 'tools.listKnowledgeBases',
query_knowledge_graph: 'tools.queryKnowledgeGraph',
think: 'tools.think',
todo_write: 'tools.todoWrite',
// Retired names (still present in stored chat history)
knowledge_search: 'tools.knowledgeSearch',
grep_chunks: 'tools.grepChunks',
list_knowledge_chunks: 'tools.listKnowledgeChunks',
get_document_info: 'tools.getDocumentInfo',
};
// Get tool display name (user-friendly, localized)
export function getToolDisplayName(toolName: string): string {
const key = toolDisplayNameKeys[toolName];
if (key) return t(key);
// Format MCP tool names: "mcp_service_tool" β "Service Tool"
if (toolName.startsWith('mcp_')) {
const parts = toolName.slice(4).split('_');
return parts.map(p => p.charAt(0).toUpperCase() + p.slice(1)).join(' ');
}
return toolName;
}