Closed kamalkech closed 1 year ago
'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
You need to enable CORS in your application. Install cors with NPM and include it in your express application
thanks @miguelmoya97 hahaha
@shawnesquivel @shawnesquivel for example in nextjs or sveltekit we can make code in client or server side, the code must to add on server side and works correctly, so no necessary install cors package.
@kamalkech even better, thanks!!
I have another follow up question if you don't mind. In my server component, I call the agent like this.
server component
const ServerComp = async () => {
// agent setup ...
const result = await agent.call({ input: input });
console.log(result);
return (
<div>
<h1>Agents (Server)</h1>
<p>Recreate the /agents with server component</p>
<p>{result && result.output}</p>
</div>
);
};
do you know how I could then return that to the frontend? since we're not allowed to useState/useEffect in server components, I'm a bit stuck on how to do this.
last couple of lines from the server logs
[chain/end] [1:chain:agent_executor > 5:chain:llm_chain] [3.21s] Exiting Chain run with output: {
"text": " I now know the final answer\nFinal Answer: Canada has ten provinces."
}
[chain/end] [1:chain:agent_executor] [7.45s] Exiting Chain run with output: {
"output": "Canada has ten provinces."
}
{ output: 'Canada has ten provinces.' }
@shawnesquivel use nextjs api to get input params and return the output
that worked, thanks!! @kamalkech
Follow all steps of documetation
i get this error: