Commit 712884c7 authored by jaden's avatar jaden

feat: build image

parent a45d3fda
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# testing
coverage
# next.js
.next
out
# production
build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
backend
TOKEN.ts
.env
.vscode
\ No newline at end of file
...@@ -132,7 +132,10 @@ export function AIWrapper({ ...@@ -132,7 +132,10 @@ export function AIWrapper({
doneFx && doneFx(currentAssistantMessageStr); doneFx && doneFx(currentAssistantMessageStr);
console.log(currentAssistantMessageStr, 'currentAssistantMessageStr'); console.log(currentAssistantMessageStr, 'currentAssistantMessageStr');
}, },
setCurrentAssistantMessage, val => {
setCurrentAssistantMessage(val);
toView();
},
() => { () => {
Notification.error({ Notification.error({
title: 'No Response', title: 'No Response',
......
...@@ -26,7 +26,7 @@ export function DBForm({ ...@@ -26,7 +26,7 @@ export function DBForm({
slot = null, slot = null,
initialValues = { initialValues = {
client: 'mysql2', client: 'mysql2',
host: '139.198.179.193', host: '192.168.100.5',
port: 32094, port: 32094,
user: 'root', user: 'root',
password: '123789', password: '123789',
......
# 使用 Node.js 14 作为基础镜像
FROM node:18
# 设置工作目录
WORKDIR /app
# 复制整个应用到容器中
COPY ./ /app
# 安装依赖
RUN npm i -g pnpm
RUN pnpm i
# 执行构建命令
RUN yarn build
# 暴露 3000 端口
EXPOSE 3000
# 启动应用
CMD ["pnpm", "start"]
\ No newline at end of file
import { Button, Card, Collapse, Spin } from '@arco-design/web-react'; import { Alert, Button, Card, Collapse, Input, Spin } from '@arco-design/web-react';
import { IconCode, IconEye, IconRefresh, IconSend, IconSwap } from '@arco-design/web-react/icon'; import {
IconCode,
IconEye,
IconPlus,
IconRefresh,
IconSend,
IconSwap,
} from '@arco-design/web-react/icon';
import React, { import React, {
ReactElement, ReactElement,
memo, memo,
...@@ -11,10 +18,10 @@ import React, { ...@@ -11,10 +18,10 @@ import React, {
} from 'react'; } from 'react';
import { import {
LiveEditor, LiveEditor,
LiveError,
LivePreview, LivePreview,
LiveProvider, LiveProvider,
useLiveContext, useLiveContext,
useRunner,
} from 'react-live-runner'; } from 'react-live-runner';
import * as styledComponents from 'styled-components'; import * as styledComponents from 'styled-components';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
...@@ -53,6 +60,36 @@ function handler(data){ ...@@ -53,6 +60,36 @@ function handler(data){
`; `;
function ReactView() {
const { code } = useLiveContext();
return (
<div>
<div className="flex justify-end">
<Button
className="mr-[60px] shadow"
type="primary"
size="small"
shape="round"
onClick={() => {
if (window.parent) {
window.parent.postMessage(
{
code: code,
type: 'code',
},
'*'
);
}
}}
>
<IconPlus /> 添加组件
</Button>
</div>
<LivePreview className="overflow-auto min-h-[350px]" />
</div>
);
}
export function ChatView({ export function ChatView({
defaultNode, defaultNode,
props: propsRaw, props: propsRaw,
...@@ -101,13 +138,9 @@ export function ChatView({ ...@@ -101,13 +138,9 @@ export function ChatView({
const Live = useMemo(() => { const Live = useMemo(() => {
let node; let node;
try { try {
node = !showCode ? ( node = !showCode ? <LiveEditor /> : <ReactView />;
<LiveEditor className="overflow-auto min-h-[350px]" />
) : (
<LivePreview />
);
} catch (err) { } catch (err) {
node = <LiveEditor className="overflow-auto min-h-[350px]" />; node = <LiveEditor />;
} }
return ( return (
...@@ -205,65 +238,87 @@ export function ChatView({ ...@@ -205,65 +238,87 @@ export function ChatView({
} }
}, [editor, props]); }, [editor, props]);
const [functionName, setFunctionName] = useState('');
return ( return (
<div> <div>
<div className="w-full mb-[20px]"> {props.length ? (
<Collapse style={{ maxWidth: 1180 }}> <>
<CollapseItem <div className="w-full mb-[20px]">
header="数据处理" <Collapse style={{ maxWidth: 1180 }}>
name="1" <CollapseItem
extra={ header="数据处理"
<Button name="1"
onClick={async () => { extra={
const data = await workerFn( <div className="flex">
propsRaw, <Button
`${editor?.getValue()};\n return handler(data);` className="mr-[10px]"
); onClick={async () => {
console.log(data); if (!functionName) return;
setProps(data); const data = await workerFn(
}} propsRaw,
type="primary" `${editor?.getValue()};\n return ${functionName}(data);`
size="mini" );
console.log(data);
setProps(data);
}}
type="primary"
size="mini"
>
Run
</Button>
<Input
size="mini"
placeholder="执行函数名称"
onChange={value => {
setFunctionName(value);
}}
/>
</div>
}
> >
Run <Editor
</Button> onMount={(instance, monaco) => {
} console.log(instance);
> setEditor(instance);
<Editor }}
onMount={(instance, monaco) => { height="300px"
console.log(instance); defaultLanguage="javascript"
setEditor(instance); defaultValue={init}
/>
</CollapseItem>
</Collapse>
</div>
<div className="flex justify-between items-center mb-[20px]">
<AI
simpleMode="input"
startView={3}
inputProps={{
style: { width: 400 },
height: 36,
className: 'overflow-hidden simple-mode-border',
prefix: (
<span className="text-[var(--pc)]">
{t('component display')}
</span>
),
autoFocus: false,
}}
SendButton={SendButton}
messageList={[]}
setMessageList={function (value: any[]) {
return false;
}} }}
height="300px"
defaultLanguage="javascript"
defaultValue={init}
/> />
</CollapseItem> {data && (
</Collapse> <Button shape="circle" onClick={() => setShowTable(!showTable)}>
</div> <IconSwap />
<div className="flex justify-between items-center mb-[20px]"> </Button>
<AI )}
simpleMode="input" </div>
startView={3} </>
inputProps={{ ) : (
style: { width: 400 }, <Alert style={{ marginBottom: 20 }} type="success" content="执行成功" />
height: 36, )}
className: 'overflow-hidden simple-mode-border',
prefix: <span className="text-[var(--pc)]">{t('component display')}</span>,
autoFocus: false,
}}
SendButton={SendButton}
messageList={[]}
setMessageList={function (value: any[]) {
return false;
}}
/>
{data && (
<Button shape="circle" onClick={() => setShowTable(!showTable)}>
<IconSwap />
</Button>
)}
</div>
<Spin loading={isMutating} block className="my-[20px]"> <Spin loading={isMutating} block className="my-[20px]">
{example && !showTable ? ( {example && !showTable ? (
<div> <div>
......
const gpt35 = { const gpt35 = {
name: 'gpt-3.5-turbo', name: 'gpt-3.5-turbo-16k-0613',
temperature: 0, temperature: 0,
frequency_penalty: 0.0, frequency_penalty: 0.0,
presence_penalty: 0.0, presence_penalty: 0.0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment