File tree Expand file tree Collapse file tree
examples/next-openai/src/app/api/copilotkit/openai Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,6 @@ export async function POST(req: Request): Promise<Response> {
5151
5252 return copilotKit . response (
5353 req ,
54- new OpenAIAssistantAdapter ( { assistantId : "asst_oRVCILrsezzrtNoKmcsXLZQj " } ) ,
54+ new OpenAIAssistantAdapter ( { assistantId : "asst_NyzWFlvTLdKBKQMOte1BKWym " } ) ,
5555 ) ;
5656}
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export class OpenAIAssistantAdapter implements CopilotKitServiceAdapter {
3131 if ( status . status === "completed" || status . status === "requires_action" ) {
3232 return status ;
3333 } else if ( status . status !== "in_progress" && status . status !== "queued" ) {
34+ console . error ( `Thread run failed with status: ${ status . status } ` ) ;
3435 throw new Error ( `Thread run failed with status: ${ status . status } ` ) ;
3536 }
3637 await new Promise ( ( resolve ) => setTimeout ( resolve , RUN_STATUS_POLL_INTERVAL ) ) ;
@@ -75,9 +76,14 @@ export class OpenAIAssistantAdapter implements CopilotKitServiceAdapter {
7576 } ) ;
7677 }
7778
78- run = await this . openai . beta . threads . runs . submitToolOutputs ( threadId , runId , {
79- tool_outputs : toolOutputs ,
80- } ) ;
79+ try {
80+ run = await this . openai . beta . threads . runs . submitToolOutputs ( threadId , runId , {
81+ tool_outputs : toolOutputs ,
82+ } ) ;
83+ } catch ( error ) {
84+ console . error ( "Error submitting tool outputs:" , error ) ;
85+ throw error ;
86+ }
8187
8288 return await this . waitForRun ( run ) ;
8389 }
@@ -147,6 +153,7 @@ export class OpenAIAssistantAdapter implements CopilotKitServiceAdapter {
147153 }
148154 // unsupported message
149155 else {
156+ console . error ( "No actionable message found in the messages" ) ;
150157 throw new Error ( "No actionable message found in the messages" ) ;
151158 }
152159
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export async function fetchChatCompletion({
5959 ...( Object . keys ( copilotConfig [ "body" ] ?? { } ) . length > 0
6060 ? {
6161 [ EXCLUDE_FROM_FORWARD_PROPS_KEYS ] : Object . keys ( copilotConfig [ "backendOnlyProps" ] ?? { } ) ,
62+ // was: [EXCLUDE_FROM_FORWARD_PROPS_KEYS]: Object.keys(copilotConfig["body"] ?? {}),
6263 }
6364 : { } ) ,
6465 ...( body ? { ...body } : { } ) ,
You can’t perform that action at this time.
0 commit comments