WAppAI / assistant

A WhatsApp chatbot that leverages Bing AI's and others LLMs conversational capabilities.
MIT License
97 stars 34 forks source link

Error sending messages #263

Closed solution01 closed 9 months ago

solution01 commented 9 months ago

When I send any message it generates this error here 401 missing authentication header

AuthenticationError: 401 Missing Authentication header at Function.generate (file:///assistant/node_modules/.pnpm/openai@4.23.0/node_modules/openai/src/error.ts:71:14) at OpenAI.makeStatusError (file:///assistant/node_modules/.pnpm/openai@4.23.0/node_modules/openai/src/core.ts:358:21) at OpenAI.makeRequest (file:///assistant/node_modules/.pnpm/openai@4.23.0/node_modules/openai/src/core.ts:416:24) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///assistant/node_modules/.pnpm/@langchain+openai@0.0.5/node_modules/@langchain/openai/dist/chat_models.js:628:29 at async RetryOperation._fn (/assistant/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js:50:12) { status: 401, headers: { 'access-control-allow-credentials': 'true', 'access-control-allow-headers': 'Authorization, User-Agent, X-Api-Key, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, HTTP-Referer, X-Windowai-Title, X-Openrouter-Title, X-Title, X-Stainless-Lang, X-Stainless-Package-Version, X-Stainless-OS, X-Stainless-Arch, X-Stainless-Runtime, X-Stainless-Runtime-Version', 'access-control-allow-methods': 'GET,OPTIONS,PATCH,DELETE,POST,PUT', 'access-control-allow-origin': '*', 'cache-control': 'public, max-age=0, must-revalidate', 'cf-cache-status': 'DYNAMIC', 'cf-ray': '837969c9dcde0104-GRU', connection: 'keep-alive', 'content-type': 'application/json', date: 'Mon, 18 Dec 2023 18:19:17 GMT', server: 'cloudflare', 'strict-transport-security': 'max-age=63072000', 'transfer-encoding': 'chunked', 'x-vercel-id': 'gru1::btsqw-1702923557440-122a38b15ba7' }, error: { message: 'Missing Authentication header', code: 401 }, code: 401, param: undefined, type: undefined, attemptNumber: 1, retriesLeft: 6

Luisotee commented 9 months ago

Which model were you using? Are you sure that you correctly set up the openrouter api key?

solution01 commented 9 months ago

@Luisotee I'm using Bing, should I still configure OpenRouter?

Luisotee commented 9 months ago

@solution01 right now yes, the required ones are openrouter, bing and search_api, though the last you could just write something to bypass the warning if you are not going to use it.

A proper fix should be coming tomorrow