vue-llm 1.2.0 → 1.3.0
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.
- package/README.md +33 -5
- package/dist/components/MessageParts.vue.d.ts +33 -0
- package/dist/components.cjs +5 -5
- package/dist/components.d.ts +1 -0
- package/dist/components.js +146 -75
- package/dist/composables/use-auto-scroll.d.ts +17 -0
- package/dist/composables/use-chat.d.ts +11 -5
- package/dist/composables/use-completion.d.ts +1 -1
- package/dist/composables/use-object.d.ts +1 -1
- package/dist/composables/use-prompt-input.d.ts +51 -0
- package/dist/core/devtools.d.ts +86 -0
- package/dist/core/partial-json.d.ts +6 -0
- package/dist/core/stream-processor.d.ts +4 -0
- package/dist/devtools-C4JE26vO.cjs +1 -0
- package/dist/devtools-DnDvylCG.js +87 -0
- package/dist/devtools.cjs +1 -0
- package/dist/devtools.d.ts +15 -0
- package/dist/devtools.js +210 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.js +576 -441
- package/dist/nuxt.cjs +2 -1
- package/dist/nuxt.d.ts +4 -0
- package/dist/nuxt.js +33 -11
- package/dist/providers/webllm.d.ts +74 -0
- package/dist/providers.cjs +5 -4
- package/dist/providers.d.ts +2 -0
- package/dist/providers.js +479 -260
- package/dist/types.d.ts +37 -1
- package/dist/vue-llm.css +1 -1
- package/package.json +42 -5
package/dist/types.d.ts
CHANGED
|
@@ -20,11 +20,19 @@ export interface ToolCallPart {
|
|
|
20
20
|
type: 'tool-call';
|
|
21
21
|
toolCallId: string;
|
|
22
22
|
toolName: string;
|
|
23
|
+
/** While `state` is `'streaming'` this holds the arguments parsed so far */
|
|
23
24
|
args: unknown;
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* - `streaming`: arguments are still arriving
|
|
27
|
+
* - `pending`: arguments are complete, waiting for a result (e.g. from the user via `addToolResult`)
|
|
28
|
+
* - `running`: `execute` / `onToolCall` is in progress
|
|
29
|
+
* - `result` / `error`: resolved
|
|
30
|
+
*/
|
|
31
|
+
state: ToolCallState;
|
|
25
32
|
result?: unknown;
|
|
26
33
|
error?: string;
|
|
27
34
|
}
|
|
35
|
+
export type ToolCallState = 'streaming' | 'pending' | 'running' | 'result' | 'error';
|
|
28
36
|
export interface FilePart {
|
|
29
37
|
type: 'file';
|
|
30
38
|
mediaType: string;
|
|
@@ -41,6 +49,33 @@ export interface ToolDefinition {
|
|
|
41
49
|
description: string;
|
|
42
50
|
parameters: Record<string, unknown>;
|
|
43
51
|
}
|
|
52
|
+
type AnyArgs = any;
|
|
53
|
+
export interface ToolExecutionContext {
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
/** Aborted when the chat is stopped */
|
|
56
|
+
signal: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
/** A tool for `useChat`. Without `execute`, the call waits for `onToolCall` or `addToolResult`. */
|
|
59
|
+
export interface ChatTool<Args = AnyArgs, Result = unknown> extends ToolDefinition {
|
|
60
|
+
execute?: (args: Args, context: ToolExecutionContext) => Result | Promise<Result>;
|
|
61
|
+
}
|
|
62
|
+
/** Identity helper that types `execute` arguments and results */
|
|
63
|
+
export declare function defineTool<Args = AnyArgs, Result = unknown>(tool: ChatTool<Args, Result>): ChatTool<Args, Result>;
|
|
64
|
+
export type DeepPartial<T> = T extends readonly (infer U)[] ? DeepPartial<U>[] : T extends object ? {
|
|
65
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
66
|
+
} : T;
|
|
67
|
+
/** Props passed to a component rendering a tool call (Generative UI) */
|
|
68
|
+
export interface ToolComponentProps<Args = AnyArgs, Result = AnyArgs> {
|
|
69
|
+
toolCallId: string;
|
|
70
|
+
toolName: string;
|
|
71
|
+
/** Partial while `state` is `'streaming'`, complete afterwards */
|
|
72
|
+
args: DeepPartial<Args> | undefined;
|
|
73
|
+
state: ToolCallState;
|
|
74
|
+
result: Result | undefined;
|
|
75
|
+
error: string | undefined;
|
|
76
|
+
/** Resolve the call from the UI (human-in-the-loop) */
|
|
77
|
+
addResult: (result: Result) => void;
|
|
78
|
+
}
|
|
44
79
|
export type ChatStatus = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
45
80
|
export type FinishReason = 'stop' | 'length' | 'tool-calls' | 'error';
|
|
46
81
|
export interface Usage {
|
|
@@ -48,3 +83,4 @@ export interface Usage {
|
|
|
48
83
|
completionTokens: number;
|
|
49
84
|
totalTokens: number;
|
|
50
85
|
}
|
|
86
|
+
export {};
|
package/dist/vue-llm.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.vue-llm-cursor[data-v-52dbf793]{animation:vue-llm-blink-52dbf793 .7s step-end infinite}@keyframes vue-llm-blink-52dbf793{50%{opacity:0}}
|
|
1
|
+
.vue-llm-cursor[data-v-52dbf793]{animation:vue-llm-blink-52dbf793 .7s step-end infinite}@keyframes vue-llm-blink-52dbf793{50%{opacity:0}}.vue-llm-text[data-v-3f30944b]{white-space:pre-wrap}.vue-llm-file[data-v-3f30944b]{max-width:100%}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-llm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "AI
|
|
5
|
+
"description": "AI SDK for Vue and Nuxt: streaming useChat, tool calling, Generative UI and in-browser WebGPU models for OpenAI, Anthropic, Gemini and Ollama.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|
|
8
8
|
"vue3",
|
|
@@ -20,7 +20,21 @@
|
|
|
20
20
|
"typescript",
|
|
21
21
|
"sse",
|
|
22
22
|
"gpt",
|
|
23
|
-
"claude"
|
|
23
|
+
"claude",
|
|
24
|
+
"ai-sdk",
|
|
25
|
+
"chatbot",
|
|
26
|
+
"chat-ui",
|
|
27
|
+
"generative-ui",
|
|
28
|
+
"tool-calling",
|
|
29
|
+
"function-calling",
|
|
30
|
+
"webgpu",
|
|
31
|
+
"webllm",
|
|
32
|
+
"in-browser",
|
|
33
|
+
"local-llm",
|
|
34
|
+
"structured-output",
|
|
35
|
+
"vue2",
|
|
36
|
+
"composition-api",
|
|
37
|
+
"llama"
|
|
24
38
|
],
|
|
25
39
|
"license": "MIT",
|
|
26
40
|
"author": "dadashi44",
|
|
@@ -29,8 +43,10 @@
|
|
|
29
43
|
"url": "git+https://github.com/dadashi44/vue-llm.git"
|
|
30
44
|
},
|
|
31
45
|
"bugs": "https://github.com/dadashi44/vue-llm/issues",
|
|
32
|
-
"homepage": "https://github.
|
|
33
|
-
"sideEffects":
|
|
46
|
+
"homepage": "https://dadashi44.github.io/vue-llm/",
|
|
47
|
+
"sideEffects": [
|
|
48
|
+
"*.css"
|
|
49
|
+
],
|
|
34
50
|
"exports": {
|
|
35
51
|
".": {
|
|
36
52
|
"types": "./dist/index.d.ts",
|
|
@@ -55,6 +71,12 @@
|
|
|
55
71
|
"import": "./dist/server.js",
|
|
56
72
|
"require": "./dist/server.cjs"
|
|
57
73
|
},
|
|
74
|
+
"./devtools": {
|
|
75
|
+
"types": "./dist/devtools.d.ts",
|
|
76
|
+
"import": "./dist/devtools.js",
|
|
77
|
+
"require": "./dist/devtools.cjs"
|
|
78
|
+
},
|
|
79
|
+
"./style.css": "./dist/vue-llm.css",
|
|
58
80
|
"./package.json": "./package.json"
|
|
59
81
|
},
|
|
60
82
|
"main": "./dist/index.cjs",
|
|
@@ -81,22 +103,37 @@
|
|
|
81
103
|
"test:vue2": "vitest run --config vitest.vue2.config.ts"
|
|
82
104
|
},
|
|
83
105
|
"peerDependencies": {
|
|
106
|
+
"@mlc-ai/web-llm": ">=0.2.70",
|
|
84
107
|
"@nuxt/kit": "^3.0.0 || ^4.0.0",
|
|
108
|
+
"@vue/devtools-api": "^6.6.0 || ^7.0.0 || ^8.0.0",
|
|
85
109
|
"vue": "^2.7.0 || ^3.3.0"
|
|
86
110
|
},
|
|
87
111
|
"peerDependenciesMeta": {
|
|
88
112
|
"@nuxt/kit": {
|
|
89
113
|
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"@mlc-ai/web-llm": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"@vue/devtools-api": {
|
|
119
|
+
"optional": true
|
|
90
120
|
}
|
|
91
121
|
},
|
|
92
122
|
"devDependencies": {
|
|
93
123
|
"@eslint/js": "^9.17.0",
|
|
124
|
+
"@lucide/vue": "^1.62.0",
|
|
125
|
+
"@mlc-ai/web-llm": "^0.2.86",
|
|
94
126
|
"@nuxt/kit": "^3.16.0",
|
|
127
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
95
128
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
129
|
+
"@vue/devtools-api": "^7.7.9",
|
|
96
130
|
"@vue/test-utils": "^2.4.6",
|
|
131
|
+
"clsx": "^2.1.1",
|
|
97
132
|
"eslint": "^9.17.0",
|
|
98
133
|
"eslint-plugin-vue": "^9.32.0",
|
|
99
134
|
"jsdom": "^25.0.1",
|
|
135
|
+
"tailwind-merge": "^3.7.0",
|
|
136
|
+
"tailwindcss": "^4.3.3",
|
|
100
137
|
"typescript": "^5.7.2",
|
|
101
138
|
"typescript-eslint": "^8.18.1",
|
|
102
139
|
"vite": "^7.3.7",
|