diff --git a/Cunkebao/src/pages/mobile/workspace/ai-knowledge/list/components/GlobalPromptModal.tsx b/Cunkebao/src/pages/mobile/workspace/ai-knowledge/list/components/GlobalPromptModal.tsx index 1e71db85..fb1d2086 100644 --- a/Cunkebao/src/pages/mobile/workspace/ai-knowledge/list/components/GlobalPromptModal.tsx +++ b/Cunkebao/src/pages/mobile/workspace/ai-knowledge/list/components/GlobalPromptModal.tsx @@ -1,12 +1,14 @@ import React, { useState, useEffect } from "react"; -import { Modal, Switch, message } from "antd"; +import { Popup, Toast } from "antd-mobile"; +import { Input, Button, Switch } from "antd"; +import { CloseOutlined } from "@ant-design/icons"; +const { TextArea } = Input; import { InfoCircleOutlined, - BulbOutlined, - ExclamationCircleOutlined, + ExclamationCircleFilled, + InfoCircleFilled, } from "@ant-design/icons"; import { getGlobalPrompt, saveGlobalPrompt } from "../api"; -import type { GlobalPromptConfig } from "../data"; import style from "../index.module.scss"; interface GlobalPromptModalProps { @@ -35,6 +37,7 @@ const GlobalPromptModal: React.FC = ({ if (visible) { fetchGlobalPrompt(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [visible]); const fetchGlobalPrompt = async () => { @@ -44,7 +47,7 @@ const GlobalPromptModal: React.FC = ({ setEnabled(config.enabled); setContent(config.content || DEFAULT_PROMPT); } catch (error) { - message.error("获取配置失败"); + Toast.show({ content: "获取配置失败", position: "bottom" }); } finally { setLoading(false); } @@ -52,66 +55,83 @@ const GlobalPromptModal: React.FC = ({ const handleSave = async () => { if (enabled && !content.trim()) { - message.error("启用统一提示词时,请输入提示词内容"); + Toast.show({ + content: "启用统一提示词时,请输入提示词内容", + position: "bottom", + }); return; } - setSaving(true); try { await saveGlobalPrompt({ enabled, content: content.trim(), }); - message.success("保存成功"); + Toast.show({ content: "保存成功", position: "bottom" }); onClose(); } catch (error) { - message.error("保存失败"); + Toast.show({ content: "保存失败", position: "bottom" }); } finally { setSaving(false); } }; return ( - - - 配置统一提示词 - - } - open={visible} - onCancel={onClose} - onOk={handleSave} - confirmLoading={saving} - width={600} - okText="保存配置" - cancelText="取消" + +
+
+ + 统一提示词配置 +
+ +
-

+

设置所有知识库的通用回复规范 -

- +
启用统一提示词 - +
- {enabled && ( -