diff --git a/app/src/renderer/src/pages/Setting/index.tsx b/app/src/renderer/src/pages/Setting/index.tsx index aea927a..5ab2a01 100644 --- a/app/src/renderer/src/pages/Setting/index.tsx +++ b/app/src/renderer/src/pages/Setting/index.tsx @@ -1,86 +1,108 @@ import { Form, useLoaderData, useSubmit } from 'react-router-dom' import styles from './styles.module.scss' import { useState } from 'react' -import { Button, message } from 'antd' +import { Button, Select, message } from 'antd' import { localServerBaseUrl } from '@renderer/config' export const Setting = () => { - // const config = useLoaderData() as ConfigDataType - const [keys, setKeys] = useState([]) - const config = useLoaderData() as ConfigDataType - const submit = useSubmit() - return ( -
-
-

Setting

-
-
快捷键定义
- { - if (e.metaKey || e.ctrlKey || e.altKey) { - const code = e.code.replace(/Left|Right|Key|Digit/, '') - if (keys.includes(code)) return - keys.push(code) - setKeys(keys) - // 如果以数字或字母或者空格结尾 - if (code.match(/^(\w|\s)$/gi)) { - e.currentTarget.value = keys.join('+') - setKeys([]) - submit({...config, shortCut: e.currentTarget.value}, {method: "POST"}) - // 注册快捷键 - window.api.shortCut() - } - } + // const config = useLoaderData() as ConfigDataType + const [keys, setKeys] = useState([]) + const config = useLoaderData() as ConfigDataType + const submit = useSubmit() + return ( + +
+

Setting

+
+
快捷键定义
+ { + if (e.metaKey || e.ctrlKey || e.altKey) { + const code = e.code.replace(/Left|Right|Key|Digit/, '') + if (keys.includes(code)) return + keys.push(code) + setKeys(keys) + // 如果以数字或字母或者空格结尾 + if (code.match(/^(\w|\s)$/gi)) { + e.currentTarget.value = keys.join('+') + setKeys([]) + config.shortCut = e.currentTarget.value + // 注册快捷键 + window.api.shortCut() + } + } - }} - /> -
-
-
-
大模型配置信息
- -
- { - window.api.sql(`update config set content=@content where id = 1`, - 'update', - { - content: JSON.stringify({...config, llm: JSON.parse(e.currentTarget.value)}) - }) - }} - /> -
-
- - ) + }} + /> +
+
+
+
大模型配置信息
+ +
+ { + config.llm = JSON.parse(e.currentTarget.value) + }} + /> + {/* */} +
+
+ + +
+
+ + ) } \ No newline at end of file