@yak-io/nuxt 0.3.0 → 0.5.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 +84 -59
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/plugin.d.ts +18 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +5 -3
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
# @yak-io/nuxt
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 📚 **Full documentation:** https://docs.yak.io/docs/sdks/nuxt
|
|
4
|
+
>
|
|
5
|
+
> 🤖 **For LLMs / AI agents:** https://docs.yak.io/llms.txt
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Nuxt 3 SDK for [Yak](https://docs.yak.io) — an embeddable AI assistant (text chat **and** push-to-talk voice) for web apps. Register `createYakProvider` in a client plugin and expose the `YakApi` (Vue refs) through `useNuxtApp()`.
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
pnpm add @yak-io/nuxt
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Exports
|
|
14
|
+
|
|
15
|
+
| Export | Kind | Purpose |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| `createYakProvider(options)` | fn | Create a widget instance. Returns a `YakApi` with refs + `mount`/`destroy`. |
|
|
18
|
+
| `createYakToolset` / `createYakServerAdapter` | fn | Compose GraphQL/REST/tRPC/custom tool adapters into one `onToolCall` (re-exported from `@yak-io/javascript`). |
|
|
19
|
+
| `enableYakLogging` / `disableYakLogging` / `isYakLoggingEnabled` | fn | Toggle verbose SDK logging. |
|
|
20
|
+
| Types | — | `YakProviderOptions`, `YakApi`, `ToolCallEventHandler`, plus core types from `@yak-io/javascript`. |
|
|
21
|
+
|
|
11
22
|
## Quickstart
|
|
12
23
|
|
|
13
|
-
### 1. Create a
|
|
24
|
+
### 1. Create a client plugin
|
|
14
25
|
|
|
15
26
|
```ts
|
|
16
27
|
// plugins/yak.client.ts
|
|
17
|
-
import {
|
|
18
|
-
import { createYakProvider, enableYakLogging, disableYakLogging, isYakLoggingEnabled } from "@yak-io/nuxt";
|
|
28
|
+
import { createYakProvider } from "@yak-io/nuxt";
|
|
19
29
|
|
|
20
30
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
21
31
|
const runtimeConfig = useRuntimeConfig();
|
|
22
32
|
|
|
23
33
|
const yak = createYakProvider({
|
|
24
|
-
appId: runtimeConfig.public.yakAppId,
|
|
34
|
+
appId: runtimeConfig.public.yakAppId as string,
|
|
35
|
+
mode: "both", // "chat" | "voice" | "both" — default "chat"
|
|
36
|
+
trigger: true, // show the floating launcher pill
|
|
25
37
|
theme: { position: "bottom-right", colorMode: "system" },
|
|
26
|
-
trigger: { label: "Ask with AI" },
|
|
27
38
|
getConfig: async () => {
|
|
28
39
|
const res = await fetch("/api/yak");
|
|
29
40
|
return res.json();
|
|
@@ -38,89 +49,100 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
38
49
|
if (!data.ok) throw new Error(data.error);
|
|
39
50
|
return data.result;
|
|
40
51
|
},
|
|
41
|
-
onRedirect: (path) =>
|
|
42
|
-
navigateTo(path);
|
|
43
|
-
},
|
|
52
|
+
onRedirect: (path) => navigateTo(path),
|
|
44
53
|
});
|
|
45
54
|
|
|
46
|
-
// Mount on client, clean up on HMR
|
|
47
55
|
nuxtApp.hook("app:mounted", () => yak.mount());
|
|
48
|
-
if (import.meta.hot)
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
provide: {
|
|
54
|
-
yak,
|
|
55
|
-
yakLogging: { enableYakLogging, disableYakLogging, isYakLoggingEnabled },
|
|
56
|
-
},
|
|
57
|
-
};
|
|
56
|
+
if (import.meta.hot) import.meta.hot.dispose(() => yak.destroy());
|
|
57
|
+
|
|
58
|
+
return { provide: { yak } };
|
|
58
59
|
});
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
The `.client.ts` suffix keeps the widget out of SSR. Use `runtimeConfig.public.yakAppId` (set via `NUXT_PUBLIC_YAK_APP_ID`).
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
### 2. Access it in components
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<script setup lang="ts">
|
|
65
68
|
const { $yak } = useNuxtApp();
|
|
66
|
-
const { open, openWithPrompt, isOpen
|
|
69
|
+
const { open, openWithPrompt, isOpen } = $yak;
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<button @click="open">Open chat</button>
|
|
74
|
+
<button @click="openWithPrompt('How do I get started?')">Get help</button>
|
|
75
|
+
<span v-if="isOpen">Chat is open</span>
|
|
76
|
+
</template>
|
|
67
77
|
```
|
|
68
78
|
|
|
69
|
-
`isOpen
|
|
79
|
+
`isOpen`/`isReady` are `readonly` Vue refs.
|
|
80
|
+
|
|
81
|
+
## Voice
|
|
82
|
+
|
|
83
|
+
Set `mode: "voice"` or `mode: "both"`, then drive the session. `voiceStart()` must run from a user gesture (browser mic requirement).
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
const { $yak } = useNuxtApp();
|
|
88
|
+
const { voiceToggle, voiceLoading, voiceMachine } = $yak;
|
|
89
|
+
</script>
|
|
70
90
|
|
|
71
|
-
```html
|
|
72
91
|
<template>
|
|
73
|
-
<button @click="
|
|
74
|
-
|
|
92
|
+
<button @click="voiceToggle" :disabled="voiceLoading">
|
|
93
|
+
{{ voiceMachine.state === "idle" ? "Start voice" : `Stop (${voiceMachine.state})` }}
|
|
94
|
+
</button>
|
|
75
95
|
</template>
|
|
76
96
|
```
|
|
77
97
|
|
|
78
|
-
|
|
98
|
+
## Tool events
|
|
79
99
|
|
|
80
100
|
```ts
|
|
81
101
|
const { $yak } = useNuxtApp();
|
|
82
102
|
|
|
83
103
|
$yak.subscribeToToolEvents((event) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
104
|
+
// { name, args, ok, result?, error? }
|
|
105
|
+
if (event.ok && event.name.startsWith("tasks.")) refreshTasks();
|
|
87
106
|
});
|
|
88
107
|
```
|
|
89
108
|
|
|
90
|
-
## API
|
|
109
|
+
## API reference
|
|
91
110
|
|
|
92
111
|
### `createYakProvider(options)`
|
|
93
112
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
You must call `yak.mount()` on the client side (e.g., in the `app:mounted` hook) and `yak.destroy()` when cleaning up.
|
|
97
|
-
|
|
98
|
-
**Options:**
|
|
113
|
+
Returns a `YakApi`. Call `yak.mount()` on the client (e.g. the `app:mounted` hook) and `yak.destroy()` on cleanup.
|
|
99
114
|
|
|
100
|
-
| Option | Type | Description |
|
|
101
|
-
|
|
102
|
-
| `appId` | `string` | Your Yak app ID |
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `disableRestartButton` | `boolean` | Hide the restart session button |
|
|
110
|
-
| `trigger` | `boolean \| TriggerButtonConfig` | Built-in trigger button |
|
|
115
|
+
| Option | Type | Default | Description |
|
|
116
|
+
| --- | --- | --- | --- |
|
|
117
|
+
| `appId` | `string` | — | Your Yak app ID (required). |
|
|
118
|
+
| `mode` | `"chat" \| "voice" \| "both"` | `"chat"` | Which surfaces the widget exposes. |
|
|
119
|
+
| `trigger` | `boolean \| TriggerButtonConfig` | `false` | Show the floating pill. **Set `true`** to display it; `TriggerButtonConfig` recolors it. |
|
|
120
|
+
| `getConfig` | `ChatConfigProvider` | — | Async provider of routes + tools. Called on open / voice start. |
|
|
121
|
+
| `onToolCall` | `ToolCallHandler` | — | Executes a tool the assistant calls. || `theme` | `Theme` | — | Position, color mode, and colors. |
|
|
122
|
+
| `onRedirect` | `(path: string) => void` | `window.location.assign` | Navigation handler. |
|
|
123
|
+
| `disableRestartButton` | `boolean` | `false` | Hide the restart-session button. |
|
|
111
124
|
|
|
112
125
|
### `YakApi`
|
|
113
126
|
|
|
114
127
|
```ts
|
|
115
128
|
type YakApi = {
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
// chat
|
|
130
|
+
isOpen: DeepReadonly<Ref<boolean>>;
|
|
131
|
+
isReady: DeepReadonly<Ref<boolean>>;
|
|
132
|
+
chatLoading: DeepReadonly<Ref<boolean>>; // isOpen && !isReady
|
|
118
133
|
open: () => void;
|
|
119
134
|
close: () => void;
|
|
120
135
|
openWithPrompt: (prompt: string) => void;
|
|
121
136
|
subscribeToToolEvents: (handler: ToolCallEventHandler) => () => void;
|
|
122
|
-
|
|
123
|
-
|
|
137
|
+
// voice
|
|
138
|
+
voiceMachine: DeepReadonly<Ref<VoiceMachine>>; // { state, errorMessage? }
|
|
139
|
+
voiceLoading: DeepReadonly<Ref<boolean>>; // state === "connecting"
|
|
140
|
+
voiceStart: () => Promise<void>;
|
|
141
|
+
voiceStop: () => Promise<void>;
|
|
142
|
+
voiceToggle: () => Promise<void>;
|
|
143
|
+
// lifecycle
|
|
144
|
+
mount: () => void; // call in app:mounted
|
|
145
|
+
destroy: () => void; // call on HMR dispose / cleanup
|
|
124
146
|
};
|
|
125
147
|
```
|
|
126
148
|
|
|
@@ -129,9 +151,7 @@ type YakApi = {
|
|
|
129
151
|
```ts
|
|
130
152
|
import { enableYakLogging, disableYakLogging, isYakLoggingEnabled } from "@yak-io/nuxt";
|
|
131
153
|
|
|
132
|
-
enableYakLogging();
|
|
133
|
-
disableYakLogging(); // Disable SDK logs
|
|
134
|
-
isYakLoggingEnabled(); // → boolean
|
|
154
|
+
enableYakLogging(); // verbose SDK logs
|
|
135
155
|
```
|
|
136
156
|
|
|
137
157
|
## Types
|
|
@@ -144,12 +164,17 @@ import type {
|
|
|
144
164
|
ChatConfigProvider,
|
|
145
165
|
ToolCallHandler,
|
|
146
166
|
ToolCallEvent,
|
|
167
|
+
ToolAdapter,
|
|
168
|
+
YakToolset,
|
|
169
|
+
YakServerAdapterConfig,
|
|
147
170
|
Theme,
|
|
148
|
-
|
|
171
|
+
WidgetMode,
|
|
149
172
|
WidgetPosition,
|
|
173
|
+
VoiceState,
|
|
174
|
+
VoiceMachine,
|
|
150
175
|
} from "@yak-io/nuxt";
|
|
151
176
|
```
|
|
152
177
|
|
|
153
178
|
## License
|
|
154
179
|
|
|
155
|
-
Proprietary — see LICENSE
|
|
180
|
+
Proprietary — see [LICENSE](./LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ChatConfigProvider, GraphQLRequest,
|
|
2
|
-
export { disableYakLogging, enableYakLogging, isYakLoggingEnabled } from "@yak-io/javascript";
|
|
1
|
+
export type { ChatConfigProvider, GraphQLRequest, RESTRequest, Theme, ThemeColors, ToolAdapter, ToolCallEvent, ToolCallHandler, TriggerButtonConfig, VoiceMachine, VoiceState, WidgetMode, WidgetPosition, YakServerAdapterConfig, YakToolset, } from "@yak-io/javascript";
|
|
2
|
+
export { createYakServerAdapter, createYakToolset, disableYakLogging, enableYakLogging, isYakLoggingEnabled, } from "@yak-io/javascript";
|
|
3
3
|
export type { ToolCallEventHandler, YakApi, YakProviderOptions } from "./plugin.js";
|
|
4
4
|
export { createYakProvider } from "./plugin.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,KAAK,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Public API
|
|
2
|
-
// Re-export logging utilities
|
|
3
|
-
export { disableYakLogging, enableYakLogging, isYakLoggingEnabled } from "@yak-io/javascript";
|
|
2
|
+
// Re-export tool composition + logging utilities
|
|
3
|
+
export { createYakServerAdapter, createYakToolset, disableYakLogging, enableYakLogging, isYakLoggingEnabled, } from "@yak-io/javascript";
|
|
4
4
|
export { createYakProvider } from "./plugin.js";
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatConfigProvider, type
|
|
1
|
+
import { type ChatConfigProvider, type Theme, type ToolCallEvent, type ToolCallHandler, type TriggerButtonConfig, type VoiceMachine, type WidgetMode } from "@yak-io/javascript";
|
|
2
2
|
import { type DeepReadonly, type Ref } from "vue";
|
|
3
3
|
export type ToolCallEventHandler = (event: ToolCallEvent) => void;
|
|
4
4
|
export type YakProviderOptions = {
|
|
@@ -6,25 +6,40 @@ export type YakProviderOptions = {
|
|
|
6
6
|
mode?: WidgetMode;
|
|
7
7
|
getConfig?: ChatConfigProvider;
|
|
8
8
|
onToolCall?: ToolCallHandler;
|
|
9
|
-
onGraphQLSchemaCall?: GraphQLSchemaHandler;
|
|
10
|
-
onRESTSchemaCall?: RESTSchemaHandler;
|
|
11
9
|
theme?: Theme;
|
|
12
10
|
onRedirect?: (path: string) => void;
|
|
13
11
|
disableRestartButton?: boolean;
|
|
14
12
|
trigger?: boolean | TriggerButtonConfig;
|
|
15
13
|
};
|
|
14
|
+
/** Reactive handle for controlling the Yak widget — chat + voice — from Nuxt. */
|
|
16
15
|
export type YakApi = {
|
|
16
|
+
/** Whether the chat panel is currently open. */
|
|
17
17
|
isOpen: DeepReadonly<Ref<boolean>>;
|
|
18
|
+
/** Whether the chat iframe is ready to receive messages. */
|
|
18
19
|
isReady: DeepReadonly<Ref<boolean>>;
|
|
20
|
+
/** Whether the chat is opening but not yet interactive (`isOpen && !isReady`). */
|
|
21
|
+
chatLoading: DeepReadonly<Ref<boolean>>;
|
|
22
|
+
/** Open the chat panel. */
|
|
19
23
|
open: () => void;
|
|
24
|
+
/** Close the chat panel. */
|
|
20
25
|
close: () => void;
|
|
26
|
+
/** Open the chat panel and send a specific prompt. */
|
|
21
27
|
openWithPrompt: (prompt: string) => void;
|
|
28
|
+
/** Subscribe to tool-call completion events; returns an unsubscribe function. */
|
|
22
29
|
subscribeToToolEvents: (handler: ToolCallEventHandler) => () => void;
|
|
30
|
+
/** Current voice state-machine snapshot. `idle` when mode is `chat`. */
|
|
23
31
|
voiceMachine: DeepReadonly<Ref<VoiceMachine>>;
|
|
32
|
+
/** Whether the voice session is establishing its connection (`state === "connecting"`). */
|
|
33
|
+
voiceLoading: DeepReadonly<Ref<boolean>>;
|
|
34
|
+
/** Start a voice session. Must be invoked from a user gesture. */
|
|
24
35
|
voiceStart: () => Promise<void>;
|
|
36
|
+
/** Stop the current voice session. */
|
|
25
37
|
voiceStop: () => Promise<void>;
|
|
38
|
+
/** Toggle voice: start if idle/error, stop if active. */
|
|
26
39
|
voiceToggle: () => Promise<void>;
|
|
40
|
+
/** Mount the widget into the DOM. */
|
|
27
41
|
mount: () => void;
|
|
42
|
+
/** Tear down the widget and remove its listeners. */
|
|
28
43
|
destroy: () => void;
|
|
29
44
|
};
|
|
30
45
|
/**
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAGvB,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,GAAG,EAAiB,MAAM,KAAK,CAAC;AAI3E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAAC;CACzC,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,MAAM,GAAG;IAEnB,gDAAgD;IAChD,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,4DAA4D;IAC5D,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,kFAAkF;IAClF,WAAW,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACxC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,sDAAsD;IACtD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,iFAAiF;IACjF,qBAAqB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,IAAI,CAAC;IAErE,wEAAwE;IACxE,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9C,2FAA2F;IAC3F,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,kEAAkE;IAClE,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,sCAAsC;IACtC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,yDAAyD;IACzD,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC,qCAAqC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qDAAqD;IACrD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAIF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAsGrE"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INITIAL_VOICE_MACHINE, logger, YakEmbed, } from "@yak-io/javascript";
|
|
2
|
-
import { readonly, ref } from "vue";
|
|
2
|
+
import { computed, readonly, ref } from "vue";
|
|
3
3
|
// ── Provider factory ────────────────────────────────────────────────────────
|
|
4
4
|
/**
|
|
5
5
|
* Creates a yak widget (chat + voice) for Nuxt.
|
|
@@ -34,8 +34,6 @@ export function createYakProvider(options) {
|
|
|
34
34
|
trigger: options.trigger ?? false,
|
|
35
35
|
getConfig: options.getConfig,
|
|
36
36
|
onToolCall: options.onToolCall,
|
|
37
|
-
onGraphQLSchemaCall: options.onGraphQLSchemaCall,
|
|
38
|
-
onRESTSchemaCall: options.onRESTSchemaCall,
|
|
39
37
|
onRedirect: resolvedRedirect,
|
|
40
38
|
options: { disableRestartButton: options.disableRestartButton },
|
|
41
39
|
onToolCallComplete: handleToolCallComplete,
|
|
@@ -75,9 +73,12 @@ export function createYakProvider(options) {
|
|
|
75
73
|
logger.warn("Voice start failed", err);
|
|
76
74
|
}
|
|
77
75
|
};
|
|
76
|
+
const chatLoading = computed(() => isOpen.value && !isReady.value);
|
|
77
|
+
const voiceLoading = computed(() => voiceMachine.value.state === "connecting");
|
|
78
78
|
return {
|
|
79
79
|
isOpen: readonly(isOpen),
|
|
80
80
|
isReady: readonly(isReady),
|
|
81
|
+
chatLoading,
|
|
81
82
|
open: () => embed.open(),
|
|
82
83
|
close: () => embed.close(),
|
|
83
84
|
openWithPrompt: (prompt) => embed.openWithPrompt(prompt),
|
|
@@ -88,6 +89,7 @@ export function createYakProvider(options) {
|
|
|
88
89
|
};
|
|
89
90
|
},
|
|
90
91
|
voiceMachine: readonly(voiceMachine),
|
|
92
|
+
voiceLoading,
|
|
91
93
|
voiceStart,
|
|
92
94
|
voiceStop: () => embed.voiceStop(),
|
|
93
95
|
voiceToggle: () => embed.voiceToggle(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yak-io/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Nuxt 3 module for embedding yak chatbot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"node": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
+
"README.md",
|
|
28
29
|
"dist",
|
|
29
30
|
"LICENSE"
|
|
30
31
|
],
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"./package.json": "./package.json"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@yak-io/javascript": "0.
|
|
45
|
+
"@yak-io/javascript": "0.10.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"nuxt": "^3.0.0",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"vue": "^3.5.34",
|
|
54
55
|
"@repo/typescript-config": "0.0.0"
|
|
55
56
|
},
|
|
57
|
+
"homepage": "https://docs.yak.io/docs/sdks/nuxt",
|
|
56
58
|
"scripts": {
|
|
57
59
|
"build": "tsc",
|
|
58
60
|
"check-types": "tsc --noEmit",
|