Skip to content

Commit 9e5dd75

Browse files
committed
feat: add background handling to chat request processing
1 parent c5c0a45 commit 9e5dd75

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/routes/api/chat.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { streamText } from '../../lib/streaming'
55
import {
66
getSystemPrompt,
77
isCodeInterpreterSupported,
8-
isWebSearchSupported, // NEW
8+
isWebSearchSupported,
99
} from '../../lib/utils/prompting'
1010
import type { Tool } from 'openai/resources/responses/responses.mjs'
1111

@@ -40,8 +40,15 @@ export const ServerRoute = createServerFileRoute('/api/chat').methods({
4040
})
4141
}
4242

43-
const { messages, servers, model, userId, codeInterpreter, webSearch } =
44-
result.data
43+
const {
44+
messages,
45+
servers,
46+
model,
47+
userId,
48+
codeInterpreter,
49+
webSearch,
50+
background,
51+
} = result.data
4552

4653
if (messages.length === 0) {
4754
return new Response(JSON.stringify({ error: 'No messages provided' }), {
@@ -150,6 +157,9 @@ export const ServerRoute = createServerFileRoute('/api/chat').methods({
150157
tools,
151158
input: conversationHistory,
152159
stream: true,
160+
background,
161+
// Store if background or explicitly requested
162+
store: background,
153163
user: userId,
154164
...(model.startsWith('o3') || model.startsWith('o4')
155165
? {

0 commit comments

Comments
 (0)