@lobehub/chat 1.21.5 → 1.21.6

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 (71) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +1 -1
  3. package/src/app/{api → (backend)/api}/chat/[provider]/route.test.ts +1 -1
  4. package/src/app/{api → (backend)/api}/chat/[provider]/route.ts +1 -1
  5. package/src/app/{api → (backend)/api}/chat/models/[provider]/route.ts +1 -1
  6. package/src/app/{api → (backend)/api}/middleware/auth/index.test.ts +2 -2
  7. package/src/app/{api → (backend)/api}/middleware/auth/index.ts +1 -1
  8. package/src/app/{webapi → (backend)/webapi}/plugin/gateway/route.ts +2 -2
  9. package/src/app/{webapi → (backend)/webapi}/stt/openai/route.ts +1 -1
  10. package/src/app/{webapi → (backend)/webapi}/text-to-image/[provider]/route.ts +3 -3
  11. package/src/app/{webapi → (backend)/webapi}/tts/openai/route.ts +1 -1
  12. package/src/libs/agent-runtime/AgentRuntime.test.ts +1 -1
  13. package/src/libs/trpc/middleware/jwtPayload.test.ts +1 -1
  14. package/src/libs/trpc/middleware/jwtPayload.ts +1 -1
  15. package/src/libs/trpc/middleware/keyVaults.ts +1 -1
  16. package/src/server/routers/async/file.ts +1 -1
  17. package/src/server/routers/async/ragEval.ts +1 -1
  18. package/src/server/routers/lambda/chunk.ts +1 -1
  19. package/src/services/_url.ts +1 -1
  20. package/src/services/chat.ts +1 -1
  21. package/src/services/ollama.ts +1 -1
  22. /package/src/app/{api → (backend)/api}/auth/[...nextauth]/route.ts +0 -0
  23. /package/src/app/{api → (backend)/api}/auth/error/AuthErrorPage.tsx +0 -0
  24. /package/src/app/{api → (backend)/api}/auth/error/page.tsx +0 -0
  25. /package/src/app/{api → (backend)/api}/chat/agentRuntime.test.ts +0 -0
  26. /package/src/app/{api → (backend)/api}/chat/agentRuntime.ts +0 -0
  27. /package/src/app/{api → (backend)/api}/chat/anthropic/route.test.ts +0 -0
  28. /package/src/app/{api → (backend)/api}/chat/anthropic/route.ts +0 -0
  29. /package/src/app/{api → (backend)/api}/chat/apiKeyManager.test.ts +0 -0
  30. /package/src/app/{api → (backend)/api}/chat/apiKeyManager.ts +0 -0
  31. /package/src/app/{api → (backend)/api}/chat/google/route.test.ts +0 -0
  32. /package/src/app/{api → (backend)/api}/chat/google/route.ts +0 -0
  33. /package/src/app/{api → (backend)/api}/chat/minimax/route.test.ts +0 -0
  34. /package/src/app/{api → (backend)/api}/chat/minimax/route.ts +0 -0
  35. /package/src/app/{api → (backend)/api}/chat/openai/route.test.ts +0 -0
  36. /package/src/app/{api → (backend)/api}/chat/openai/route.ts +0 -0
  37. /package/src/app/{api → (backend)/api}/chat/wenxin/route.test.ts +0 -0
  38. /package/src/app/{api → (backend)/api}/chat/wenxin/route.ts +0 -0
  39. /package/src/app/{api → (backend)/api}/errorResponse.test.ts +0 -0
  40. /package/src/app/{api → (backend)/api}/errorResponse.ts +0 -0
  41. /package/src/app/{api → (backend)/api}/middleware/auth/utils.test.ts +0 -0
  42. /package/src/app/{api → (backend)/api}/middleware/auth/utils.ts +0 -0
  43. /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/auth.test.ts +0 -0
  44. /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/auth.ts +0 -0
  45. /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/createAzureOpenai.ts +0 -0
  46. /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/createOpenai.ts +0 -0
  47. /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/index.ts +0 -0
  48. /package/src/app/{api → (backend)/api}/webhooks/casdoor/__tests__/route.test.ts +0 -0
  49. /package/src/app/{api → (backend)/api}/webhooks/casdoor/route.ts +0 -0
  50. /package/src/app/{api → (backend)/api}/webhooks/casdoor/validateRequest.ts +0 -0
  51. /package/src/app/{api → (backend)/api}/webhooks/clerk/__tests__/fixtures/createUser.json +0 -0
  52. /package/src/app/{api → (backend)/api}/webhooks/clerk/route.ts +0 -0
  53. /package/src/app/{api → (backend)/api}/webhooks/clerk/validateRequest.ts +0 -0
  54. /package/src/app/{api → (backend)/api}/webhooks/logto/__tests__/route.test.ts +0 -0
  55. /package/src/app/{api → (backend)/api}/webhooks/logto/route.ts +0 -0
  56. /package/src/app/{api → (backend)/api}/webhooks/logto/validateRequest.ts +0 -0
  57. /package/src/app/{trpc → (backend)/trpc}/async/[trpc]/route.ts +0 -0
  58. /package/src/app/{trpc → (backend)/trpc}/edge/[trpc]/route.ts +0 -0
  59. /package/src/app/{trpc → (backend)/trpc}/lambda/[trpc]/route.ts +0 -0
  60. /package/src/app/{trpc → (backend)/trpc}/tools/[trpc]/route.ts +0 -0
  61. /package/src/app/{webapi → (backend)/webapi}/assistant/[id]/route.ts +0 -0
  62. /package/src/app/{webapi → (backend)/webapi}/assistant/store/route.ts +0 -0
  63. /package/src/app/{webapi → (backend)/webapi}/plugin/gateway/settings.test.ts +0 -0
  64. /package/src/app/{webapi → (backend)/webapi}/plugin/gateway/settings.ts +0 -0
  65. /package/src/app/{webapi → (backend)/webapi}/plugin/store/route.ts +0 -0
  66. /package/src/app/{webapi → (backend)/webapi}/proxy/route.ts +0 -0
  67. /package/src/app/{webapi → (backend)/webapi}/tokenizer/index.test.ts +0 -0
  68. /package/src/app/{webapi → (backend)/webapi}/tokenizer/route.ts +0 -0
  69. /package/src/app/{webapi → (backend)/webapi}/trace/route.ts +0 -0
  70. /package/src/app/{webapi → (backend)/webapi}/tts/edge/route.ts +0 -0
  71. /package/src/app/{webapi → (backend)/webapi}/tts/microsoft/route.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.21.6](https://github.com/lobehub/lobe-chat/compare/v1.21.5...v1.21.6)
6
+
7
+ <sup>Released on **2024-10-05**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Move backend api to (backend) folder group.
12
+
13
+ #### 🐛 Bug Fixes
14
+
15
+ - **misc**: Fix txt-to-image api.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### Code refactoring
23
+
24
+ - **misc**: Move backend api to (backend) folder group, closes [#4262](https://github.com/lobehub/lobe-chat/issues/4262) ([d8afb46](https://github.com/lobehub/lobe-chat/commit/d8afb46))
25
+
26
+ #### What's fixed
27
+
28
+ - **misc**: Fix txt-to-image api, closes [#4264](https://github.com/lobehub/lobe-chat/issues/4264) ([d1ff4ba](https://github.com/lobehub/lobe-chat/commit/d1ff4ba))
29
+
30
+ </details>
31
+
32
+ <div align="right">
33
+
34
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
35
+
36
+ </div>
37
+
5
38
  ### [Version 1.21.5](https://github.com/lobehub/lobe-chat/compare/v1.21.4...v1.21.5)
6
39
 
7
40
  <sup>Released on **2024-10-05**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.21.5",
3
+ "version": "1.21.6",
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,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/api/middleware/auth/utils';
5
+ import { checkAuthMethod, getJWTPayload } from '@/app/(backend)/api/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';
@@ -1,4 +1,4 @@
1
- import { createErrorResponse } from '@/app/api/errorResponse';
1
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
2
2
  import { AgentRuntime, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
3
3
  import { ChatErrorType } from '@/types/fetch';
4
4
  import { ChatStreamPayload } from '@/types/openai/chat';
@@ -1,6 +1,6 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
- import { createErrorResponse } from '@/app/api/errorResponse';
3
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
4
4
  import { ChatCompletionErrorPayload, ModelProvider } from '@/libs/agent-runtime';
5
5
  import { ChatErrorType } from '@/types/fetch';
6
6
 
@@ -1,7 +1,7 @@
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/api/errorResponse';
4
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
5
5
  import { AgentRuntimeError } from '@/libs/agent-runtime';
6
6
  import { ChatErrorType } from '@/types/fetch';
7
7
 
@@ -12,7 +12,7 @@ vi.mock('@clerk/nextjs/server', () => ({
12
12
  getAuth: vi.fn(),
13
13
  }));
14
14
 
15
- vi.mock('@/app/api/errorResponse', () => ({
15
+ vi.mock('@/app/(backend)/api/errorResponse', () => ({
16
16
  createErrorResponse: vi.fn(),
17
17
  }));
18
18
 
@@ -2,7 +2,7 @@ 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/api/errorResponse';
5
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
6
6
  import { JWTPayload, LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableClerk } from '@/const/auth';
7
7
  import { AgentRuntime, AgentRuntimeError, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
8
8
  import { ChatErrorType } from '@/types/fetch';
@@ -1,8 +1,8 @@
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/api/errorResponse';
5
- import { getJWTPayload } from '@/app/api/middleware/auth/utils';
4
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
5
+ import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
6
6
  import { getAppConfig } from '@/config/app';
7
7
  import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
8
8
  import { LOBE_CHAT_TRACE_ID, TraceNameMap } from '@/const/trace';
@@ -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/api/openai/createBizOpenAI';
4
+ import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';
5
5
 
6
6
  export const runtime = 'edge';
7
7
 
@@ -1,8 +1,8 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
- import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
4
- import { createErrorResponse } from '@/app/api/errorResponse';
5
- import { checkAuth } from '@/app/api/middleware/auth';
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';
6
6
  import { ChatCompletionErrorPayload } from '@/libs/agent-runtime';
7
7
  import { TextToImagePayload } from '@/libs/agent-runtime/types';
8
8
  import { ChatErrorType } from '@/types/fetch';
@@ -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/api/openai/createBizOpenAI';
4
+ import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';
5
5
 
6
6
  export const runtime = 'edge';
7
7
 
@@ -4,7 +4,7 @@ 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/api/chat/agentRuntime';
7
+ import { createTraceOptions } from '@/app/(backend)/api/chat/agentRuntime';
8
8
  import * as langfuseCfg from '@/config/langfuse';
9
9
  import { JWTPayload } from '@/const/auth';
10
10
  import { TraceNameMap } from '@/const/trace';
@@ -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/api/middleware/auth/utils';
5
+ import * as utils from '@/app/(backend)/api/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/api/middleware/auth/utils';
3
+ import { getJWTPayload } from '@/app/(backend)/api/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/api/middleware/auth/utils';
3
+ import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
4
4
  import { trpc } from '@/libs/trpc/init';
5
5
 
6
6
  export const keyVaults = trpc.middleware(async (opts) => {
@@ -3,7 +3,7 @@ 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/api/chat/agentRuntime';
6
+ import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
7
7
  import { fileEnv } from '@/config/file';
8
8
  import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
9
9
  import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '@/database/server/models/asyncTask';
@@ -2,7 +2,7 @@ import { TRPCError } from '@trpc/server';
2
2
  import OpenAI from 'openai';
3
3
  import { z } from 'zod';
4
4
 
5
- import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
5
+ import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
6
6
  import { chainAnswerWithContext } from '@/chains/answerWithContext';
7
7
  import { DEFAULT_EMBEDDING_MODEL, DEFAULT_MODEL } from '@/const/settings';
8
8
  import { ChunkModel } from '@/database/server/models/chunk';
@@ -1,7 +1,7 @@
1
1
  import { inArray } from 'drizzle-orm';
2
2
  import { z } from 'zod';
3
3
 
4
- import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
4
+ import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
5
5
  import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
6
6
  import { serverDB } from '@/database/server';
7
7
  import { AsyncTaskModel } from '@/database/server/models/asyncTask';
@@ -36,7 +36,7 @@ export const API_ENDPOINTS = mapWithBasePath({
36
36
  trace: '/webapi/trace',
37
37
 
38
38
  // image
39
- images: '/webapi/api/text-to-image/openai',
39
+ images: '/webapi/text-to-image/openai',
40
40
 
41
41
  // STT
42
42
  stt: '/webapi/stt/openai',
@@ -2,7 +2,7 @@ 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/api/errorResponse';
5
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
6
6
  import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
7
7
  import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
8
8
  import { INBOX_SESSION_ID } from '@/const/session';
@@ -1,6 +1,6 @@
1
1
  import { ListResponse, Ollama as OllamaBrowser, ProgressResponse } from 'ollama/browser';
2
2
 
3
- import { createErrorResponse } from '@/app/api/errorResponse';
3
+ import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
4
4
  import { ModelProvider } from '@/libs/agent-runtime';
5
5
  import { useUserStore } from '@/store/user';
6
6
  import { keyVaultsConfigSelectors } from '@/store/user/selectors';
File without changes