Fix Studio chat history and attachments with newer assistant-ui (#5296)
Pass Studio history, dictation, and attachment adapters directly into useLocalRuntime instead of relying on assistant-ui's unstable_Provider ordering, which fixes blank chat threads on reload and broken image upload / drag-drop on fresh PyPI and curl installs that resolved @assistant-ui/react to the newer _RuntimeBinder path. Also pins @assistant-ui/react, @assistant-ui/react-markdown, @assistant-ui/react-streamdown, and assistant-stream to exact versions in package.json so future installs cannot silently re-float onto a newer pre-1.0 release. The lockfile alone only fixes resolution for the install that consumes it -- a future bun add / npm install <other-pkg> rewrites the lockfile and is free to drift carets within their range, which is exactly the path that pulled @assistant-ui/react from 0.12.19 to 0.12.28 and broke 2026.5.1. Adds studio/frontend/package-lock.json so npm fallback / fresh installs have deterministic resolution. Tests: - bun run typecheck - npm ci on a clean tree (1083 packages) - npm run build (bundle no longer contains the unstable_Provider Studio call site; only assistant-ui internals reference unstable_Provider)
This commit is contained in:
parent
9bab3b955e
commit
858ba9ba20
3 changed files with 16829 additions and 18 deletions
16817
studio/frontend/package-lock.json
generated
Normal file
16817
studio/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -17,9 +17,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@assistant-ui/core": "0.1.17",
|
||||
"@assistant-ui/react": "^0.12.19",
|
||||
"@assistant-ui/react-markdown": "^0.12.3",
|
||||
"@assistant-ui/react-streamdown": "^0.1.2",
|
||||
"@assistant-ui/react": "0.12.28",
|
||||
"@assistant-ui/react-markdown": "0.12.11",
|
||||
"@assistant-ui/react-streamdown": "0.1.11",
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@dagrejs/dagre": "^2.0.4",
|
||||
"@dagrejs/graphlib": "^3.0.4",
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
"@toolwind/corner-shape": "^0.0.8-3",
|
||||
"@types/canvas-confetti": "^1.9.0",
|
||||
"@xyflow/react": "^12.10.0",
|
||||
"assistant-stream": "^0.3.2",
|
||||
"assistant-stream": "0.3.12",
|
||||
"canvas-confetti": "^1.9.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import {
|
|||
ExportedMessageRepository,
|
||||
type ExportedMessageRepositoryItem,
|
||||
type PendingAttachment,
|
||||
RuntimeAdapterProvider,
|
||||
Suggestions,
|
||||
type LocalRuntimeOptions,
|
||||
type ThreadHistoryAdapter,
|
||||
type ThreadMessage,
|
||||
WebSpeechDictationAdapter,
|
||||
|
|
@ -583,9 +583,9 @@ function createDexieAdapter(
|
|||
};
|
||||
}
|
||||
|
||||
function ThreadHistoryProvider({
|
||||
children,
|
||||
}: { children?: ReactNode }): ReactElement {
|
||||
type StudioRuntimeAdapters = NonNullable<LocalRuntimeOptions["adapters"]>;
|
||||
|
||||
function useStudioRuntimeAdapters(): StudioRuntimeAdapters {
|
||||
const aui = useAui();
|
||||
|
||||
const history = useMemo<ThreadHistoryAdapter>(
|
||||
|
|
@ -711,17 +711,14 @@ function ThreadHistoryProvider({
|
|||
[history, dictation, attachments],
|
||||
);
|
||||
|
||||
return (
|
||||
<RuntimeAdapterProvider adapters={adapters}>
|
||||
{children}
|
||||
</RuntimeAdapterProvider>
|
||||
);
|
||||
return adapters;
|
||||
}
|
||||
|
||||
const chatAdapter = createOpenAIStreamAdapter();
|
||||
|
||||
function useRuntimeHook(): ReturnType<typeof useLocalRuntime> {
|
||||
return useLocalRuntime(chatAdapter);
|
||||
const adapters = useStudioRuntimeAdapters();
|
||||
return useLocalRuntime(chatAdapter, { adapters });
|
||||
}
|
||||
|
||||
function ThreadAutoSwitch({
|
||||
|
|
@ -898,10 +895,7 @@ export function ChatRuntimeProvider({
|
|||
}): ReactElement {
|
||||
const runtime = useRemoteThreadListRuntime({
|
||||
runtimeHook: useRuntimeHook,
|
||||
adapter: {
|
||||
...createDexieAdapter(modelType, pairId),
|
||||
unstable_Provider: ThreadHistoryProvider,
|
||||
},
|
||||
adapter: createDexieAdapter(modelType, pairId),
|
||||
});
|
||||
|
||||
const aui = useAui({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue