π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
bugfix: Console warning message instead of stacktrace if OPENAI_API_KEY is not set
jamesread87e7ee2ce9c8
diff --git a/apps/backend/src/api/routes/copilot.controller.ts b/apps/backend/src/api/routes/copilot.controller.tsindex e66a13fd7..65928b201 100644--- a/apps/backend/src/api/routes/copilot.controller.ts+++ b/apps/backend/src/api/routes/copilot.controller.ts@@ -1,4 +1,4 @@-import { Controller, Get, Post, Req, Res } from '@nestjs/common';+import { Logger, Controller, Get, Post, Req, Res } from '@nestjs/common';import {CopilotRuntime,OpenAIAdapter,@@ -13,6 +13,11 @@ export class CopilotController {constructor(private _subscriptionService: SubscriptionService) {}@Post('/chat')chat(@Req() req: Request, @Res() res: Response) {+ if (process.env.OPENAI_API_KEY === undefined || process.env.OPENAI_API_KEY === '') {+ Logger.warn('OpenAI API key not set, chat functionality will not work');+ return+ }+const copilotRuntimeHandler = copilotRuntimeNestEndpoint({endpoint: '/copilot/chat',runtime: new CopilotRuntime(),