Commit 43ba1a03 authored by jaden's avatar jaden

fix: fix bug

parent 41a93931
......@@ -7,7 +7,8 @@
## 演示
> [view](https://chat-query.netlify.app/) **由于netlify网络限制问题,请尽量选择一下模式:**
> [view](https://chat-query.vercel.app/)
> [国内](http://139.198.179.193:32205/)
+ 选择网站设置 ![Choose website settings](./public/image.png)
+ 允许不安全内容 ![Allow Unsafe](./public/image1.png)
......
......@@ -5,10 +5,8 @@
> Chat-Query is a data query tool based on metadata models and AI technology, enabling natural language queries.
## Demo
> [view](https://chat-query.netlify.app/) **Due to network restrictions on Netlify, please try to choose one of the following modes:**
+ Choose website settings ![Choose website settings](./public/image.png)
+ Allow Unsafe Content ![Allow Unsafe](./public/image1.png)
> [view](https://chat-query.vercel.app/)
> [zh](http://139.198.179.193:32205/)
> [demo](https://cdn.glitch.me/fd139a45-4a65-41b6-9634-41617ab20cdc/%E6%BC%94%E7%A4%BA.gif?v=1686907695067)
......
......@@ -23,6 +23,7 @@ ENV OPENAI_PROXY_URL $OPENAI_PROXY_URL
# 执行构建命令
COPY .next ./.next
COPY public ./public
# 暴露 3000 端口
EXPOSE 3000
......
......@@ -96,7 +96,7 @@ export function ChatView({
defaultNode,
props: propsRaw,
id,
functions,
functions = init,
}: {
defaultNode?: ReactElement;
props: Record<string, any>;
......@@ -300,24 +300,23 @@ export function ChatView({
showSearch={{
retainInputValue: true,
}}
onFocus={() => {
if (editor) {
onClick={() => {
const root: any = Parser.parse(
editor.getValue(),
editor?.getValue() || functions,
{
ecmaVersion: 6,
}
);
console.log(root, 'content');
const body: ReturnType<typeof Parser.parse>[] =
get(root, 'body');
const body: ReturnType<typeof Parser.parse>[] = get(
root,
'body'
);
setFunctionOption(
body.filter(
v => v.type === 'FunctionDeclaration'
)
);
}
}}
onChange={setFunctionName}
>
......@@ -339,11 +338,13 @@ export function ChatView({
}
const data = await workerFn(
propsRaw,
`${editor?.getValue()};\n return ${functionName}(data);`
`${
editor?.getValue() || functions
};\n return ${functionName}(data);`
);
ConnectDb.updateQuery(
id,
`${editor?.getValue()}\n`
`${editor?.getValue() || functions}\n`
);
setProps(data);
}}
......@@ -363,7 +364,7 @@ export function ChatView({
}}
height="300px"
defaultLanguage="javascript"
defaultValue={functions || init}
defaultValue={functions}
/>
</CollapseItem>
</Collapse>
......
......@@ -8,9 +8,15 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
import { DndProvider, useDrag, useDrop } from 'react-dnd';
import Link from 'next/link';
import { useTranslation, Trans } from 'react-i18next';
import { useEffect } from 'react';
import Script from 'next/script';
function Home() {
const { t } = useTranslation();
useEffect(() => {
return () => {
document.querySelector('#fireworks')?.remove();
};
}, []);
return (
<>
<Head>
......@@ -23,6 +29,15 @@ function Home() {
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="home bg-scroll">
<Script
src="https://cdn.jsdelivr.net/npm/tsparticles-fireworks@2.10.1/tsparticles.fireworks.bundle.min.js"
onLoad={() => {
if (window?.fireworks) {
document.querySelector('#fireworks')?.remove();
fireworks();
}
}}
/>
<Layout className="main">
<Layout>
<div className="container">
......
......@@ -253,3 +253,8 @@ background:rgba(255, 166, 0, 0.53) !important;
.shadow-t {
box-shadow: 0 -5px 10px 0px rgba(130, 130, 130, 0.1);
}
#fireworks{
position: relative;
z-index: -1;
}
\ No newline at end of file
.home {
color: #fff;
font-family: "Roboto Condensed", sans-serif;
background-image: url(https://images.unsplash.com/photo-1508389377389-b8221c0bcc9e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80);
background-size: 110%;
background-position: 0% 0%;
margin: 0;
animation: change-background 15s linear infinite alternate-reverse;
width: 100%;
......
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