mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-02 22:07:31 +08:00
### What problem does this PR solve? Feat: Add a think button to the chat box. #12742 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { NextMessageInputOnPressEnterParameter } from '@/components/message-input/next';
|
||||
import sonnerMessage from '@/components/ui/message';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import {
|
||||
@@ -289,6 +290,7 @@ export const useSendAgentMessage = ({
|
||||
params.files = uploadResponseList;
|
||||
|
||||
params.session_id = sessionId;
|
||||
params.reasoning = message.reasoning;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -355,28 +357,31 @@ export const useSendAgentMessage = ({
|
||||
removeAllMessagesExceptFirst,
|
||||
]);
|
||||
|
||||
const handlePressEnter = useCallback(() => {
|
||||
if (trim(value) === '') return;
|
||||
const msgBody = buildRequestBody(value);
|
||||
if (done) {
|
||||
setValue('');
|
||||
sendMessage({
|
||||
message: msgBody,
|
||||
});
|
||||
}
|
||||
addNewestOneQuestion({ ...msgBody, files: fileList });
|
||||
setTimeout(() => {
|
||||
scrollToBottom();
|
||||
}, 100);
|
||||
}, [
|
||||
value,
|
||||
done,
|
||||
addNewestOneQuestion,
|
||||
fileList,
|
||||
setValue,
|
||||
sendMessage,
|
||||
scrollToBottom,
|
||||
]);
|
||||
const handlePressEnter = useCallback(
|
||||
(...[{ enableThinking }]: NextMessageInputOnPressEnterParameter) => {
|
||||
if (trim(value) === '') return;
|
||||
const msgBody = buildRequestBody(value);
|
||||
if (done) {
|
||||
setValue('');
|
||||
sendMessage({
|
||||
message: { ...msgBody, reasoning: enableThinking },
|
||||
});
|
||||
}
|
||||
addNewestOneQuestion({ ...msgBody, files: fileList });
|
||||
setTimeout(() => {
|
||||
scrollToBottom();
|
||||
}, 100);
|
||||
},
|
||||
[
|
||||
value,
|
||||
done,
|
||||
addNewestOneQuestion,
|
||||
fileList,
|
||||
setValue,
|
||||
sendMessage,
|
||||
scrollToBottom,
|
||||
],
|
||||
);
|
||||
|
||||
const sendedTaskMessage = useRef<boolean>(false);
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ const DebugContent = ({
|
||||
render={({ field }) => (
|
||||
<div className="space-y-6">
|
||||
<FormItem className="w-full">
|
||||
<FormLabel>{t('assistantAvatar')}</FormLabel>
|
||||
<FormLabel>{props.label}</FormLabel>
|
||||
<FormControl>
|
||||
<FileUploadDirectUpload
|
||||
value={field.value}
|
||||
@@ -218,7 +218,7 @@ const DebugContent = ({
|
||||
BeginQueryTypeMap[BeginQueryType.Paragraph]
|
||||
);
|
||||
},
|
||||
[form, t],
|
||||
[form],
|
||||
);
|
||||
|
||||
const onSubmit = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user