Skip to content

Commit 6b98505

Browse files
authored
Use response.id instead of responseId (#3867)
1 parent 2d08a6e commit 6b98505

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/gitbook/src/components/AI/server-actions/api.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ function parseResponse<T>(
128128
parse: (response: AIStreamResponse) => T | undefined | Promise<T | undefined>
129129
): {
130130
stream: EventIterator<T>;
131-
response: Promise<{ responseId: string }>;
131+
response: Promise<{ responseId: string | null }>;
132132
} {
133-
let resolveResponse: (value: { responseId: string }) => void;
134-
const response = new Promise<{ responseId: string }>((resolve) => {
133+
let resolveResponse: (value: { responseId: string | null }) => void;
134+
const response = new Promise<{ responseId: string | null }>((resolve) => {
135135
resolveResponse = resolve;
136136
});
137137

@@ -147,7 +147,7 @@ function parseResponse<T>(
147147

148148
if (event.type === 'response_finish') {
149149
foundResponse = true;
150-
resolveResponse({ responseId: event.responseId });
150+
resolveResponse({ responseId: event.response.id ?? null });
151151
}
152152
}
153153

packages/gitbook/src/components/AI/useAIChat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export function AIChatProvider(props: {
296296
case 'response_finish': {
297297
globalState.setState((state) => ({
298298
...state,
299-
responseId: event.responseId,
299+
responseId: event.response.id ?? null,
300300
// Mark as not loading when the response is finished
301301
// Even if the stream might continue as we receive 'response_followup_suggestion'
302302
loading: false,

0 commit comments

Comments
 (0)