@lobehub/chat 1.21.4 → 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.
- package/CHANGELOG.md +58 -0
- package/package.json +1 -1
- package/src/app/{api → (backend)/api}/chat/[provider]/route.test.ts +1 -1
- package/src/app/{api → (backend)/api}/chat/[provider]/route.ts +1 -1
- package/src/app/{api → (backend)/api}/chat/models/[provider]/route.ts +1 -1
- package/src/app/{api → (backend)/api}/middleware/auth/index.test.ts +2 -2
- package/src/app/{api → (backend)/api}/middleware/auth/index.ts +1 -1
- package/src/app/{webapi → (backend)/webapi}/plugin/gateway/route.ts +2 -2
- package/src/app/{webapi → (backend)/webapi}/stt/openai/route.ts +1 -1
- package/src/app/{webapi → (backend)/webapi}/text-to-image/[provider]/route.ts +3 -3
- package/src/app/{webapi → (backend)/webapi}/tts/openai/route.ts +1 -1
- package/src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React/index.tsx +51 -0
- package/src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React/template.ts +32 -0
- package/src/libs/agent-runtime/AgentRuntime.test.ts +1 -1
- package/src/libs/trpc/middleware/jwtPayload.test.ts +1 -1
- package/src/libs/trpc/middleware/jwtPayload.ts +1 -1
- package/src/libs/trpc/middleware/keyVaults.ts +1 -1
- package/src/server/routers/async/file.ts +1 -1
- package/src/server/routers/async/ragEval.ts +1 -1
- package/src/server/routers/lambda/chunk.ts +1 -1
- package/src/services/_url.ts +1 -1
- package/src/services/chat.ts +1 -1
- package/src/services/ollama.ts +1 -1
- package/src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React.tsx +0 -31
- /package/src/app/{api → (backend)/api}/auth/[...nextauth]/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/auth/error/AuthErrorPage.tsx +0 -0
- /package/src/app/{api → (backend)/api}/auth/error/page.tsx +0 -0
- /package/src/app/{api → (backend)/api}/chat/agentRuntime.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/agentRuntime.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/anthropic/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/anthropic/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/apiKeyManager.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/apiKeyManager.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/google/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/google/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/minimax/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/minimax/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/openai/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/openai/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/wenxin/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/chat/wenxin/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/errorResponse.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/errorResponse.ts +0 -0
- /package/src/app/{api → (backend)/api}/middleware/auth/utils.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/middleware/auth/utils.ts +0 -0
- /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/auth.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/auth.ts +0 -0
- /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/createAzureOpenai.ts +0 -0
- /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/createOpenai.ts +0 -0
- /package/src/app/{api → (backend)/api}/openai/createBizOpenAI/index.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/casdoor/__tests__/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/casdoor/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/casdoor/validateRequest.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/clerk/__tests__/fixtures/createUser.json +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/clerk/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/clerk/validateRequest.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/logto/__tests__/route.test.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/logto/route.ts +0 -0
- /package/src/app/{api → (backend)/api}/webhooks/logto/validateRequest.ts +0 -0
- /package/src/app/{trpc → (backend)/trpc}/async/[trpc]/route.ts +0 -0
- /package/src/app/{trpc → (backend)/trpc}/edge/[trpc]/route.ts +0 -0
- /package/src/app/{trpc → (backend)/trpc}/lambda/[trpc]/route.ts +0 -0
- /package/src/app/{trpc → (backend)/trpc}/tools/[trpc]/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/assistant/[id]/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/assistant/store/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/plugin/gateway/settings.test.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/plugin/gateway/settings.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/plugin/store/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/proxy/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/tokenizer/index.test.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/tokenizer/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/trace/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/tts/edge/route.ts +0 -0
- /package/src/app/{webapi → (backend)/webapi}/tts/microsoft/route.ts +0 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,64 @@
|
|
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
|
+
[](#readme-top)
|
35
|
+
|
36
|
+
</div>
|
37
|
+
|
38
|
+
### [Version 1.21.5](https://github.com/lobehub/lobe-chat/compare/v1.21.4...v1.21.5)
|
39
|
+
|
40
|
+
<sup>Released on **2024-10-05**</sup>
|
41
|
+
|
42
|
+
#### 💄 Styles
|
43
|
+
|
44
|
+
- **misc**: Support shadcn in Artifacts.
|
45
|
+
|
46
|
+
<br/>
|
47
|
+
|
48
|
+
<details>
|
49
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
50
|
+
|
51
|
+
#### Styles
|
52
|
+
|
53
|
+
- **misc**: Support shadcn in Artifacts, closes [#4256](https://github.com/lobehub/lobe-chat/issues/4256) ([863bae5](https://github.com/lobehub/lobe-chat/commit/863bae5))
|
54
|
+
|
55
|
+
</details>
|
56
|
+
|
57
|
+
<div align="right">
|
58
|
+
|
59
|
+
[](#readme-top)
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
5
63
|
### [Version 1.21.4](https://github.com/lobehub/lobe-chat/compare/v1.21.3...v1.21.4)
|
6
64
|
|
7
65
|
<sup>Released on **2024-10-02**</sup>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.21.
|
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
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { SandpackLayout, SandpackPreview, SandpackProvider } from '@codesandbox/sandpack-react';
|
2
|
+
import { memo } from 'react';
|
3
|
+
|
4
|
+
import { useChatStore } from '@/store/chat';
|
5
|
+
import { chatPortalSelectors } from '@/store/chat/selectors';
|
6
|
+
|
7
|
+
import { createTemplateFiles } from './template';
|
8
|
+
|
9
|
+
interface ReactRendererProps {
|
10
|
+
code: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
const ReactRenderer = memo<ReactRendererProps>(({ code }) => {
|
14
|
+
const title = useChatStore(chatPortalSelectors.artifactTitle);
|
15
|
+
|
16
|
+
return (
|
17
|
+
<SandpackProvider
|
18
|
+
customSetup={{
|
19
|
+
dependencies: {
|
20
|
+
'@lshay/ui': 'latest',
|
21
|
+
'@radix-ui/react-alert-dialog': 'latest',
|
22
|
+
'@radix-ui/react-dialog': 'latest',
|
23
|
+
'@radix-ui/react-icons': 'latest',
|
24
|
+
'antd': 'latest',
|
25
|
+
'class-variance-authority': 'latest',
|
26
|
+
'clsx': 'latest',
|
27
|
+
'lucide-react': 'latest',
|
28
|
+
'recharts': 'latest',
|
29
|
+
'tailwind-merge': 'latest',
|
30
|
+
},
|
31
|
+
}}
|
32
|
+
files={{
|
33
|
+
'App.tsx': code,
|
34
|
+
...createTemplateFiles({ title }),
|
35
|
+
}}
|
36
|
+
options={{
|
37
|
+
externalResources: ['https://cdn.tailwindcss.com'],
|
38
|
+
visibleFiles: ['App.tsx'],
|
39
|
+
}}
|
40
|
+
style={{ height: '100%' }}
|
41
|
+
template="vite-react-ts"
|
42
|
+
theme="auto"
|
43
|
+
>
|
44
|
+
<SandpackLayout style={{ height: '100%' }}>
|
45
|
+
<SandpackPreview style={{ height: '100%' }} />
|
46
|
+
</SandpackLayout>
|
47
|
+
</SandpackProvider>
|
48
|
+
);
|
49
|
+
});
|
50
|
+
|
51
|
+
export default ReactRenderer;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
interface TemplateFilesParams {
|
2
|
+
title?: string;
|
3
|
+
}
|
4
|
+
export const createTemplateFiles = ({ title }: TemplateFilesParams = {}) => ({
|
5
|
+
'index.html': `<!DOCTYPE html>
|
6
|
+
<html lang="en">
|
7
|
+
<head>
|
8
|
+
<meta charset="UTF-8" />
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
10
|
+
<title>${title || 'Artifacts App'}</title>
|
11
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<div id="root"></div>
|
15
|
+
<script type="module" src="/index.tsx"></script>
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
`,
|
19
|
+
'vite.config.ts': {
|
20
|
+
code: `import { defineConfig } from 'vite';
|
21
|
+
import react from '@vitejs/plugin-react';
|
22
|
+
|
23
|
+
export default defineConfig({
|
24
|
+
plugins: [react()],
|
25
|
+
resolve: {
|
26
|
+
alias: {
|
27
|
+
'@/components/ui': '@lshay/ui/components/default',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
});`,
|
31
|
+
},
|
32
|
+
});
|
@@ -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';
|
package/src/services/_url.ts
CHANGED
package/src/services/chat.ts
CHANGED
@@ -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';
|
package/src/services/ollama.ts
CHANGED
@@ -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';
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { SandpackLayout, SandpackPreview, SandpackProvider } from '@codesandbox/sandpack-react';
|
2
|
-
import { memo } from 'react';
|
3
|
-
|
4
|
-
interface ReactRendererProps {
|
5
|
-
code: string;
|
6
|
-
}
|
7
|
-
const ReactRenderer = memo<ReactRendererProps>(({ code }) => {
|
8
|
-
return (
|
9
|
-
<SandpackProvider
|
10
|
-
customSetup={{
|
11
|
-
dependencies: {
|
12
|
-
antd: 'latest',
|
13
|
-
recharts: 'latest',
|
14
|
-
},
|
15
|
-
}}
|
16
|
-
files={{
|
17
|
-
'App.js': code,
|
18
|
-
}}
|
19
|
-
options={{ externalResources: ['https://cdn.tailwindcss.com'] }}
|
20
|
-
style={{ height: '100%' }}
|
21
|
-
template="react"
|
22
|
-
theme="auto"
|
23
|
-
>
|
24
|
-
<SandpackLayout style={{ height: '100%' }}>
|
25
|
-
<SandpackPreview style={{ height: '100%' }} />
|
26
|
-
</SandpackLayout>
|
27
|
-
</SandpackProvider>
|
28
|
-
);
|
29
|
-
});
|
30
|
-
|
31
|
-
export default ReactRenderer;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|