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