@lobehub/chat 1.21.9 → 1.21.11

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/package.json +1 -1
  3. package/src/app/(backend)/{api/openai → _deprecated}/createBizOpenAI/index.ts +1 -1
  4. package/src/app/(backend)/api/chat/[provider]/route.test.ts +2 -2
  5. package/src/app/(backend)/api/chat/[provider]/route.ts +3 -4
  6. package/src/app/(backend)/api/chat/models/[provider]/route.ts +3 -4
  7. package/src/app/(backend)/{api/middleware → middleware}/auth/index.test.ts +2 -2
  8. package/src/app/(backend)/{api/middleware → middleware}/auth/index.ts +1 -1
  9. package/src/app/(backend)/webapi/plugin/gateway/route.ts +2 -2
  10. package/src/app/(backend)/webapi/stt/openai/route.ts +1 -1
  11. package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +3 -3
  12. package/src/app/(backend)/webapi/tts/openai/route.ts +1 -1
  13. package/src/config/modelProviders/openai.ts +2 -3
  14. package/src/config/modelProviders/openrouter.ts +2 -2
  15. package/src/libs/agent-runtime/AgentRuntime.test.ts +1 -1
  16. package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +1 -1
  17. package/src/libs/trpc/middleware/jwtPayload.test.ts +1 -1
  18. package/src/libs/trpc/middleware/jwtPayload.ts +1 -1
  19. package/src/libs/trpc/middleware/keyVaults.ts +1 -1
  20. package/src/{app/(backend)/api/chat/agentRuntime.test.ts → server/modules/AgentRuntime/index.test.ts} +1 -1
  21. package/src/server/routers/async/file.ts +1 -1
  22. package/src/server/routers/async/ragEval.ts +1 -1
  23. package/src/server/routers/lambda/chunk.ts +1 -1
  24. package/src/services/chat.ts +1 -1
  25. package/src/services/ollama.ts +1 -1
  26. package/src/store/chat/slices/message/actions/rag.ts +1 -1
  27. package/src/store/user/slices/modelList/selectors/modelProvider.test.ts +0 -1
  28. /package/src/app/(backend)/{api/openai → _deprecated}/createBizOpenAI/auth.test.ts +0 -0
  29. /package/src/app/(backend)/{api/openai → _deprecated}/createBizOpenAI/auth.ts +0 -0
  30. /package/src/app/(backend)/{api/openai → _deprecated}/createBizOpenAI/createAzureOpenai.ts +0 -0
  31. /package/src/app/(backend)/{api/openai → _deprecated}/createBizOpenAI/createOpenai.ts +0 -0
  32. /package/src/app/(backend)/{api/middleware → middleware}/auth/utils.test.ts +0 -0
  33. /package/src/app/(backend)/{api/middleware → middleware}/auth/utils.ts +0 -0
  34. /package/src/{app/(backend)/api/chat → server/modules/AgentRuntime}/apiKeyManager.test.ts +0 -0
  35. /package/src/{app/(backend)/api/chat → server/modules/AgentRuntime}/apiKeyManager.ts +0 -0
  36. /package/src/{app/(backend)/api/chat/agentRuntime.ts → server/modules/AgentRuntime/index.ts} +0 -0
  37. /package/src/{app/(backend)/api → utils}/errorResponse.test.ts +0 -0
  38. /package/src/{app/(backend)/api → utils}/errorResponse.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.21.11](https://github.com/lobehub/lobe-chat/compare/v1.21.10...v1.21.11)
6
+
7
+ <sup>Released on **2024-10-11**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor the backend code for better organization.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor the backend code for better organization, closes [#4287](https://github.com/lobehub/lobe-chat/issues/4287) ([9a369ac](https://github.com/lobehub/lobe-chat/commit/9a369ac))
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
+
30
+ ### [Version 1.21.10](https://github.com/lobehub/lobe-chat/compare/v1.21.9...v1.21.10)
31
+
32
+ <sup>Released on **2024-10-11**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Updata gpt-4o model info.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Updata gpt-4o model info, closes [#4318](https://github.com/lobehub/lobe-chat/issues/4318) ([fa27ddf](https://github.com/lobehub/lobe-chat/commit/fa27ddf))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.21.9](https://github.com/lobehub/lobe-chat/compare/v1.21.8...v1.21.9)
6
56
 
7
57
  <sup>Released on **2024-10-10**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.21.9",
3
+ "version": "1.21.11",
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",
@@ -2,8 +2,8 @@ import OpenAI from 'openai';
2
2
 
3
3
  import { getOpenAIAuthFromRequest } from '@/const/fetch';
4
4
  import { ChatErrorType, ErrorType } from '@/types/fetch';
5
+ import { createErrorResponse } from '@/utils/errorResponse';
5
6
 
6
- import { createErrorResponse } from '../../errorResponse';
7
7
  import { checkAuth } from './auth';
8
8
  import { createOpenai } from './createOpenai';
9
9
 
@@ -2,7 +2,7 @@
2
2
  import { getAuth } from '@clerk/nextjs/server';
3
3
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
4
 
5
- import { checkAuthMethod, getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
5
+ import { checkAuthMethod, getJWTPayload } from '@/app/(backend)/middleware/auth/utils';
6
6
  import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED } from '@/const/auth';
7
7
  import { AgentRuntime, LobeRuntimeAI } from '@/libs/agent-runtime';
8
8
  import { ChatErrorType } from '@/types/fetch';
@@ -13,7 +13,7 @@ vi.mock('@clerk/nextjs/server', () => ({
13
13
  getAuth: vi.fn(),
14
14
  }));
15
15
 
16
- vi.mock('../../middleware/auth/utils', () => ({
16
+ vi.mock('@/app/(backend)/middleware/auth/utils', () => ({
17
17
  getJWTPayload: vi.fn(),
18
18
  checkAuthMethod: vi.fn(),
19
19
  }));
@@ -1,12 +1,11 @@
1
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
1
+ import { checkAuth } from '@/app/(backend)/middleware/auth';
2
2
  import { AgentRuntime, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
3
+ import { createTraceOptions, initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
3
4
  import { ChatErrorType } from '@/types/fetch';
4
5
  import { ChatStreamPayload } from '@/types/openai/chat';
6
+ import { createErrorResponse } from '@/utils/errorResponse';
5
7
  import { getTracePayload } from '@/utils/trace';
6
8
 
7
- import { checkAuth } from '../../middleware/auth';
8
- import { createTraceOptions, initAgentRuntimeWithUserPayload } from '../agentRuntime';
9
-
10
9
  export const runtime = 'edge';
11
10
 
12
11
  export const POST = checkAuth(async (req: Request, { params, jwtPayload, createRuntime }) => {
@@ -1,11 +1,10 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
3
+ import { checkAuth } from '@/app/(backend)/middleware/auth';
4
4
  import { ChatCompletionErrorPayload, ModelProvider } from '@/libs/agent-runtime';
5
+ import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
5
6
  import { ChatErrorType } from '@/types/fetch';
6
-
7
- import { checkAuth } from '../../../middleware/auth';
8
- import { initAgentRuntimeWithUserPayload } from '../../agentRuntime';
7
+ import { createErrorResponse } from '@/utils/errorResponse';
9
8
 
10
9
  export const runtime = 'edge';
11
10
 
@@ -1,9 +1,9 @@
1
1
  import { getAuth } from '@clerk/nextjs/server';
2
2
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
5
4
  import { AgentRuntimeError } from '@/libs/agent-runtime';
6
5
  import { ChatErrorType } from '@/types/fetch';
6
+ import { createErrorResponse } from '@/utils/errorResponse';
7
7
 
8
8
  import { RequestHandler, checkAuth } from './index';
9
9
  import { checkAuthMethod, getJWTPayload } from './utils';
@@ -12,7 +12,7 @@ vi.mock('@clerk/nextjs/server', () => ({
12
12
  getAuth: vi.fn(),
13
13
  }));
14
14
 
15
- vi.mock('@/app/(backend)/api/errorResponse', () => ({
15
+ vi.mock('@/utils/errorResponse', () => ({
16
16
  createErrorResponse: vi.fn(),
17
17
  }));
18
18
 
@@ -2,10 +2,10 @@ import { AuthObject } from '@clerk/backend';
2
2
  import { getAuth } from '@clerk/nextjs/server';
3
3
  import { NextRequest } from 'next/server';
4
4
 
5
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
6
5
  import { JWTPayload, LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableClerk } from '@/const/auth';
7
6
  import { AgentRuntime, AgentRuntimeError, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
8
7
  import { ChatErrorType } from '@/types/fetch';
8
+ import { createErrorResponse } from '@/utils/errorResponse';
9
9
 
10
10
  import { checkAuthMethod, getJWTPayload } from './utils';
11
11
 
@@ -1,14 +1,14 @@
1
1
  import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
2
2
  import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
3
3
 
4
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
5
- import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
4
+ import { getJWTPayload } from '@/app/(backend)/middleware/auth/utils';
6
5
  import { getAppConfig } from '@/config/app';
7
6
  import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
8
7
  import { LOBE_CHAT_TRACE_ID, TraceNameMap } from '@/const/trace';
9
8
  import { AgentRuntimeError } from '@/libs/agent-runtime';
10
9
  import { TraceClient } from '@/libs/traces';
11
10
  import { ChatErrorType, ErrorType } from '@/types/fetch';
11
+ import { createErrorResponse } from '@/utils/errorResponse';
12
12
  import { getTracePayload } from '@/utils/trace';
13
13
 
14
14
  import { parserPluginSettings } from './settings';
@@ -1,7 +1,7 @@
1
1
  import { OpenAISTTPayload } from '@lobehub/tts';
2
2
  import { createOpenaiAudioTranscriptions } from '@lobehub/tts/server';
3
3
 
4
- import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';
4
+ import { createBizOpenAI } from '@/app/(backend)/_deprecated/createBizOpenAI';
5
5
 
6
6
  export const runtime = 'edge';
7
7
 
@@ -1,11 +1,11 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
- import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
4
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
5
- import { checkAuth } from '@/app/(backend)/api/middleware/auth';
3
+ import { checkAuth } from '@/app/(backend)/middleware/auth';
6
4
  import { ChatCompletionErrorPayload } from '@/libs/agent-runtime';
7
5
  import { TextToImagePayload } from '@/libs/agent-runtime/types';
6
+ import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
8
7
  import { ChatErrorType } from '@/types/fetch';
8
+ import { createErrorResponse } from '@/utils/errorResponse';
9
9
 
10
10
  export const runtime = 'edge';
11
11
 
@@ -1,7 +1,7 @@
1
1
  import { OpenAITTSPayload } from '@lobehub/tts';
2
2
  import { createOpenaiAudioSpeech } from '@lobehub/tts/server';
3
3
 
4
- import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';
4
+ import { createBizOpenAI } from '@/app/(backend)/_deprecated/createBizOpenAI';
5
5
 
6
6
  export const runtime = 'edge';
7
7
 
@@ -54,8 +54,8 @@ const OpenAI: ModelProviderCard = {
54
54
  functionCall: true,
55
55
  id: 'gpt-4o',
56
56
  pricing: {
57
- input: 5,
58
- output: 15,
57
+ input: 2.5,
58
+ output: 10,
59
59
  },
60
60
  tokens: 128_000,
61
61
  vision: true,
@@ -64,7 +64,6 @@ const OpenAI: ModelProviderCard = {
64
64
  description:
65
65
  'ChatGPT-4o 是一款动态模型,实时更新以保持当前最新版本。它结合了强大的语言理解与生成能力,适合于大规模应用场景,包括客户服务、教育和技术支持。',
66
66
  displayName: 'GPT-4o 0806',
67
- enabled: true,
68
67
  functionCall: true,
69
68
  id: 'gpt-4o-2024-08-06',
70
69
  pricing: {
@@ -59,10 +59,10 @@ const OpenRouter: ModelProviderCard = {
59
59
  {
60
60
  description:
61
61
  'ChatGPT-4o 是一款动态模型,实时更新以保持当前最新版本。它结合了强大的语言理解与生成能力,适合于大规模应用场景,包括客户服务、教育和技术支持。',
62
- displayName: 'GPT-4o 0806',
62
+ displayName: 'GPT-4o',
63
63
  enabled: true,
64
64
  functionCall: true,
65
- id: 'openai/gpt-4o-2024-08-06',
65
+ id: 'openai/gpt-4o',
66
66
  pricing: {
67
67
  input: 2.5,
68
68
  output: 10,
@@ -4,7 +4,6 @@ import { LangfuseGenerationClient, LangfuseTraceClient } from 'langfuse-core';
4
4
  import { ClientOptions } from 'openai';
5
5
  import { beforeEach, describe, expect, it, vi } from 'vitest';
6
6
 
7
- import { createTraceOptions } from '@/app/(backend)/api/chat/agentRuntime';
8
7
  import * as langfuseCfg from '@/config/langfuse';
9
8
  import { JWTPayload } from '@/const/auth';
10
9
  import { TraceNameMap } from '@/const/trace';
@@ -28,6 +27,7 @@ import {
28
27
  } from '@/libs/agent-runtime';
29
28
  import { LobeStepfunAI } from '@/libs/agent-runtime/stepfun';
30
29
  import LobeWenxinAI from '@/libs/agent-runtime/wenxin';
30
+ import { createTraceOptions } from '@/server/modules/AgentRuntime';
31
31
 
32
32
  import { AgentChatOptions } from './AgentRuntime';
33
33
  import { LobeBedrockAIParams } from './bedrock';
@@ -247,7 +247,7 @@ GPT-4o ("o" for "omni") is OpenAI's latest AI model, supporting both text and im
247
247
 
248
248
  For benchmarking against other models, it was briefly called ["im-also-a-good-gpt2-chatbot"](https://twitter.com/LiamFedus/status/1790064963966370209)",
249
249
  "displayName": "OpenAI: GPT-4o (2024-08-06)",
250
- "enabled": true,
250
+ "enabled": false,
251
251
  "functionCall": false,
252
252
  "id": "openai/gpt-4o-2024-08-06",
253
253
  "maxTokens": 16384,
@@ -2,7 +2,7 @@
2
2
  import { TRPCError } from '@trpc/server';
3
3
  import { beforeEach, describe, expect, it, vi } from 'vitest';
4
4
 
5
- import * as utils from '@/app/(backend)/api/middleware/auth/utils';
5
+ import * as utils from '@/app/(backend)/middleware/auth/utils';
6
6
  import { createCallerFactory } from '@/libs/trpc';
7
7
  import { trpc } from '@/libs/trpc/init';
8
8
  import { AuthContext, createContextInner } from '@/server/context';
@@ -1,6 +1,6 @@
1
1
  import { TRPCError } from '@trpc/server';
2
2
 
3
- import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
3
+ import { getJWTPayload } from '@/app/(backend)/middleware/auth/utils';
4
4
  import { trpc } from '@/libs/trpc/init';
5
5
 
6
6
  export const jwtPayloadChecker = trpc.middleware(async (opts) => {
@@ -1,6 +1,6 @@
1
1
  import { TRPCError } from '@trpc/server';
2
2
 
3
- import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
3
+ import { getJWTPayload } from '@/app/(backend)/middleware/auth/utils';
4
4
  import { trpc } from '@/libs/trpc/init';
5
5
 
6
6
  export const keyVaults = trpc.middleware(async (opts) => {
@@ -27,7 +27,7 @@ import { AgentRuntime } from '@/libs/agent-runtime';
27
27
  import { LobeStepfunAI } from '@/libs/agent-runtime/stepfun';
28
28
  import LobeWenxinAI from '@/libs/agent-runtime/wenxin';
29
29
 
30
- import { initAgentRuntimeWithUserPayload } from './agentRuntime';
30
+ import { initAgentRuntimeWithUserPayload } from './index';
31
31
 
32
32
  // 模拟依赖项
33
33
  vi.mock('@/config/llm', () => ({
@@ -3,7 +3,6 @@ import { chunk } from 'lodash-es';
3
3
  import pMap from 'p-map';
4
4
  import { z } from 'zod';
5
5
 
6
- import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
7
6
  import { fileEnv } from '@/config/file';
8
7
  import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
9
8
  import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '@/database/server/models/asyncTask';
@@ -13,6 +12,7 @@ import { FileModel } from '@/database/server/models/file';
13
12
  import { NewChunkItem, NewEmbeddingsItem } from '@/database/server/schemas/lobechat';
14
13
  import { ModelProvider } from '@/libs/agent-runtime';
15
14
  import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
15
+ import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
16
16
  import { S3 } from '@/server/modules/S3';
17
17
  import { ChunkService } from '@/server/services/chunk';
18
18
  import {
@@ -2,7 +2,6 @@ import { TRPCError } from '@trpc/server';
2
2
  import OpenAI from 'openai';
3
3
  import { z } from 'zod';
4
4
 
5
- import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
6
5
  import { chainAnswerWithContext } from '@/chains/answerWithContext';
7
6
  import { DEFAULT_EMBEDDING_MODEL, DEFAULT_MODEL } from '@/const/settings';
8
7
  import { ChunkModel } from '@/database/server/models/chunk';
@@ -15,6 +14,7 @@ import {
15
14
  } from '@/database/server/models/ragEval';
16
15
  import { ModelProvider } from '@/libs/agent-runtime';
17
16
  import { asyncAuthedProcedure, asyncRouter as router } from '@/libs/trpc/async';
17
+ import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
18
18
  import { ChunkService } from '@/server/services/chunk';
19
19
  import { AsyncTaskError } from '@/types/asyncTask';
20
20
  import { EvalEvaluationStatus } from '@/types/eval';
@@ -1,7 +1,6 @@
1
1
  import { inArray } from 'drizzle-orm';
2
2
  import { z } from 'zod';
3
3
 
4
- import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
5
4
  import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
6
5
  import { serverDB } from '@/database/server';
7
6
  import { AsyncTaskModel } from '@/database/server/models/asyncTask';
@@ -13,6 +12,7 @@ import { knowledgeBaseFiles } from '@/database/server/schemas/lobechat';
13
12
  import { ModelProvider } from '@/libs/agent-runtime';
14
13
  import { authedProcedure, router } from '@/libs/trpc';
15
14
  import { keyVaults } from '@/libs/trpc/middleware/keyVaults';
15
+ import { initAgentRuntimeWithUserPayload } from '@/server/modules/AgentRuntime';
16
16
  import { ChunkService } from '@/server/services/chunk';
17
17
  import { SemanticSearchSchema } from '@/types/rag';
18
18
 
@@ -2,7 +2,6 @@ import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/
2
2
  import { produce } from 'immer';
3
3
  import { merge } from 'lodash-es';
4
4
 
5
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
6
5
  import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
7
6
  import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
8
7
  import { INBOX_SESSION_ID } from '@/const/session';
@@ -24,6 +23,7 @@ import { ChatErrorType } from '@/types/fetch';
24
23
  import { ChatMessage, MessageToolCall } from '@/types/message';
25
24
  import type { ChatStreamPayload, OpenAIChatMessage } from '@/types/openai/chat';
26
25
  import { UserMessageContentPart } from '@/types/openai/chat';
26
+ import { createErrorResponse } from '@/utils/errorResponse';
27
27
  import { FetchSSEOptions, fetchSSE, getMessageError } from '@/utils/fetch';
28
28
  import { genToolCallingName } from '@/utils/toolCall';
29
29
  import { createTraceHeader, getTraceId } from '@/utils/trace';
@@ -1,10 +1,10 @@
1
1
  import { ListResponse, Ollama as OllamaBrowser, ProgressResponse } from 'ollama/browser';
2
2
 
3
- import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
4
3
  import { ModelProvider } from '@/libs/agent-runtime';
5
4
  import { useUserStore } from '@/store/user';
6
5
  import { keyVaultsConfigSelectors } from '@/store/user/selectors';
7
6
  import { ChatErrorType } from '@/types/fetch';
7
+ import { createErrorResponse } from '@/utils/errorResponse';
8
8
  import { getMessageError } from '@/utils/fetch';
9
9
 
10
10
  const DEFAULT_BASE_URL = 'http://127.0.0.1:11434';
@@ -67,7 +67,7 @@ export const chatRag: StateCreator<ChatStore, [['zustand/devtools', never]], [],
67
67
  // 1. get the rewrite query
68
68
  let rewriteQuery = message?.ragQuery || userQuery;
69
69
 
70
- // only rewrite query length is less than 10 characters
70
+ // only rewrite query length is less than 10 characters, refs: https://github.com/lobehub/lobe-chat/pull/4288
71
71
  // if there is no ragQuery and there is a chat history
72
72
  // we need to rewrite the user message to get better results
73
73
  if (rewriteQuery.length < 10 && !message?.ragQuery && messages.length > 0) {
@@ -54,7 +54,6 @@ describe('modelProviderSelectors', () => {
54
54
  'o1-preview',
55
55
  'gpt-4o-mini',
56
56
  'gpt-4o',
57
- 'gpt-4o-2024-08-06',
58
57
  'chatgpt-4o-latest',
59
58
  ]);
60
59
  });