You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hi,
first of all thanks a lot for this fantastic piece of software!
I have managed to integrate it in my NextJS app, I can see the chat sidebar appearing and the chat content be posted to my NestJS backend, where I am handling the request this way
@Post('/chat')
public async chat(
@Request() request,
@Response() response,
) {
const copilotKit = new CopilotBackend();
const result = await copilotKit.response(
request,
new OpenAIAdapter(),
);
return result
}
I also have tried this
@Post('/chat')
public async chat(
@Request() request,
@Response() response,
) {
const copilotKit = new CopilotBackend();
const result = await copilotKit.stream(
request,
new OpenAIAdapter(),
);
return result
}
and this
@Post('/chat')
public async chat(
@Request() request,
@Response() response,
) {
const copilotKit = new CopilotBackend();
const result = await copilotKit.streamHttpServerResponse(
request,
response,
new OpenAIAdapter(),
);
return result
}
By in any case the chat waits for the response indefinitely. By adding some breakpoint, the response is properly generated, but for some reason the clients does not receive it.
What am I missing?
Many thanks
The text was updated successfully, but these errors were encountered:
Because streamHttpServerResponse returns Promise<void>, you can't get anything using its return value.
You should completely delegate everything to the CopilotBackend instance.
BTW, the above code is a simple version for demo. It'll be better to create the CopilotBackend instance in a service instead, in case of creating a new instance every time a request comes.
Describe the bug
Hi,
first of all thanks a lot for this fantastic piece of software!
I have managed to integrate it in my NextJS app, I can see the chat sidebar appearing and the chat content be posted to my NestJS backend, where I am handling the request this way
I also have tried this
and this
By in any case the chat waits for the response indefinitely. By adding some breakpoint, the response is properly generated, but for some reason the clients does not receive it.
What am I missing?
Many thanks
The text was updated successfully, but these errors were encountered: