@assistant-ui/react 0.5.94 → 0.5.96
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.d.ts +1 -1
- package/dist/runtimes/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +2 -2
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.mjs +2 -2
- package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
- package/generated/base-components.css.json +48 -0
- package/generated/default.css.json +45 -0
- package/generated/modal.css.json +26 -0
- package/generated/thread.css.json +153 -0
- package/package.json +4 -3
- package/src/runtimes/local/LocalRuntimeCore.tsx +1 -1
- package/src/runtimes/local/useLocalRuntime.tsx +2 -2
@@ -5,7 +5,7 @@ import { LocalThreadManagerRuntimeCore } from "./LocalThreadManagerRuntimeCore";
|
|
5
5
|
export declare class LocalRuntimeCore extends BaseAssistantRuntimeCore {
|
6
6
|
readonly threadManager: LocalThreadManagerRuntimeCore;
|
7
7
|
private _options;
|
8
|
-
constructor(options: LocalRuntimeOptionsBase, initialMessages
|
8
|
+
constructor(options: LocalRuntimeOptionsBase, initialMessages: readonly CoreMessage[] | undefined);
|
9
9
|
setOptions(options: LocalRuntimeOptionsBase): void;
|
10
10
|
reset({ initialMessages, }?: {
|
11
11
|
initialMessages?: readonly CoreMessage[] | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LocalRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAehF,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,SAAgB,aAAa,gCAAC;IAE9B,OAAO,CAAC,QAAQ,CAA0B;gBAGxC,OAAO,EAAE,uBAAuB,EAChC,eAAe,
|
1
|
+
{"version":3,"file":"LocalRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAehF,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,SAAgB,aAAa,gCAAC;IAE9B,OAAO,CAAC,QAAQ,CAA0B;gBAGxC,OAAO,EAAE,uBAAuB,EAChC,eAAe,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS;IAuB9C,UAAU,CAAC,OAAO,EAAE,uBAAuB;IAM3C,KAAK,CAAC,EACX,eAAe,GAChB,GAAE;QACD,eAAe,CAAC,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,CAAC;KACjD;CAQP"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"sourcesContent":["import type { CoreMessage } from \"../../types/AssistantTypes\";\nimport { BaseAssistantRuntimeCore } from \"../core/BaseAssistantRuntimeCore\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\nimport { LocalRuntimeOptionsBase } from \"./LocalRuntimeOptions\";\nimport { fromCoreMessages } from \"../edge/converters/fromCoreMessage\";\nimport { LocalThreadManagerRuntimeCore } from \"./LocalThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\n\nconst getExportFromInitialMessages = (\n initialMessages: readonly CoreMessage[],\n): ExportedMessageRepository => {\n const messages = fromCoreMessages(initialMessages);\n return {\n messages: messages.map((m, idx) => ({\n parentId: messages[idx - 1]?.id ?? null,\n message: m,\n })),\n };\n};\n\nexport class LocalRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadManager;\n\n private _options: LocalRuntimeOptionsBase;\n\n constructor(\n options: LocalRuntimeOptionsBase,\n initialMessages
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"sourcesContent":["import type { CoreMessage } from \"../../types/AssistantTypes\";\nimport { BaseAssistantRuntimeCore } from \"../core/BaseAssistantRuntimeCore\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\nimport { LocalRuntimeOptionsBase } from \"./LocalRuntimeOptions\";\nimport { fromCoreMessages } from \"../edge/converters/fromCoreMessage\";\nimport { LocalThreadManagerRuntimeCore } from \"./LocalThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\n\nconst getExportFromInitialMessages = (\n initialMessages: readonly CoreMessage[],\n): ExportedMessageRepository => {\n const messages = fromCoreMessages(initialMessages);\n return {\n messages: messages.map((m, idx) => ({\n parentId: messages[idx - 1]?.id ?? null,\n message: m,\n })),\n };\n};\n\nexport class LocalRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadManager;\n\n private _options: LocalRuntimeOptionsBase;\n\n constructor(\n options: LocalRuntimeOptionsBase,\n initialMessages: readonly CoreMessage[] | undefined,\n ) {\n super();\n\n this._options = options;\n\n this.threadManager = new LocalThreadManagerRuntimeCore((threadId, data) => {\n const thread = new LocalThreadRuntimeCore(\n this._proxyConfigProvider,\n threadId,\n this._options,\n );\n thread.import(data);\n return thread;\n });\n\n if (initialMessages) {\n this.threadManager.mainThread.import(\n getExportFromInitialMessages(initialMessages),\n );\n }\n }\n\n public setOptions(options: LocalRuntimeOptionsBase) {\n this._options = options;\n\n this.threadManager.mainThread.setOptions(options);\n }\n\n public reset({\n initialMessages,\n }: {\n initialMessages?: readonly CoreMessage[] | undefined;\n } = {}) {\n this.threadManager.switchToNewThread();\n if (!initialMessages) return;\n\n this.threadManager.mainThread.import(\n getExportFromInitialMessages(initialMessages),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sCAAyC;AACzC,oCAAuC;AAEvC,6BAAiC;AACjC,2CAA8C;AAG9C,MAAM,+BAA+B,CACnC,oBAC8B;AAC9B,QAAM,eAAW,yCAAiB,eAAe;AACjD,SAAO;AAAA,IACL,UAAU,SAAS,IAAI,CAAC,GAAG,SAAS;AAAA,MAClC,UAAU,SAAS,MAAM,CAAC,GAAG,MAAM;AAAA,MACnC,SAAS;AAAA,IACX,EAAE;AAAA,EACJ;AACF;AAEO,MAAM,yBAAyB,yDAAyB;AAAA,EAC7C;AAAA,EAER;AAAA,EAER,YACE,SACA,iBACA;AACA,UAAM;AAEN,SAAK,WAAW;AAEhB,SAAK,gBAAgB,IAAI,mEAA8B,CAAC,UAAU,SAAS;AACzE,YAAM,SAAS,IAAI;AAAA,QACjB,KAAK;AAAA,QACL;AAAA,QACA,KAAK;AAAA,MACP;AACA,aAAO,OAAO,IAAI;AAClB,aAAO;AAAA,IACT,CAAC;AAED,QAAI,iBAAiB;AACnB,WAAK,cAAc,WAAW;AAAA,QAC5B,6BAA6B,eAAe;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AAAA,EAEO,WAAW,SAAkC;AAClD,SAAK,WAAW;AAEhB,SAAK,cAAc,WAAW,WAAW,OAAO;AAAA,EAClD;AAAA,EAEO,MAAM;AAAA,IACX;AAAA,EACF,IAEI,CAAC,GAAG;AACN,SAAK,cAAc,kBAAkB;AACrC,QAAI,CAAC,gBAAiB;AAEtB,SAAK,cAAc,WAAW;AAAA,MAC5B,6BAA6B,eAAe;AAAA,IAC9C;AAAA,EACF;AACF;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"sourcesContent":["import type { CoreMessage } from \"../../types/AssistantTypes\";\nimport { BaseAssistantRuntimeCore } from \"../core/BaseAssistantRuntimeCore\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\nimport { LocalRuntimeOptionsBase } from \"./LocalRuntimeOptions\";\nimport { fromCoreMessages } from \"../edge/converters/fromCoreMessage\";\nimport { LocalThreadManagerRuntimeCore } from \"./LocalThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\n\nconst getExportFromInitialMessages = (\n initialMessages: readonly CoreMessage[],\n): ExportedMessageRepository => {\n const messages = fromCoreMessages(initialMessages);\n return {\n messages: messages.map((m, idx) => ({\n parentId: messages[idx - 1]?.id ?? null,\n message: m,\n })),\n };\n};\n\nexport class LocalRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadManager;\n\n private _options: LocalRuntimeOptionsBase;\n\n constructor(\n options: LocalRuntimeOptionsBase,\n initialMessages
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeCore.tsx"],"sourcesContent":["import type { CoreMessage } from \"../../types/AssistantTypes\";\nimport { BaseAssistantRuntimeCore } from \"../core/BaseAssistantRuntimeCore\";\nimport { LocalThreadRuntimeCore } from \"./LocalThreadRuntimeCore\";\nimport { LocalRuntimeOptionsBase } from \"./LocalRuntimeOptions\";\nimport { fromCoreMessages } from \"../edge/converters/fromCoreMessage\";\nimport { LocalThreadManagerRuntimeCore } from \"./LocalThreadManagerRuntimeCore\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\n\nconst getExportFromInitialMessages = (\n initialMessages: readonly CoreMessage[],\n): ExportedMessageRepository => {\n const messages = fromCoreMessages(initialMessages);\n return {\n messages: messages.map((m, idx) => ({\n parentId: messages[idx - 1]?.id ?? null,\n message: m,\n })),\n };\n};\n\nexport class LocalRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadManager;\n\n private _options: LocalRuntimeOptionsBase;\n\n constructor(\n options: LocalRuntimeOptionsBase,\n initialMessages: readonly CoreMessage[] | undefined,\n ) {\n super();\n\n this._options = options;\n\n this.threadManager = new LocalThreadManagerRuntimeCore((threadId, data) => {\n const thread = new LocalThreadRuntimeCore(\n this._proxyConfigProvider,\n threadId,\n this._options,\n );\n thread.import(data);\n return thread;\n });\n\n if (initialMessages) {\n this.threadManager.mainThread.import(\n getExportFromInitialMessages(initialMessages),\n );\n }\n }\n\n public setOptions(options: LocalRuntimeOptionsBase) {\n this._options = options;\n\n this.threadManager.mainThread.setOptions(options);\n }\n\n public reset({\n initialMessages,\n }: {\n initialMessages?: readonly CoreMessage[] | undefined;\n } = {}) {\n this.threadManager.switchToNewThread();\n if (!initialMessages) return;\n\n this.threadManager.mainThread.import(\n getExportFromInitialMessages(initialMessages),\n );\n }\n}\n"],"mappings":"AACA,SAAS,gCAAgC;AACzC,SAAS,8BAA8B;AAEvC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;AAG9C,MAAM,+BAA+B,CACnC,oBAC8B;AAC9B,QAAM,WAAW,iBAAiB,eAAe;AACjD,SAAO;AAAA,IACL,UAAU,SAAS,IAAI,CAAC,GAAG,SAAS;AAAA,MAClC,UAAU,SAAS,MAAM,CAAC,GAAG,MAAM;AAAA,MACnC,SAAS;AAAA,IACX,EAAE;AAAA,EACJ;AACF;AAEO,MAAM,yBAAyB,yBAAyB;AAAA,EAC7C;AAAA,EAER;AAAA,EAER,YACE,SACA,iBACA;AACA,UAAM;AAEN,SAAK,WAAW;AAEhB,SAAK,gBAAgB,IAAI,8BAA8B,CAAC,UAAU,SAAS;AACzE,YAAM,SAAS,IAAI;AAAA,QACjB,KAAK;AAAA,QACL;AAAA,QACA,KAAK;AAAA,MACP;AACA,aAAO,OAAO,IAAI;AAClB,aAAO;AAAA,IACT,CAAC;AAED,QAAI,iBAAiB;AACnB,WAAK,cAAc,WAAW;AAAA,QAC5B,6BAA6B,eAAe;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AAAA,EAEO,WAAW,SAAkC;AAClD,SAAK,WAAW;AAEhB,SAAK,cAAc,WAAW,WAAW,OAAO;AAAA,EAClD;AAAA,EAEO,MAAM;AAAA,IACX;AAAA,EACF,IAEI,CAAC,GAAG;AACN,SAAK,cAAc,kBAAkB;AACrC,QAAI,CAAC,gBAAiB;AAEtB,SAAK,cAAc,WAAW;AAAA,MAC5B,6BAA6B,eAAe;AAAA,IAC9C;AAAA,EACF;AACF;","names":[]}
|
@@ -5,5 +5,5 @@ import { AssistantRuntime } from "../../api/AssistantRuntime";
|
|
5
5
|
export type LocalRuntime = AssistantRuntime & {
|
6
6
|
reset: (options?: Parameters<LocalRuntimeCore["reset"]>[0]) => void;
|
7
7
|
};
|
8
|
-
export declare const useLocalRuntime: (adapter: ChatModelAdapter, options?: LocalRuntimeOptions) => LocalRuntime;
|
8
|
+
export declare const useLocalRuntime: (adapter: ChatModelAdapter, { initialMessages, ...options }?: LocalRuntimeOptions) => LocalRuntime;
|
9
9
|
//# sourceMappingURL=useLocalRuntime.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useLocalRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC5C,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACrE,CAAC;AAsBF,eAAO,MAAM,eAAe,YACjB,gBAAgB,
|
1
|
+
{"version":3,"file":"useLocalRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC5C,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACrE,CAAC;AAsBF,eAAO,MAAM,eAAe,YACjB,gBAAgB,oCACQ,mBAAmB,iBAiBrD,CAAC"}
|
@@ -41,7 +41,7 @@ class LocalRuntimeImpl extends import_AssistantRuntime.AssistantRuntimeImpl {
|
|
41
41
|
);
|
42
42
|
}
|
43
43
|
}
|
44
|
-
const useLocalRuntime = (adapter, options = {}) => {
|
44
|
+
const useLocalRuntime = (adapter, { initialMessages, ...options } = {}) => {
|
45
45
|
const opt = {
|
46
46
|
...options,
|
47
47
|
adapters: {
|
@@ -49,7 +49,7 @@ const useLocalRuntime = (adapter, options = {}) => {
|
|
49
49
|
chatModel: adapter
|
50
50
|
}
|
51
51
|
};
|
52
|
-
const [runtime] = (0, import_react.useState)(() => new import_LocalRuntimeCore.LocalRuntimeCore(opt));
|
52
|
+
const [runtime] = (0, import_react.useState)(() => new import_LocalRuntimeCore.LocalRuntimeCore(opt, initialMessages));
|
53
53
|
(0, import_react.useEffect)(() => {
|
54
54
|
runtime.setOptions(opt);
|
55
55
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { LocalRuntimeCore } from \"./LocalRuntimeCore\";\nimport { LocalRuntimeOptions } from \"./LocalRuntimeOptions\";\nimport {\n AssistantRuntime,\n AssistantRuntimeImpl,\n} from \"../../api/AssistantRuntime\";\nimport { ThreadRuntimeImpl } from \"../../internal\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\n\nexport type LocalRuntime = AssistantRuntime & {\n reset: (options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) => void;\n};\n\nclass LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {\n private constructor(\n private core: LocalRuntimeCore,\n thread: ThreadRuntime,\n ) {\n super(core, thread);\n }\n\n public reset(options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) {\n this.core.reset(options);\n }\n\n public static override create(_core: LocalRuntimeCore) {\n return new LocalRuntimeImpl(\n _core,\n AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl),\n ) as LocalRuntime;\n }\n}\n\nexport const useLocalRuntime = (\n adapter: ChatModelAdapter,\n options: LocalRuntimeOptions = {},\n) => {\n const opt = {\n ...options,\n adapters: {\n ...options.adapters,\n chatModel: adapter,\n },\n };\n\n const [runtime] = useState(() => new LocalRuntimeCore(opt));\n\n useEffect(() => {\n runtime.setOptions(opt);\n });\n\n return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA6C;AAE7C,8BAAiC;AAEjC,8BAGO;AACP,sBAAkC;AAOlC,MAAM,yBAAyB,6CAA6C;AAAA,EAClE,YACE,MACR,QACA;AACA,UAAM,MAAM,MAAM;AAHV;AAAA,EAIV;AAAA,EAEO,MAAM,SAAoD;AAC/D,SAAK,KAAK,MAAM,OAAO;AAAA,EACzB;AAAA,EAEA,OAAuB,OAAO,OAAyB;AACrD,WAAO,IAAI;AAAA,MACT;AAAA,MACA,6CAAqB,wBAAwB,OAAO,iCAAiB;AAAA,IACvE;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,CAC7B,SACA,
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { LocalRuntimeCore } from \"./LocalRuntimeCore\";\nimport { LocalRuntimeOptions } from \"./LocalRuntimeOptions\";\nimport {\n AssistantRuntime,\n AssistantRuntimeImpl,\n} from \"../../api/AssistantRuntime\";\nimport { ThreadRuntimeImpl } from \"../../internal\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\n\nexport type LocalRuntime = AssistantRuntime & {\n reset: (options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) => void;\n};\n\nclass LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {\n private constructor(\n private core: LocalRuntimeCore,\n thread: ThreadRuntime,\n ) {\n super(core, thread);\n }\n\n public reset(options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) {\n this.core.reset(options);\n }\n\n public static override create(_core: LocalRuntimeCore) {\n return new LocalRuntimeImpl(\n _core,\n AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl),\n ) as LocalRuntime;\n }\n}\n\nexport const useLocalRuntime = (\n adapter: ChatModelAdapter,\n { initialMessages, ...options }: LocalRuntimeOptions = {},\n) => {\n const opt = {\n ...options,\n adapters: {\n ...options.adapters,\n chatModel: adapter,\n },\n };\n\n const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));\n\n useEffect(() => {\n runtime.setOptions(opt);\n });\n\n return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA6C;AAE7C,8BAAiC;AAEjC,8BAGO;AACP,sBAAkC;AAOlC,MAAM,yBAAyB,6CAA6C;AAAA,EAClE,YACE,MACR,QACA;AACA,UAAM,MAAM,MAAM;AAHV;AAAA,EAIV;AAAA,EAEO,MAAM,SAAoD;AAC/D,SAAK,KAAK,MAAM,OAAO;AAAA,EACzB;AAAA,EAEA,OAAuB,OAAO,OAAyB;AACrD,WAAO,IAAI;AAAA,MACT;AAAA,MACA,6CAAqB,wBAAwB,OAAO,iCAAiB;AAAA,IACvE;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,CAC7B,SACA,EAAE,iBAAiB,GAAG,QAAQ,IAAyB,CAAC,MACrD;AACH,QAAM,MAAM;AAAA,IACV,GAAG;AAAA,IACH,UAAU;AAAA,MACR,GAAG,QAAQ;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,CAAC,OAAO,QAAI,uBAAS,MAAM,IAAI,yCAAiB,KAAK,eAAe,CAAC;AAE3E,8BAAU,MAAM;AACd,YAAQ,WAAW,GAAG;AAAA,EACxB,CAAC;AAED,aAAO,sBAAQ,MAAM,iBAAiB,OAAO,OAAO,GAAG,CAAC,OAAO,CAAC;AAClE;","names":[]}
|
@@ -20,7 +20,7 @@ class LocalRuntimeImpl extends AssistantRuntimeImpl {
|
|
20
20
|
);
|
21
21
|
}
|
22
22
|
}
|
23
|
-
const useLocalRuntime = (adapter, options = {}) => {
|
23
|
+
const useLocalRuntime = (adapter, { initialMessages, ...options } = {}) => {
|
24
24
|
const opt = {
|
25
25
|
...options,
|
26
26
|
adapters: {
|
@@ -28,7 +28,7 @@ const useLocalRuntime = (adapter, options = {}) => {
|
|
28
28
|
chatModel: adapter
|
29
29
|
}
|
30
30
|
};
|
31
|
-
const [runtime] = useState(() => new LocalRuntimeCore(opt));
|
31
|
+
const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));
|
32
32
|
useEffect(() => {
|
33
33
|
runtime.setOptions(opt);
|
34
34
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { LocalRuntimeCore } from \"./LocalRuntimeCore\";\nimport { LocalRuntimeOptions } from \"./LocalRuntimeOptions\";\nimport {\n AssistantRuntime,\n AssistantRuntimeImpl,\n} from \"../../api/AssistantRuntime\";\nimport { ThreadRuntimeImpl } from \"../../internal\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\n\nexport type LocalRuntime = AssistantRuntime & {\n reset: (options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) => void;\n};\n\nclass LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {\n private constructor(\n private core: LocalRuntimeCore,\n thread: ThreadRuntime,\n ) {\n super(core, thread);\n }\n\n public reset(options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) {\n this.core.reset(options);\n }\n\n public static override create(_core: LocalRuntimeCore) {\n return new LocalRuntimeImpl(\n _core,\n AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl),\n ) as LocalRuntime;\n }\n}\n\nexport const useLocalRuntime = (\n adapter: ChatModelAdapter,\n options: LocalRuntimeOptions = {},\n) => {\n const opt = {\n ...options,\n adapters: {\n ...options.adapters,\n chatModel: adapter,\n },\n };\n\n const [runtime] = useState(() => new LocalRuntimeCore(opt));\n\n useEffect(() => {\n runtime.setOptions(opt);\n });\n\n return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);\n};\n"],"mappings":";AAEA,SAAS,WAAW,SAAS,gBAAgB;AAE7C,SAAS,wBAAwB;AAEjC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,yBAAyB;AAOlC,MAAM,yBAAyB,qBAA6C;AAAA,EAClE,YACE,MACR,QACA;AACA,UAAM,MAAM,MAAM;AAHV;AAAA,EAIV;AAAA,EAEO,MAAM,SAAoD;AAC/D,SAAK,KAAK,MAAM,OAAO;AAAA,EACzB;AAAA,EAEA,OAAuB,OAAO,OAAyB;AACrD,WAAO,IAAI;AAAA,MACT;AAAA,MACA,qBAAqB,wBAAwB,OAAO,iBAAiB;AAAA,IACvE;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,CAC7B,SACA,
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/useLocalRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { LocalRuntimeCore } from \"./LocalRuntimeCore\";\nimport { LocalRuntimeOptions } from \"./LocalRuntimeOptions\";\nimport {\n AssistantRuntime,\n AssistantRuntimeImpl,\n} from \"../../api/AssistantRuntime\";\nimport { ThreadRuntimeImpl } from \"../../internal\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\n\nexport type LocalRuntime = AssistantRuntime & {\n reset: (options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) => void;\n};\n\nclass LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {\n private constructor(\n private core: LocalRuntimeCore,\n thread: ThreadRuntime,\n ) {\n super(core, thread);\n }\n\n public reset(options?: Parameters<LocalRuntimeCore[\"reset\"]>[0]) {\n this.core.reset(options);\n }\n\n public static override create(_core: LocalRuntimeCore) {\n return new LocalRuntimeImpl(\n _core,\n AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl),\n ) as LocalRuntime;\n }\n}\n\nexport const useLocalRuntime = (\n adapter: ChatModelAdapter,\n { initialMessages, ...options }: LocalRuntimeOptions = {},\n) => {\n const opt = {\n ...options,\n adapters: {\n ...options.adapters,\n chatModel: adapter,\n },\n };\n\n const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));\n\n useEffect(() => {\n runtime.setOptions(opt);\n });\n\n return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);\n};\n"],"mappings":";AAEA,SAAS,WAAW,SAAS,gBAAgB;AAE7C,SAAS,wBAAwB;AAEjC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,yBAAyB;AAOlC,MAAM,yBAAyB,qBAA6C;AAAA,EAClE,YACE,MACR,QACA;AACA,UAAM,MAAM,MAAM;AAHV;AAAA,EAIV;AAAA,EAEO,MAAM,SAAoD;AAC/D,SAAK,KAAK,MAAM,OAAO;AAAA,EACzB;AAAA,EAEA,OAAuB,OAAO,OAAyB;AACrD,WAAO,IAAI;AAAA,MACT;AAAA,MACA,qBAAqB,wBAAwB,OAAO,iBAAiB;AAAA,IACvE;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,CAC7B,SACA,EAAE,iBAAiB,GAAG,QAAQ,IAAyB,CAAC,MACrD;AACH,QAAM,MAAM;AAAA,IACV,GAAG;AAAA,IACH,UAAU;AAAA,MACR,GAAG,QAAQ;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,CAAC,OAAO,IAAI,SAAS,MAAM,IAAI,iBAAiB,KAAK,eAAe,CAAC;AAE3E,YAAU,MAAM;AACd,YAAQ,WAAW,GAAG;AAAA,EACxB,CAAC;AAED,SAAO,QAAQ,MAAM,iBAAiB,OAAO,OAAO,GAAG,CAAC,OAAO,CAAC;AAClE;","names":[]}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
{
|
2
|
+
".aui-root": {
|
3
|
+
"@apply text-aui-foreground": {}
|
4
|
+
},
|
5
|
+
".aui-root *": {
|
6
|
+
"@apply border-aui-border": {}
|
7
|
+
},
|
8
|
+
".aui-button": {
|
9
|
+
"@apply focus-visible:ring-aui-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50": {}
|
10
|
+
},
|
11
|
+
".aui-button-primary": {
|
12
|
+
"@apply bg-aui-primary text-aui-primary-foreground hover:bg-aui-primary/90 shadow": {}
|
13
|
+
},
|
14
|
+
".aui-button-outline": {
|
15
|
+
"@apply border-aui-input bg-aui-background hover:bg-aui-accent hover:text-aui-accent-foreground border shadow-sm": {}
|
16
|
+
},
|
17
|
+
".aui-button-ghost": {
|
18
|
+
"@apply hover:bg-aui-accent hover:text-aui-accent-foreground": {}
|
19
|
+
},
|
20
|
+
".aui-button-medium": {
|
21
|
+
"@apply h-9 px-4 py-2": {}
|
22
|
+
},
|
23
|
+
".aui-button-icon": {
|
24
|
+
"@apply size-6 p-1": {}
|
25
|
+
},
|
26
|
+
".aui-sr-only": {
|
27
|
+
"@apply sr-only": {}
|
28
|
+
},
|
29
|
+
".aui-avatar-root": {
|
30
|
+
"@apply relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full": {}
|
31
|
+
},
|
32
|
+
".aui-avatar-image": {
|
33
|
+
"@apply aspect-square h-full w-full object-cover": {}
|
34
|
+
},
|
35
|
+
".aui-avatar-fallback": {
|
36
|
+
"@apply bg-aui-muted flex h-full w-full items-center justify-center rounded-full": {}
|
37
|
+
},
|
38
|
+
".aui-tooltip-content": {
|
39
|
+
"@apply bg-aui-popover text-aui-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md": {}
|
40
|
+
},
|
41
|
+
".aui-dialog-overlay": {
|
42
|
+
"@apply data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80": {}
|
43
|
+
},
|
44
|
+
".aui-dialog-content": {
|
45
|
+
"@apply data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50": {},
|
46
|
+
"@apply grid translate-x-[-50%] translate-y-[-50%] shadow-lg duration-200": {}
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
":root": {
|
3
|
+
"--aui-background": "0 0% 100%",
|
4
|
+
"--aui-foreground": "240 10% 3.9%",
|
5
|
+
"--aui-card": "0 0% 100%",
|
6
|
+
"--aui-card-foreground": "240 10% 3.9%",
|
7
|
+
"--aui-popover": "0 0% 100%",
|
8
|
+
"--aui-popover-foreground": "240 10% 3.9%",
|
9
|
+
"--aui-primary": "240 5.9% 10%",
|
10
|
+
"--aui-primary-foreground": "0 0% 98%",
|
11
|
+
"--aui-secondary": "240 4.8% 95.9%",
|
12
|
+
"--aui-secondary-foreground": "240 5.9% 10%",
|
13
|
+
"--aui-muted": "240 4.8% 95.9%",
|
14
|
+
"--aui-muted-foreground": "240 3.8% 46.1%",
|
15
|
+
"--aui-accent": "240 4.8% 95.9%",
|
16
|
+
"--aui-accent-foreground": "240 5.9% 10%",
|
17
|
+
"--aui-destructive": "0 84.2% 60.2%",
|
18
|
+
"--aui-destructive-foreground": "0 0% 98%",
|
19
|
+
"--aui-border": "240 5.9% 90%",
|
20
|
+
"--aui-input": "240 5.9% 90%",
|
21
|
+
"--aui-ring": "240 10% 3.9%",
|
22
|
+
"--aui-radius": "0.5rem"
|
23
|
+
},
|
24
|
+
".dark": {
|
25
|
+
"--aui-background": "0 0% 7%",
|
26
|
+
"--aui-foreground": "0 0% 98%",
|
27
|
+
"--aui-card": "240 10% 3.9%",
|
28
|
+
"--aui-card-foreground": "0 0% 98%",
|
29
|
+
"--aui-popover": "240 10% 3.9%",
|
30
|
+
"--aui-popover-foreground": "0 0% 98%",
|
31
|
+
"--aui-primary": "0 0% 98%",
|
32
|
+
"--aui-primary-foreground": "240 5.9% 10%",
|
33
|
+
"--aui-secondary": "240 3.7% 15.9%",
|
34
|
+
"--aui-secondary-foreground": "0 0% 98%",
|
35
|
+
"--aui-muted": "240 3.7% 15.9%",
|
36
|
+
"--aui-muted-foreground": "240 5% 64.9%",
|
37
|
+
"--aui-accent": "240 3.7% 15.9%",
|
38
|
+
"--aui-accent-foreground": "0 0% 98%",
|
39
|
+
"--aui-destructive": "0 62.8% 30.6%",
|
40
|
+
"--aui-destructive-foreground": "0 0% 98%",
|
41
|
+
"--aui-border": "240 3.7% 15.9%",
|
42
|
+
"--aui-input": "240 3.7% 15.9%",
|
43
|
+
"--aui-ring": "240 4.9% 83.9%"
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
".aui-modal-content": {
|
3
|
+
"@apply bg-aui-popover text-aui-popover-foreground z-50 h-[500px] w-[400px] overflow-clip rounded-xl border p-0 shadow-md outline-none": {},
|
4
|
+
"@apply [&>.aui-thread-root]:bg-inherit": {},
|
5
|
+
"@apply data-[state=closed]:animate-out data-[state=open]:animate-in": {},
|
6
|
+
"@apply data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0": {},
|
7
|
+
"@apply data-[state=closed]:zoom-out data-[state=open]:zoom-in": {},
|
8
|
+
"@apply data-[state=open]:slide-in-from-bottom-1/2 data-[state=open]:slide-in-from-right-1/2 data-[state=closed]:slide-out-to-bottom-1/2 data-[state=closed]:slide-out-to-right-1/2": {}
|
9
|
+
},
|
10
|
+
".aui-modal-anchor": {
|
11
|
+
"@apply fixed bottom-4 right-4 size-11": {}
|
12
|
+
},
|
13
|
+
".aui-modal-button": {
|
14
|
+
"@apply size-full rounded-full shadow transition-transform hover:scale-110 active:scale-90": {}
|
15
|
+
},
|
16
|
+
".aui-modal-button-closed-icon": {
|
17
|
+
"@apply absolute size-6 transition-all": {},
|
18
|
+
"@apply data-[state=closed]:rotate-0 data-[state=open]:rotate-90": {},
|
19
|
+
"@apply data-[state=closed]:scale-100 data-[state=open]:scale-0": {}
|
20
|
+
},
|
21
|
+
".aui-modal-button-open-icon": {
|
22
|
+
"@apply absolute size-6 transition-all": {},
|
23
|
+
"@apply data-[state=closed]:-rotate-90 data-[state=open]:rotate-0": {},
|
24
|
+
"@apply data-[state=closed]:scale-0 data-[state=open]:scale-100": {}
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
{
|
2
|
+
".aui-thread-root": {
|
3
|
+
"@apply bg-aui-background box-border h-full": {},
|
4
|
+
"@apply [&>.aui-thread-viewport]:bg-inherit": {}
|
5
|
+
},
|
6
|
+
".aui-thread-viewport": {
|
7
|
+
"@apply bg-aui-background flex h-full flex-col items-center overflow-y-scroll scroll-smooth px-4 pt-8": {}
|
8
|
+
},
|
9
|
+
".aui-thread-viewport-footer": {
|
10
|
+
"@apply sticky bottom-0 mt-3 flex w-full max-w-2xl flex-col items-center justify-end rounded-t-lg bg-inherit pb-4": {}
|
11
|
+
},
|
12
|
+
".aui-thread-scroll-to-bottom": {
|
13
|
+
"@apply absolute -top-8 rounded-full disabled:invisible": {}
|
14
|
+
},
|
15
|
+
".aui-thread-followup-suggestions": {
|
16
|
+
"@apply flex min-h-8 items-center justify-center gap-2": {}
|
17
|
+
},
|
18
|
+
".aui-thread-followup-suggestion": {
|
19
|
+
"@apply bg-aui-background hover:bg-aui-muted/80 rounded-full border px-3 py-1 text-sm transition-colors ease-in": {}
|
20
|
+
},
|
21
|
+
".aui-thread-welcome-root": {
|
22
|
+
"@apply flex w-full max-w-2xl flex-grow flex-col": {}
|
23
|
+
},
|
24
|
+
".aui-thread-welcome-center": {
|
25
|
+
"@apply flex w-full flex-grow flex-col items-center justify-center": {}
|
26
|
+
},
|
27
|
+
".aui-thread-welcome-message": {
|
28
|
+
"@apply mt-4 font-medium": {}
|
29
|
+
},
|
30
|
+
".aui-thread-welcome-suggestion-container": {
|
31
|
+
"@apply mt-3 flex w-full items-stretch justify-center gap-4": {}
|
32
|
+
},
|
33
|
+
".aui-thread-welcome-suggestion": {
|
34
|
+
"@apply hover:bg-aui-muted/80 flex max-w-sm grow basis-0 flex-col items-center justify-center rounded-lg border p-3 transition-colors ease-in": {}
|
35
|
+
},
|
36
|
+
".aui-thread-welcome-suggestion-text": {
|
37
|
+
"@apply line-clamp-2 text-ellipsis text-sm font-semibold": {}
|
38
|
+
},
|
39
|
+
".aui-composer-root": {
|
40
|
+
"@apply focus-within:border-aui-ring/20 flex w-full flex-wrap items-end rounded-lg border bg-inherit px-2.5 shadow-sm transition-colors ease-in": {}
|
41
|
+
},
|
42
|
+
".aui-composer-input": {
|
43
|
+
"@apply placeholder:text-aui-muted-foreground max-h-40 flex-grow resize-none border-none bg-transparent px-2 py-4 text-sm outline-none focus:ring-0 disabled:cursor-not-allowed": {}
|
44
|
+
},
|
45
|
+
".aui-composer-send,\n.aui-composer-cancel,\n.aui-composer-attach": {
|
46
|
+
"@apply my-2.5 size-8 p-2 transition-opacity ease-in": {}
|
47
|
+
},
|
48
|
+
".aui-composer-attachments": {
|
49
|
+
"@apply flex w-full flex-row gap-3 px-10": {}
|
50
|
+
},
|
51
|
+
".aui-attachment-root": {
|
52
|
+
"@apply relative mt-3 flex h-12 w-40 items-center justify-center gap-2 rounded-lg border p-1": {}
|
53
|
+
},
|
54
|
+
".aui-attachment-preview-trigger": {
|
55
|
+
"@apply hover:bg-aui-accent/50 cursor-pointer transition-colors": {}
|
56
|
+
},
|
57
|
+
".aui-attachment-thumb": {
|
58
|
+
"@apply bg-aui-muted flex size-10 items-center justify-center rounded border text-sm": {}
|
59
|
+
},
|
60
|
+
".aui-attachment-text": {
|
61
|
+
"@apply flex-grow basis-0": {}
|
62
|
+
},
|
63
|
+
".aui-attachment-name": {
|
64
|
+
"@apply text-aui-muted-foreground line-clamp-1 text-ellipsis text-xs font-bold": {}
|
65
|
+
},
|
66
|
+
".aui-attachment-type": {
|
67
|
+
"@apply text-aui-muted-foreground text-xs": {}
|
68
|
+
},
|
69
|
+
".aui-attachment-remove": {
|
70
|
+
"@apply text-aui-muted-foreground [&>svg]:bg-aui-background absolute -right-3 -top-3 size-6 [&>svg]:size-4 [&>svg]:rounded-full": {}
|
71
|
+
},
|
72
|
+
".aui-user-message-root": {
|
73
|
+
"@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2": {},
|
74
|
+
"@apply w-full max-w-2xl py-4": {}
|
75
|
+
},
|
76
|
+
":where(.aui-user-message-root) > .aui-user-action-bar-root": {
|
77
|
+
"@apply col-start-1 row-start-2 mr-3 mt-2.5": {}
|
78
|
+
},
|
79
|
+
":where(.aui-user-message-root) > .aui-user-message-attachments": {
|
80
|
+
"@apply col-span-full col-start-1 row-start-1": {},
|
81
|
+
"@apply justify-end": {}
|
82
|
+
},
|
83
|
+
":where(.aui-user-message-root) > .aui-user-message-content": {
|
84
|
+
"@apply col-start-2 row-start-2": {}
|
85
|
+
},
|
86
|
+
":where(.aui-user-message-root) > .aui-branch-picker-root": {
|
87
|
+
"@apply col-span-full col-start-1 row-start-3": {},
|
88
|
+
"@apply -mr-1 justify-end": {}
|
89
|
+
},
|
90
|
+
".aui-user-message-content": {
|
91
|
+
"@apply bg-aui-muted text-aui-foreground max-w-xl break-words rounded-3xl px-5 py-2.5": {}
|
92
|
+
},
|
93
|
+
".aui-user-message-attachments": {
|
94
|
+
"@apply flex w-full flex-row gap-3": {}
|
95
|
+
},
|
96
|
+
".aui-user-action-bar-root": {
|
97
|
+
"@apply flex flex-col items-end": {}
|
98
|
+
},
|
99
|
+
".aui-edit-composer-root": {
|
100
|
+
"@apply bg-aui-muted my-4 flex w-full max-w-2xl flex-col gap-2 rounded-xl": {}
|
101
|
+
},
|
102
|
+
".aui-edit-composer-input": {
|
103
|
+
"@apply text-aui-foreground flex h-8 w-full resize-none bg-transparent p-4 pb-0 outline-none": {}
|
104
|
+
},
|
105
|
+
".aui-edit-composer-footer": {
|
106
|
+
"@apply mx-3 mb-3 flex items-center justify-center gap-2 self-end": {}
|
107
|
+
},
|
108
|
+
".aui-assistant-message-root": {
|
109
|
+
"@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr]": {},
|
110
|
+
"@apply relative w-full max-w-2xl py-4": {}
|
111
|
+
},
|
112
|
+
":where(.aui-assistant-message-root) > .aui-avatar-root": {
|
113
|
+
"@apply col-start-1 row-span-full row-start-1 mr-4": {}
|
114
|
+
},
|
115
|
+
":where(.aui-assistant-message-root) > .aui-branch-picker-root": {
|
116
|
+
"@apply col-start-2 row-start-2": {},
|
117
|
+
"@apply -ml-2 mr-2": {}
|
118
|
+
},
|
119
|
+
":where(.aui-assistant-message-root) > .aui-assistant-action-bar-root": {
|
120
|
+
"@apply col-start-3 row-start-2": {},
|
121
|
+
"@apply -ml-1": {}
|
122
|
+
},
|
123
|
+
":where(.aui-assistant-message-root) > .aui-assistant-message-content": {
|
124
|
+
"@apply col-span-2 col-start-2 row-start-1 my-1.5": {}
|
125
|
+
},
|
126
|
+
".aui-assistant-message-content": {
|
127
|
+
"@apply text-aui-foreground max-w-xl break-words leading-7": {}
|
128
|
+
},
|
129
|
+
".aui-assistant-action-bar-root": {
|
130
|
+
"@apply text-aui-muted-foreground flex gap-1": {}
|
131
|
+
},
|
132
|
+
":where(.aui-assistant-action-bar-root)[data-floating]": {
|
133
|
+
"@apply bg-aui-background absolute rounded-md border p-1 shadow-sm": {}
|
134
|
+
},
|
135
|
+
":where(.aui-assistant-action-bar-feedback-positive)[data-submitted]": {
|
136
|
+
"@apply text-green-600 hover:text-green-700 dark:text-green-500 dark:hover:text-green-400": {}
|
137
|
+
},
|
138
|
+
":where(.aui-assistant-action-bar-feedback-negative)[data-submitted]": {
|
139
|
+
"@apply text-red-600 hover:text-red-700 dark:text-red-500 dark:hover:text-red-400": {}
|
140
|
+
},
|
141
|
+
".aui-branch-picker-root": {
|
142
|
+
"@apply text-aui-muted-foreground inline-flex items-center text-xs": {}
|
143
|
+
},
|
144
|
+
".aui-branch-picker-state": {
|
145
|
+
"@apply font-medium": {}
|
146
|
+
},
|
147
|
+
".aui-text": {
|
148
|
+
"@apply whitespace-pre-line": {}
|
149
|
+
},
|
150
|
+
".aui-text-running::after": {
|
151
|
+
"@apply animate-pulse font-sans content-['\\25CF'] ltr:ml-1 rtl:mr-1": {}
|
152
|
+
}
|
153
|
+
}
|
package/package.json
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
"conversational-ui",
|
30
30
|
"conversational-ai"
|
31
31
|
],
|
32
|
-
"version": "0.5.
|
32
|
+
"version": "0.5.96",
|
33
33
|
"license": "MIT",
|
34
34
|
"exports": {
|
35
35
|
".": {
|
@@ -57,6 +57,7 @@
|
|
57
57
|
"types": "./dist/index.d.ts",
|
58
58
|
"files": [
|
59
59
|
"dist",
|
60
|
+
"generated",
|
60
61
|
"edge",
|
61
62
|
"tailwindcss",
|
62
63
|
"src",
|
@@ -118,8 +119,8 @@
|
|
118
119
|
"tailwindcss-animate": "^1.0.7",
|
119
120
|
"tsup": "8.3.0",
|
120
121
|
"tsx": "^4.19.1",
|
121
|
-
"@assistant-ui/
|
122
|
-
"@assistant-ui/
|
122
|
+
"@assistant-ui/tailwindcss-transformer": "0.1.0",
|
123
|
+
"@assistant-ui/tsconfig": "0.0.0"
|
123
124
|
},
|
124
125
|
"publishConfig": {
|
125
126
|
"access": "public",
|
@@ -37,7 +37,7 @@ class LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {
|
|
37
37
|
|
38
38
|
export const useLocalRuntime = (
|
39
39
|
adapter: ChatModelAdapter,
|
40
|
-
options: LocalRuntimeOptions = {},
|
40
|
+
{ initialMessages, ...options }: LocalRuntimeOptions = {},
|
41
41
|
) => {
|
42
42
|
const opt = {
|
43
43
|
...options,
|
@@ -47,7 +47,7 @@ export const useLocalRuntime = (
|
|
47
47
|
},
|
48
48
|
};
|
49
49
|
|
50
|
-
const [runtime] = useState(() => new LocalRuntimeCore(opt));
|
50
|
+
const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));
|
51
51
|
|
52
52
|
useEffect(() => {
|
53
53
|
runtime.setOptions(opt);
|