mirror of
https://github.com/yuruotong1/autoMate.git
synced 2026-03-22 13:07:17 +08:00
代码结构调整优化
This commit is contained in:
@@ -34,7 +34,7 @@ export const config = {
|
||||
hash: '/#config'
|
||||
}
|
||||
},
|
||||
chat: {
|
||||
interactive: {
|
||||
id: 0,
|
||||
options: {
|
||||
initShow: true,
|
||||
@@ -43,7 +43,7 @@ export const config = {
|
||||
openDevTools: true,
|
||||
frame: true,
|
||||
transparent: false,
|
||||
hash: '/#chat'
|
||||
hash: '/#interactive'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ export const getWindowByEvent = (event: IpcMainEvent | IpcMainInvokeEvent) => {
|
||||
|
||||
|
||||
app.whenReady().then(() => {
|
||||
getWindowByName('search')
|
||||
// getWindowByName('code')
|
||||
getWindowByName('config')
|
||||
getWindowByName('chat')
|
||||
// getWindowByName('search')
|
||||
// // getWindowByName('code')
|
||||
// getWindowByName('config')
|
||||
getWindowByName('interactive')
|
||||
|
||||
})
|
||||
@@ -1,12 +1,8 @@
|
||||
import { ProChat } from '@ant-design/pro-chat';
|
||||
import useChat from '@renderer/hooks/useChat';
|
||||
import { useTheme } from 'antd-style';
|
||||
import "./chat-page.scss"
|
||||
import Code from './Code';
|
||||
import { Button } from 'antd';
|
||||
export const Chat = () => {
|
||||
export default function Chat() {
|
||||
const {getResponse} = useChat()
|
||||
|
||||
const theme = useTheme();
|
||||
// const run = async ()=>{
|
||||
// const response = await useChat([{ role: 'user', content: '你好' }])
|
||||
@@ -14,32 +10,16 @@ export const Chat = () => {
|
||||
// }
|
||||
// run()
|
||||
return (
|
||||
<div className='chat-page'>
|
||||
<div style={{ background: theme.colorBgLayout }} className='chat'>
|
||||
<div style={{ background: theme.colorBgLayout }}>
|
||||
<ProChat
|
||||
helloMessage={
|
||||
<div className='text-black'>你好,我叫智子,你的智能Agent助手,有什么要求可以随时吩咐!</div>
|
||||
}
|
||||
request={async (messages) => {
|
||||
const response = await getResponse(messages)
|
||||
console.log('response', response)
|
||||
// 使用 Message 作为参数发送请求
|
||||
return response// 支持流式和非流式
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className='code'>
|
||||
<Code />
|
||||
<Button onClick={async () => {
|
||||
try {
|
||||
const res = await fetch("http://127.0.0.1:5000/");
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
}
|
||||
}}>运行</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
</div>)
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { python } from '@codemirror/lang-python';
|
||||
import { useStore } from '@renderer/store/useStore';
|
||||
// import { StreamLanguage } from '@codemirror/language';
|
||||
export default function Code() {
|
||||
export default function CodeEditor() {
|
||||
const code = useStore(state=>state.code)
|
||||
|
||||
return (
|
||||
1
app/src/renderer/src/config.ts
Normal file
1
app/src/renderer/src/config.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const localServerBaseUrl = "http://127.0.0.1:5000"
|
||||
26
app/src/renderer/src/pages/Interactive/index.tsx
Normal file
26
app/src/renderer/src/pages/Interactive/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import "./chat-page.scss"
|
||||
import { Button } from 'antd';
|
||||
import Chat from "@renderer/components/Chat"
|
||||
import CodeEditor from "@renderer/components/Chat"
|
||||
export default function Interactive() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='chat-page'>
|
||||
<Chat />
|
||||
</div>
|
||||
<div className='code'>
|
||||
<CodeEditor />
|
||||
<Button onClick={async () => {
|
||||
try {
|
||||
const res = await fetch("http://127.0.0.1:5000/");
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
}
|
||||
}}>运行</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import { Welcome } from "@renderer/pages/Welcome";
|
||||
import ContentListAction from "@renderer/pages/ContentList/ContentListAction";
|
||||
import CategoryAction from "@renderer/pages/Category/CategoryAction";
|
||||
import { Setting } from "@renderer/pages/Setting";
|
||||
import { Chat } from "@renderer/pages/Chat/Chat";
|
||||
import Interactive from "@renderer/pages/Interactive";
|
||||
import SettingAction from "@renderer/pages/Setting/SettingAction";
|
||||
import SettingLoader from "@renderer/pages/Setting/SettingLoader";
|
||||
|
||||
@@ -22,8 +22,8 @@ const router = createHashRouter([
|
||||
element: <Home />
|
||||
},
|
||||
{
|
||||
path: "chat",
|
||||
element: <Chat />
|
||||
path: "interactive",
|
||||
element: <Interactive />
|
||||
},
|
||||
{
|
||||
path: "config",
|
||||
|
||||
2
app/types.d.ts
vendored
2
app/types.d.ts
vendored
@@ -15,7 +15,7 @@ type ContentType = {
|
||||
}
|
||||
|
||||
|
||||
type WindowNameType = 'search' | 'config' | 'code' | 'chat'
|
||||
type WindowNameType = 'search' | 'config' | 'code' | 'interactive'
|
||||
|
||||
type ConfigType = {
|
||||
id: number
|
||||
|
||||
Reference in New Issue
Block a user