@assistant-ui/react 0.7.25 → 0.7.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +1 -2
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +2 -3
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/model-config/useAssistantInstructions.d.ts +6 -1
- package/dist/model-config/useAssistantInstructions.d.ts.map +1 -1
- package/dist/model-config/useAssistantInstructions.js +9 -3
- package/dist/model-config/useAssistantInstructions.js.map +1 -1
- package/dist/model-config/useAssistantInstructions.mjs +9 -3
- package/dist/model-config/useAssistantInstructions.mjs.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts +9 -2
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +2 -0
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts +4 -0
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +6 -0
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +5 -2
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +21 -6
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +21 -6
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +3 -3
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs +3 -3
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +3 -6
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +4 -7
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js +1 -2
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs +1 -2
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +2 -2
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +2 -2
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +2 -2
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
- package/dist/styles/index.css +8 -7
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +7 -7
- package/dist/styles/tailwindcss/thread.css.json +7 -7
- package/dist/styles/themes/default.css +3 -0
- package/dist/styles/themes/default.css.json +2 -1
- package/dist/styles/themes/shadcn-extras.css +4 -0
- package/dist/styles/themes/shadcn-extras.css.json +5 -0
- package/dist/tailwindcss/index.d.ts.map +1 -1
- package/dist/tailwindcss/index.js +7 -0
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +7 -0
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/context/providers/AssistantRuntimeProvider.tsx +2 -6
- package/src/model-config/useAssistantInstructions.tsx +19 -1
- package/src/runtimes/core/AssistantRuntimeCore.tsx +9 -2
- package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +4 -0
- package/src/runtimes/core/ThreadRuntimeCore.tsx +5 -0
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +8 -0
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +26 -6
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +2 -2
- package/src/runtimes/external-store/useExternalStoreRuntime.tsx +1 -1
- package/src/runtimes/local/LocalRuntimeCore.tsx +1 -0
- package/src/runtimes/remote-thread-list/EMPTY_THREAD_CORE.tsx +7 -3
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +4 -10
- package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +1 -2
- package/src/runtimes/remote-thread-list/types.tsx +2 -2
- package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +2 -2
- package/src/styles/tailwindcss/thread.css +7 -7
- package/src/styles/themes/default.css +3 -0
- package/src/styles/themes/shadcn-extras.css +4 -0
- package/src/tailwindcss/index.ts +7 -0
- package/dist/primitive-hooks/thread/useThread.d.ts +0 -1
- package/dist/primitive-hooks/thread/useThread.d.ts.map +0 -1
- package/dist/primitive-hooks/thread/useThread.js +0 -2
- package/dist/primitive-hooks/thread/useThread.js.map +0 -1
- package/dist/primitive-hooks/thread/useThread.mjs +0 -1
- package/dist/primitive-hooks/thread/useThread.mjs.map +0 -1
- package/src/primitive-hooks/thread/useThread.tsx +0 -1
@@ -3,9 +3,27 @@
|
|
3
3
|
import { useEffect } from "react";
|
4
4
|
import { useAssistantRuntime } from "../context";
|
5
5
|
|
6
|
-
|
6
|
+
type AssistantInstructionsConfig = {
|
7
|
+
disabled?: boolean | undefined;
|
8
|
+
instruction: string;
|
9
|
+
};
|
10
|
+
|
11
|
+
const getInstructions = (
|
12
|
+
instruction: string | AssistantInstructionsConfig,
|
13
|
+
): AssistantInstructionsConfig => {
|
14
|
+
if (typeof instruction === "string") return { instruction };
|
15
|
+
return instruction;
|
16
|
+
};
|
17
|
+
|
18
|
+
export const useAssistantInstructions = (
|
19
|
+
config: string | AssistantInstructionsConfig,
|
20
|
+
) => {
|
21
|
+
const { instruction, disabled = false } = getInstructions(config);
|
7
22
|
const assistantRuntime = useAssistantRuntime();
|
23
|
+
|
8
24
|
useEffect(() => {
|
25
|
+
if (disabled) return;
|
26
|
+
|
9
27
|
const config = {
|
10
28
|
system: instruction,
|
11
29
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PropsWithChildren } from "react";
|
1
|
+
import { ComponentType, PropsWithChildren } from "react";
|
2
2
|
import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
|
3
3
|
import type { Unsubscribe } from "../../types/Unsubscribe";
|
4
4
|
import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
|
@@ -8,5 +8,12 @@ export type AssistantRuntimeCore = {
|
|
8
8
|
|
9
9
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
10
10
|
|
11
|
-
|
11
|
+
/**
|
12
|
+
* A Provider component that wraps the app via `AssistantRuntimeProvider`.
|
13
|
+
*
|
14
|
+
* Note: This field is expected to never change.
|
15
|
+
* Refer to the source implementation of `ExternalStoreRuntimeCore`
|
16
|
+
* for an example of updating the provider via a zustand store.
|
17
|
+
*/
|
18
|
+
readonly Provider: ComponentType<PropsWithChildren> | undefined;
|
12
19
|
};
|
@@ -3,10 +3,14 @@ import type { Unsubscribe } from "../../types/Unsubscribe";
|
|
3
3
|
import type { AssistantRuntimeCore } from "./AssistantRuntimeCore";
|
4
4
|
import { ProxyConfigProvider } from "../../utils/ProxyConfigProvider";
|
5
5
|
import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
|
6
|
+
import { ComponentType } from "react";
|
6
7
|
|
7
8
|
export abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
|
8
9
|
protected readonly _proxyConfigProvider = new ProxyConfigProvider();
|
9
10
|
public abstract get threadList(): ThreadListRuntimeCore;
|
11
|
+
public abstract get Provider():
|
12
|
+
| ComponentType<React.PropsWithChildren>
|
13
|
+
| undefined;
|
10
14
|
|
11
15
|
constructor() {}
|
12
16
|
|
@@ -89,6 +89,11 @@ export type ThreadRuntimeCore = Readonly<{
|
|
89
89
|
isDisabled: boolean;
|
90
90
|
messages: readonly ThreadMessage[];
|
91
91
|
suggestions: readonly ThreadSuggestion[];
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @deprecated This field is deprecated and will be removed in 0.8.0.
|
95
|
+
* Please migrate to using `AssistantRuntimeCore.Provider` instead.
|
96
|
+
*/
|
92
97
|
extras: unknown;
|
93
98
|
|
94
99
|
subscribe: (callback: () => void) => Unsubscribe;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { PropsWithChildren } from "react";
|
1
2
|
import { AppendMessage, ThreadMessage } from "../../types";
|
2
3
|
import { AttachmentAdapter } from "../attachment";
|
3
4
|
import {
|
@@ -53,6 +54,11 @@ type ExternalStoreAdapterBase<T> = {
|
|
53
54
|
isRunning?: boolean | undefined;
|
54
55
|
messages: T[];
|
55
56
|
suggestions?: readonly ThreadSuggestion[] | undefined;
|
57
|
+
|
58
|
+
/**
|
59
|
+
* @deprecated This field is deprecated and will be removed in 0.8.0.
|
60
|
+
* Please migrate to `Provider` and a custom react context provider component instead.
|
61
|
+
*/
|
56
62
|
extras?: unknown;
|
57
63
|
|
58
64
|
setMessages?: ((messages: T[]) => void) | undefined;
|
@@ -82,6 +88,8 @@ type ExternalStoreAdapterBase<T> = {
|
|
82
88
|
copy?: boolean | undefined;
|
83
89
|
}
|
84
90
|
| undefined;
|
91
|
+
|
92
|
+
unstable_Provider?: React.ComponentType<PropsWithChildren> | undefined;
|
85
93
|
};
|
86
94
|
|
87
95
|
export type ExternalStoreAdapter<T = ThreadMessage> =
|
@@ -2,6 +2,9 @@ import { BaseAssistantRuntimeCore } from "../../internal";
|
|
2
2
|
import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
|
3
3
|
import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
|
4
4
|
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
5
|
+
import { Fragment } from "react/jsx-runtime";
|
6
|
+
import { PropsWithChildren } from "react";
|
7
|
+
import { create } from "zustand";
|
5
8
|
|
6
9
|
const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
7
10
|
return {
|
@@ -12,18 +15,35 @@ const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
|
12
15
|
export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
|
13
16
|
public readonly threadList;
|
14
17
|
|
15
|
-
|
18
|
+
private useRenderComponent;
|
19
|
+
|
20
|
+
constructor(adapter: ExternalStoreAdapter<any>) {
|
16
21
|
super();
|
22
|
+
this.useRenderComponent = create(() => ({
|
23
|
+
RenderComponent: adapter.unstable_Provider ?? Fragment,
|
24
|
+
}));
|
17
25
|
this.threadList = new ExternalStoreThreadListRuntimeCore(
|
18
|
-
getThreadListAdapter(
|
26
|
+
getThreadListAdapter(adapter),
|
19
27
|
() =>
|
20
|
-
new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider,
|
28
|
+
new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter),
|
21
29
|
);
|
22
30
|
}
|
23
31
|
|
24
|
-
public
|
32
|
+
public setAdapter(adapter: ExternalStoreAdapter<any>) {
|
25
33
|
// Update the thread list adapter and propagate store changes to the main thread
|
26
|
-
this.threadList.__internal_setAdapter(getThreadListAdapter(
|
27
|
-
this.threadList.getMainThreadRuntimeCore().
|
34
|
+
this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));
|
35
|
+
this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
|
36
|
+
|
37
|
+
const RenderComponent = adapter.unstable_Provider ?? Fragment;
|
38
|
+
if (
|
39
|
+
RenderComponent !== this.useRenderComponent.getState().RenderComponent
|
40
|
+
) {
|
41
|
+
this.useRenderComponent.setState({ RenderComponent }, true);
|
42
|
+
}
|
28
43
|
}
|
44
|
+
|
45
|
+
public readonly Provider = ({ children }: PropsWithChildren) => {
|
46
|
+
const RenderComponent = this.useRenderComponent.getState().RenderComponent;
|
47
|
+
return <RenderComponent>{children}</RenderComponent>;
|
48
|
+
};
|
29
49
|
}
|
@@ -80,10 +80,10 @@ export class ExternalStoreThreadRuntimeCore
|
|
80
80
|
store: ExternalStoreAdapter<any>,
|
81
81
|
) {
|
82
82
|
super(configProvider);
|
83
|
-
this.
|
83
|
+
this.__internal_setAdapter(store);
|
84
84
|
}
|
85
85
|
|
86
|
-
public
|
86
|
+
public __internal_setAdapter(store: ExternalStoreAdapter<any>) {
|
87
87
|
if (this._store === store) return;
|
88
88
|
|
89
89
|
const isRunning = store.isRunning ?? false;
|
@@ -90,8 +90,12 @@ export const EMPTY_THREAD_CORE: ThreadRuntimeCore = {
|
|
90
90
|
throw EMPTY_THREAD_ERROR;
|
91
91
|
},
|
92
92
|
|
93
|
-
reset() {
|
94
|
-
|
93
|
+
async reset() {
|
94
|
+
// noop
|
95
|
+
},
|
96
|
+
|
97
|
+
async clearAttachments() {
|
98
|
+
// noop
|
95
99
|
},
|
96
100
|
|
97
101
|
send() {
|
@@ -99,7 +103,7 @@ export const EMPTY_THREAD_CORE: ThreadRuntimeCore = {
|
|
99
103
|
},
|
100
104
|
|
101
105
|
cancel() {
|
102
|
-
|
106
|
+
// noop
|
103
107
|
},
|
104
108
|
|
105
109
|
subscribe() {
|
@@ -5,7 +5,7 @@ import { RemoteThreadListHookInstanceManager } from "./RemoteThreadListHookInsta
|
|
5
5
|
import { BaseSubscribable } from "./BaseSubscribable";
|
6
6
|
import { EMPTY_THREAD_CORE } from "./EMPTY_THREAD_CORE";
|
7
7
|
import { OptimisticState } from "./OptimisticState";
|
8
|
-
import { FC, PropsWithChildren, useEffect, useId } from "react";
|
8
|
+
import { FC, Fragment, PropsWithChildren, useEffect, useId } from "react";
|
9
9
|
import { create } from "zustand";
|
10
10
|
import { CloudInitializeResponse } from "./cloud/CloudContext";
|
11
11
|
|
@@ -25,10 +25,6 @@ type RemoteThreadData =
|
|
25
25
|
readonly title?: string | undefined;
|
26
26
|
};
|
27
27
|
|
28
|
-
const DEFAULT_RENDER_COMPONENT: FC<PropsWithChildren> = ({ children }) => {
|
29
|
-
return children;
|
30
|
-
};
|
31
|
-
|
32
28
|
type THREAD_MAPPING_ID = string & { __brand: "THREAD_MAPPING_ID" };
|
33
29
|
function createThreadMappingId(id: string): THREAD_MAPPING_ID {
|
34
30
|
return id as THREAD_MAPPING_ID;
|
@@ -157,8 +153,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
157
153
|
adapter.runtimeHook,
|
158
154
|
);
|
159
155
|
this.useRenderComponent = create(() => ({
|
160
|
-
RenderComponent:
|
161
|
-
adapter.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT,
|
156
|
+
RenderComponent: adapter.unstable_Provider ?? Fragment,
|
162
157
|
}));
|
163
158
|
this.__internal_setAdapter(adapter);
|
164
159
|
|
@@ -234,8 +229,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
234
229
|
this._disposeOldAdapter?.();
|
235
230
|
this._disposeOldAdapter = this._adapter.onInitialize(this._onInitialize);
|
236
231
|
|
237
|
-
const RenderComponent =
|
238
|
-
adapter.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT;
|
232
|
+
const RenderComponent = adapter.unstable_Provider ?? Fragment;
|
239
233
|
if (
|
240
234
|
RenderComponent !== this.useRenderComponent.getState().RenderComponent
|
241
235
|
) {
|
@@ -460,7 +454,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
460
454
|
|
461
455
|
private useBoundIds = create<string[]>(() => []);
|
462
456
|
|
463
|
-
public
|
457
|
+
public __internal_Provider: FC<PropsWithChildren> = ({ children }) => {
|
464
458
|
const id = useId();
|
465
459
|
useEffect(() => {
|
466
460
|
this.useBoundIds.setState((s) => [...s, id], true);
|
@@ -86,8 +86,7 @@ export const useCloudThreadListRuntime = (adapter: CloudThreadListAdapter) => {
|
|
86
86
|
onInitialize: (callback) => {
|
87
87
|
return cloudContextValue.subscribe(callback);
|
88
88
|
},
|
89
|
-
|
90
|
-
console.log("RENDER COMPONENT");
|
89
|
+
unstable_Provider: ({ children }: PropsWithChildren) => {
|
91
90
|
return (
|
92
91
|
<CloudContext.Provider value={cloudContextValue}>
|
93
92
|
{children}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentType, PropsWithChildren } from "react";
|
2
2
|
import { AssistantRuntime } from "../../api";
|
3
3
|
import { Unsubscribe } from "../../types";
|
4
4
|
import { CloudInitializeResponse } from "./cloud/CloudContext";
|
@@ -30,5 +30,5 @@ export type RemoteThreadListAdapter = {
|
|
30
30
|
callback: (task: Promise<CloudInitializeResponse>) => Promise<void>,
|
31
31
|
): Unsubscribe;
|
32
32
|
|
33
|
-
|
33
|
+
unstable_Provider?: ComponentType<PropsWithChildren>;
|
34
34
|
};
|
@@ -12,8 +12,8 @@ class RemoteThreadListRuntimeCore extends BaseAssistantRuntimeCore {
|
|
12
12
|
this.threadList = new RemoteThreadListThreadListRuntimeCore(adapter);
|
13
13
|
}
|
14
14
|
|
15
|
-
public get
|
16
|
-
return this.threadList.
|
15
|
+
public get Provider() {
|
16
|
+
return this.threadList.__internal_Provider;
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
}
|
10
10
|
|
11
11
|
.aui-thread-viewport-footer {
|
12
|
-
@apply sticky bottom-0 mt-3 flex w-full
|
12
|
+
@apply max-w-aui-thread sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
|
13
13
|
}
|
14
14
|
|
15
15
|
.aui-thread-scroll-to-bottom {
|
@@ -27,7 +27,7 @@
|
|
27
27
|
/* thread welcome */
|
28
28
|
|
29
29
|
.aui-thread-welcome-root {
|
30
|
-
@apply flex w-full
|
30
|
+
@apply max-w-aui-thread flex w-full flex-grow flex-col;
|
31
31
|
}
|
32
32
|
|
33
33
|
.aui-thread-welcome-center {
|
@@ -108,7 +108,7 @@
|
|
108
108
|
|
109
109
|
.aui-user-message-root {
|
110
110
|
@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2;
|
111
|
-
@apply w-
|
111
|
+
@apply max-w-aui-thread w-full py-4;
|
112
112
|
}
|
113
113
|
|
114
114
|
:where(.aui-user-message-root) > .aui-user-action-bar-root {
|
@@ -130,7 +130,7 @@
|
|
130
130
|
}
|
131
131
|
|
132
132
|
.aui-user-message-content {
|
133
|
-
@apply bg-aui-muted text-aui-foreground max-w-
|
133
|
+
@apply bg-aui-muted text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5;
|
134
134
|
}
|
135
135
|
|
136
136
|
.aui-user-message-attachments {
|
@@ -146,7 +146,7 @@
|
|
146
146
|
/* edit composer */
|
147
147
|
|
148
148
|
.aui-edit-composer-root {
|
149
|
-
@apply bg-aui-muted my-4 flex w-full
|
149
|
+
@apply bg-aui-muted max-w-aui-thread my-4 flex w-full flex-col gap-2 rounded-xl;
|
150
150
|
}
|
151
151
|
|
152
152
|
.aui-edit-composer-input {
|
@@ -161,7 +161,7 @@
|
|
161
161
|
|
162
162
|
.aui-assistant-message-root {
|
163
163
|
@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr];
|
164
|
-
@apply relative w-full
|
164
|
+
@apply max-w-aui-thread relative w-full py-4;
|
165
165
|
}
|
166
166
|
|
167
167
|
:where(.aui-assistant-message-root) > .aui-avatar-root {
|
@@ -183,7 +183,7 @@
|
|
183
183
|
}
|
184
184
|
|
185
185
|
.aui-assistant-message-content {
|
186
|
-
@apply text-aui-foreground max-w-
|
186
|
+
@apply text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words leading-7;
|
187
187
|
}
|
188
188
|
|
189
189
|
/* assistant action bar */
|
package/src/tailwindcss/index.ts
CHANGED
@@ -3,6 +3,7 @@ import baseComponentsCSS from "../../dist/styles/tailwindcss/base-components.css
|
|
3
3
|
import threadCSS from "../../dist/styles/tailwindcss/thread.css.json";
|
4
4
|
import modalCSS from "../../dist/styles/tailwindcss/modal.css.json";
|
5
5
|
import defaultThemeCSS from "../../dist/styles/themes/default.css.json";
|
6
|
+
import shadcnExtrasCSS from "../../dist/styles/themes/shadcn-extras.css.json";
|
6
7
|
|
7
8
|
type AssistantTailwindPluginColors = {
|
8
9
|
border: string;
|
@@ -60,6 +61,9 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
|
|
60
61
|
if (defaultTheme || (base && !shadcn)) {
|
61
62
|
addComponents(defaultThemeCSS);
|
62
63
|
}
|
64
|
+
if (!defaultTheme && base && shadcn) {
|
65
|
+
addComponents(shadcnExtrasCSS);
|
66
|
+
}
|
63
67
|
|
64
68
|
if (base) {
|
65
69
|
addComponents(baseComponentsCSS);
|
@@ -79,6 +83,9 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
|
|
79
83
|
safelist: [{ pattern: /aui-/ }],
|
80
84
|
theme: {
|
81
85
|
extend: {
|
86
|
+
maxWidth: {
|
87
|
+
"aui-thread": "var(--aui-thread-max-width)",
|
88
|
+
},
|
82
89
|
colors: {
|
83
90
|
aui: {
|
84
91
|
border: colors.border ?? `hsl(var(${prefix}border))`,
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=useThread.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useThread.d.ts","sourceRoot":"","sources":["../../../src/primitive-hooks/thread/useThread.tsx"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=useThread.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
|