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({
doneFx && doneFx(currentAssistantMessageStr);
console.log(currentAssistantMessageStr, 'currentAssistantMessageStr');
},
setCurrentAssistantMessage,
val => {
setCurrentAssistantMessage(val);
toView();
},
() => {
Notification.error({
title: 'No Response',
......
......@@ -26,7 +26,7 @@ export function DBForm({
slot = null,
initialValues = {
client: 'mysql2',
host: '139.198.179.193',
host: '192.168.100.5',
port: 32094,
user: 'root',
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 { IconCode, IconEye, IconRefresh, IconSend, IconSwap } from '@arco-design/web-react/icon';
import { Alert, Button, Card, Collapse, Input, Spin } from '@arco-design/web-react';
import {
IconCode,
IconEye,
IconPlus,
IconRefresh,
IconSend,
IconSwap,
} from '@arco-design/web-react/icon';
import React, {
ReactElement,
memo,
......@@ -11,10 +18,10 @@ import React, {
} from 'react';
import {
LiveEditor,
LiveError,
LivePreview,
LiveProvider,
useLiveContext,
useRunner,
} from 'react-live-runner';
import * as styledComponents from 'styled-components';
import * as echarts from 'echarts';
......@@ -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({
defaultNode,
props: propsRaw,
......@@ -101,13 +138,9 @@ export function ChatView({
const Live = useMemo(() => {
let node;
try {
node = !showCode ? (
<LiveEditor className="overflow-auto min-h-[350px]" />
) : (
<LivePreview />
);
node = !showCode ? <LiveEditor /> : <ReactView />;
} catch (err) {
node = <LiveEditor className="overflow-auto min-h-[350px]" />;
node = <LiveEditor />;
}
return (
......@@ -205,19 +238,25 @@ export function ChatView({
}
}, [editor, props]);
const [functionName, setFunctionName] = useState('');
return (
<div>
{props.length ? (
<>
<div className="w-full mb-[20px]">
<Collapse style={{ maxWidth: 1180 }}>
<CollapseItem
header="数据处理"
name="1"
extra={
<div className="flex">
<Button
className="mr-[10px]"
onClick={async () => {
if (!functionName) return;
const data = await workerFn(
propsRaw,
`${editor?.getValue()};\n return handler(data);`
`${editor?.getValue()};\n return ${functionName}(data);`
);
console.log(data);
setProps(data);
......@@ -227,6 +266,14 @@ export function ChatView({
>
Run
</Button>
<Input
size="mini"
placeholder="执行函数名称"
onChange={value => {
setFunctionName(value);
}}
/>
</div>
}
>
<Editor
......@@ -249,7 +296,11 @@ export function ChatView({
style: { width: 400 },
height: 36,
className: 'overflow-hidden simple-mode-border',
prefix: <span className="text-[var(--pc)]">{t('component display')}</span>,
prefix: (
<span className="text-[var(--pc)]">
{t('component display')}
</span>
),
autoFocus: false,
}}
SendButton={SendButton}
......@@ -264,6 +315,10 @@ export function ChatView({
</Button>
)}
</div>
</>
) : (
<Alert style={{ marginBottom: 20 }} type="success" content="执行成功" />
)}
<Spin loading={isMutating} block className="my-[20px]">
{example && !showTable ? (
<div>
......
const gpt35 = {
name: 'gpt-3.5-turbo',
name: 'gpt-3.5-turbo-16k-0613',
temperature: 0,
frequency_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