@lobehub/chat 1.26.16 → 1.26.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.26.17](https://github.com/lobehub/lobe-chat/compare/v1.26.16...v1.26.17)
6
+
7
+ <sup>Released on **2024-10-31**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Improve server log on chat api.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Improve server log on chat api, closes [#4559](https://github.com/lobehub/lobe-chat/issues/4559) ([cd8a134](https://github.com/lobehub/lobe-chat/commit/cd8a134))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.26.16](https://github.com/lobehub/lobe-chat/compare/v1.26.15...v1.26.16)
6
31
 
7
32
  <sup>Released on **2024-10-31**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.26.16",
3
+ "version": "1.26.17",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -1,5 +1,9 @@
1
1
  import { checkAuth } from '@/app/(backend)/middleware/auth';
2
- import { AgentRuntime, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
2
+ import {
3
+ AGENT_RUNTIME_ERROR_SET,
4
+ AgentRuntime,
5
+ ChatCompletionErrorPayload,
6
+ } from '@/libs/agent-runtime';
3
7
  import { createTraceOptions, initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
4
8
  import { ChatErrorType } from '@/types/fetch';
5
9
  import { ChatStreamPayload } from '@/types/openai/chat';
@@ -44,8 +48,10 @@ export const POST = checkAuth(async (req: Request, { params, jwtPayload, createR
44
48
  } = e as ChatCompletionErrorPayload;
45
49
 
46
50
  const error = errorContent || e;
51
+
52
+ const logMethod = AGENT_RUNTIME_ERROR_SET.has(errorType as string) ? 'warn' : 'error';
47
53
  // track the error at server side
48
- console.error(`Route: [${provider}] ${errorType}:`, error);
54
+ console[logMethod](`Route: [${provider}] ${errorType}:`, error);
49
55
 
50
56
  return createErrorResponse(errorType, { error, ...res, provider });
51
57
  }
@@ -27,5 +27,7 @@ export const AgentRuntimeErrorType = {
27
27
  OpenAIBizError: 'OpenAIBizError',
28
28
  } as const;
29
29
 
30
+ export const AGENT_RUNTIME_ERROR_SET = new Set<string>(Object.values(AgentRuntimeErrorType));
31
+
30
32
  export type ILobeAgentRuntimeErrorType =
31
33
  (typeof AgentRuntimeErrorType)[keyof typeof AgentRuntimeErrorType];