Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chat-query
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
jaden
chat-query
Commits
712884c7
Commit
712884c7
authored
Jul 07, 2023
by
jaden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: build image
parent
a45d3fda
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
66 deletions
+188
-66
.dockerignore
.dockerignore
+42
-0
components/AITool/index.tsx
components/AITool/index.tsx
+4
-1
components/import_modal.js
components/import_modal.js
+1
-1
dockerfile
dockerfile
+22
-0
pages/actions/View/chatView.tsx
pages/actions/View/chatView.tsx
+118
-63
utils/gpt.ts
utils/gpt.ts
+1
-1
No files found.
.dockerignore
0 → 100644
View file @
712884c7
# 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
components/AITool/index.tsx
View file @
712884c7
...
@@ -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
'
,
...
...
components/import_modal.js
View file @
712884c7
...
@@ -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
:
'
1
39.198.179.193
'
,
host
:
'
1
92.168.100.5
'
,
port
:
32094
,
port
:
32094
,
user
:
'
root
'
,
user
:
'
root
'
,
password
:
'
123789
'
,
password
:
'
123789
'
,
...
...
dockerfile
0 → 100644
View file @
712884c7
# 使用 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
pages/actions/View/chatView.tsx
View file @
712884c7
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
>
...
...
utils/gpt.ts
View file @
712884c7
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment