diff --git a/src/pages/ai-agent/edit/List.tsx b/src/pages/ai-agent/edit/List.tsx
index 674a3bb..cc88d39 100644
--- a/src/pages/ai-agent/edit/List.tsx
+++ b/src/pages/ai-agent/edit/List.tsx
@@ -90,7 +90,6 @@ export const List = () => {
deleteData: state.deleteData,
getList: state.getList,
loading: state.loading,
- publishData: state.publishData,
updateData: state.updateData,
formData: state.formData,
};
diff --git a/src/pages/ai-chat/AiModule.tsx b/src/pages/ai-chat/AiModule.tsx
index 1c0a2f6..4c82f95 100644
--- a/src/pages/ai-chat/AiModule.tsx
+++ b/src/pages/ai-chat/AiModule.tsx
@@ -2,7 +2,7 @@ import { useShallow } from 'zustand/react/shallow';
import { useAiStore } from './store/ai-store';
import { CloseOutlined, HistoryOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, Form, Input, message, Modal, Tooltip } from 'antd';
-import { useEffect } from 'react';
+import { useEffect, useState } from 'react';
import { TextArea } from '../container/components/TextArea';
import clsx from 'clsx';
import { query } from '@/modules';
@@ -11,7 +11,23 @@ import { ChatMessage } from './module/ChatMessage';
import { isObjectNull } from '@/utils/is-null';
import { useNavigate } from 'react-router';
const testId = '60aca66b-4be9-4266-9568-6001032c7e13';
-
+const NormalMessage = ({ onSend }: { onSend: any }) => {
+ const [message, setMessage] = useState('');
+ const onClick = () => {
+ onSend(message);
+ setMessage('');
+ };
+ return (
+
+ );
+};
type FormModalProps = {
send?: any;
};
@@ -23,6 +39,7 @@ const FormModal = (props: FormModalProps) => {
showEdit: state.showEdit,
setShowEdit: state.setShowEdit,
formData: state.formData,
+ setFormData: state.setFormData,
setMessage: state.setMessage,
};
}),
@@ -47,6 +64,7 @@ const FormModal = (props: FormModalProps) => {
};
const onClose = () => {
aiStore.setShowEdit(false);
+ aiStore.setFormData({});
form.resetFields();
};
const isEdit = aiStore.formData.id;
@@ -175,6 +193,7 @@ export const AiMoudle = () => {
};
}),
);
+ const [noPrompt, setNoPrompt] = useState(false);
useEffect(() => {
if (!aiStore.open) {
return;
@@ -185,6 +204,7 @@ export const AiMoudle = () => {
} else {
form.setFieldsValue({ inputs: [] });
}
+ console.log('formData', aiStore.formData);
}, [aiStore.open, aiStore.formData]);
useEffect(() => {
if (!aiStore.open) {
@@ -198,12 +218,37 @@ export const AiMoudle = () => {
const data = form.getFieldsValue();
send({ type: 'messages', data: { ...data, root: true } });
};
+ const onSendNoPrompt = (value) => {
+ send({ type: 'messages', data: { message: value, root: true } });
+ };
const inputs = form.getFieldValue('inputs');
const isNotShow = inputs?.length === 0 || !inputs;
+ const OnlyNormalMessage = (
+
+ {
+ setNoPrompt(true);
+ }}>
+ 直接发送消息
+
+
+ );
+ const NeedPromptMessage = (
+
+ {
+ setNoPrompt(false);
+ }}>
+ 需要预设prompt
+
+
+ );
const RootForm = (
-
-
在当前页面,我能帮助你什么吗?
+
+
在当前页面,我能帮助你什么吗? {OnlyNormalMessage}
- {isNotShow && (
-
- 当前页面没有配置,点击
-
{
- navigate('/chat/chat-prompt/list');
- }}>
- 去配置
+ {isNotShow && !noPrompt && (
+
+
+ 当前页面没有配置,点击
+
{
+ navigate('/chat/chat-prompt/list');
+ }}>
+ 去配置
+
+
{OnlyNormalMessage}
+
+ )}
+ {noPrompt && (
+
+ {NeedPromptMessage}
+
)}
);
+
const ChatForm = (
void;
formData: any;
setFormData: (data: any) => void;
+ // Context Data
+ data: any;
+ setData: (data: any) => void;
title: string; // AI Module的标题
setTitle: (title: string) => void;
messages: { role: string; content: string }[];
@@ -73,6 +76,8 @@ export const useAiStore = create((set, get, store) => {
setFormData: (data) => set({ formData: data }),
title: '',
setTitle: (title) => set({ title }),
+ data: {},
+ setData: (data) => set({ data }),
messages: [],
setMessage: (messages) => set({ messages }),
getPrompt: async (key) => {
diff --git a/src/pages/container/edit/List.tsx b/src/pages/container/edit/List.tsx
index 54872fc..40e6fd2 100644
--- a/src/pages/container/edit/List.tsx
+++ b/src/pages/container/edit/List.tsx
@@ -158,7 +158,11 @@ export const ContainerList = () => {
-
+