mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-10-14 01:39:18 +00:00
阿弥诺斯
This commit is contained in:
parent
17db64cd02
commit
a57e4d4b46
@ -96,7 +96,7 @@ const ConfigPage = () => {
|
||||
};
|
||||
|
||||
const handleApply = async () => {
|
||||
if (!editableConfig.trim()) {
|
||||
if (!editableConfig) {
|
||||
Notification.warn({
|
||||
title: '配置为空',
|
||||
description: '请先解析或编辑有效配置',
|
||||
@ -213,13 +213,15 @@ const ConfigPage = () => {
|
||||
生成配置:
|
||||
</Text>
|
||||
<Textarea
|
||||
value={editableConfig}
|
||||
value={JSON.stringify(editableConfig)}
|
||||
rows={12}
|
||||
onChange={(e) => setEditableConfig(e.target.value)}
|
||||
fontFamily={'monospace'}
|
||||
size={'sm'}
|
||||
bg={'blackAlpha.200'}
|
||||
whiteSpace="pre-wrap"
|
||||
/>
|
||||
|
||||
<HStack mt={4} spacing={3} justify={'flex-end'}>
|
||||
<Button
|
||||
variant={'outline'}
|
||||
@ -240,7 +242,7 @@ const ConfigPage = () => {
|
||||
size={'sm'}
|
||||
onClick={handleApply}
|
||||
isLoading={applying}
|
||||
isDisabled={!editableConfig.trim()}
|
||||
isDisabled={!editableConfig}
|
||||
>
|
||||
应用到交换机
|
||||
</Button>
|
||||
|
@ -41,7 +41,13 @@ export const api = {
|
||||
* @param text 文本
|
||||
* @returns {Promise<axios.AxiosResponse<any>>}
|
||||
*/
|
||||
parseCommand: (text) => axios.post(buildUrl('/api/parse_command'), { command: text }),
|
||||
//parseCommand: async (text) => await axios.post(buildUrl('/api/parse_command'), { command: text }),
|
||||
async parseCommand(text) {
|
||||
const res = await axios.post(buildUrl('/api/parse_command', { command: text }));
|
||||
if (res) {
|
||||
return res;
|
||||
} else return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* 应用配置
|
||||
|
Loading…
x
Reference in New Issue
Block a user