@movk/nuxt-docs 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,7 +40,17 @@ const components = {
|
|
|
40
40
|
const { messages, isOpen, pendingMessage, clearPending } = useAIChat()
|
|
41
41
|
const { apiPath } = useRuntimeConfig().public.aiChat
|
|
42
42
|
|
|
43
|
-
const {
|
|
43
|
+
const { tools } = useToolCall()
|
|
44
|
+
function getToolLabel(toolName: string, args?: any): string {
|
|
45
|
+
const label = tools[toolName]
|
|
46
|
+
|
|
47
|
+
if (!label) {
|
|
48
|
+
return toolName
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return typeof label === 'function' ? label(args) : label
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
const { model } = useModels()
|
|
45
55
|
|
|
46
56
|
const input = ref('')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface ToolLabelConfig {
|
|
2
|
-
toolName: string
|
|
3
|
-
label: string | ((args: any) => string)
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function useTools() {
|
|
7
|
-
const defaultLabels: Record<string, string | ((args: any) => string)> = {
|
|
8
|
-
'list-pages': '列出所有文档页面',
|
|
9
|
-
'get-page': (args: any) => `检索 ${args?.path || '页面'}`
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 获取工具的显示标签
|
|
14
|
-
* @param toolName - 工具名称
|
|
15
|
-
* @param args - 工具参数
|
|
16
|
-
* @returns 工具的显示标签
|
|
17
|
-
*/
|
|
18
|
-
function getToolLabel(toolName: string, args?: any): string {
|
|
19
|
-
const label = defaultLabels[toolName]
|
|
20
|
-
|
|
21
|
-
if (!label) {
|
|
22
|
-
return toolName
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return typeof label === 'function' ? label(args) : label
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
getToolLabel
|
|
30
|
-
}
|
|
31
|
-
}
|