We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b32fb7 commit 6d2842eCopy full SHA for 6d2842e
app/stores/assistant.ts
@@ -0,0 +1,7 @@
1
+export const useAssistantStore = defineStore('assistant', () => {
2
+ const system = ref('')
3
+
4
+ return {
5
+ system,
6
+ }
7
+})
app/utils/assistant.ts
@@ -0,0 +1,14 @@
+interface DefineSystemPromptOptions {
+ system: MaybeRef<string> | (() => Promise<MaybeRef<string>>)
+}
+export function defineAssistantContext(options: DefineSystemPromptOptions) {
+ const store = storeToRefs(useAssistantStore())
+ const system = typeof options.system === 'function' ? options.system() : Promise.resolve(options.system)
8
9
+ async function setup() {
10
+ store.system.value = unref(await system)
11
12
13
+ setup()
14
0 commit comments