forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/ziyanwould/lobe-chat
- Loading branch information
Showing
76 changed files
with
176 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/app/api/chat/[provider]/route.ts → ...pp/(backend)/api/chat/[provider]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/app/api/chat/models/[provider]/route.ts → ...kend)/api/chat/models/[provider]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/app/webapi/plugin/gateway/route.ts → .../(backend)/webapi/plugin/gateway/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/app/webapi/stt/openai/route.ts → src/app/(backend)/webapi/stt/openai/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.../webapi/text-to-image/[provider]/route.ts → .../webapi/text-to-image/[provider]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/app/webapi/tts/openai/route.ts → src/app/(backend)/webapi/tts/openai/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React.tsx
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { SandpackLayout, SandpackPreview, SandpackProvider } from '@codesandbox/sandpack-react'; | ||
import { memo } from 'react'; | ||
|
||
import { useChatStore } from '@/store/chat'; | ||
import { chatPortalSelectors } from '@/store/chat/selectors'; | ||
|
||
import { createTemplateFiles } from './template'; | ||
|
||
interface ReactRendererProps { | ||
code: string; | ||
} | ||
|
||
const ReactRenderer = memo<ReactRendererProps>(({ code }) => { | ||
const title = useChatStore(chatPortalSelectors.artifactTitle); | ||
|
||
return ( | ||
<SandpackProvider | ||
customSetup={{ | ||
dependencies: { | ||
'@lshay/ui': 'latest', | ||
'@radix-ui/react-alert-dialog': 'latest', | ||
'@radix-ui/react-dialog': 'latest', | ||
'@radix-ui/react-icons': 'latest', | ||
'antd': 'latest', | ||
'class-variance-authority': 'latest', | ||
'clsx': 'latest', | ||
'lucide-react': 'latest', | ||
'recharts': 'latest', | ||
'tailwind-merge': 'latest', | ||
}, | ||
}} | ||
files={{ | ||
'App.tsx': code, | ||
...createTemplateFiles({ title }), | ||
}} | ||
options={{ | ||
externalResources: ['https://cdn.tailwindcss.com'], | ||
visibleFiles: ['App.tsx'], | ||
}} | ||
style={{ height: '100%' }} | ||
template="vite-react-ts" | ||
theme="auto" | ||
> | ||
<SandpackLayout style={{ height: '100%' }}> | ||
<SandpackPreview style={{ height: '100%' }} /> | ||
</SandpackLayout> | ||
</SandpackProvider> | ||
); | ||
}); | ||
|
||
export default ReactRenderer; |
32 changes: 32 additions & 0 deletions
32
src/app/(main)/chat/(workspace)/@portal/Artifacts/Body/Renderer/React/template.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interface TemplateFilesParams { | ||
title?: string; | ||
} | ||
export const createTemplateFiles = ({ title }: TemplateFilesParams = {}) => ({ | ||
'index.html': `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>${title || 'Artifacts App'}</title> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/index.tsx"></script> | ||
</body> | ||
</html> | ||
`, | ||
'vite.config.ts': { | ||
code: `import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
export default defineConfig({ | ||
plugins: [react()], | ||
resolve: { | ||
alias: { | ||
'@/components/ui': '@lshay/ui/components/default', | ||
}, | ||
}, | ||
});`, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.