From 4f5be71eb3ad9571d12b25d61fbacaf64f438801 Mon Sep 17 00:00:00 2001 From: zstar <65890619+zstar1003@users.noreply.github.com> Date: Thu, 3 Apr 2025 22:27:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(chat):=20=E6=B7=BB=E5=8A=A0=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E8=BE=93=E5=87=BA=E6=B6=88=E6=81=AF=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在聊天组件中添加了停止输出消息的功能,用户可以在消息生成过程中中断输出。同时,优化了搜索输入框的样式,隐藏了默认的搜索按钮,并替换为自定义的发送和停止按钮。 修改参照:https://github.com/infiniflow/ragflow/pull/6723/files --- .github/workflows/tests.yml | 170 ++++++++++---------- README.md | 4 + web/src/components/message-input/index.tsx | 58 +++---- web/src/hooks/logic-hooks.ts | 16 +- web/src/pages/chat/chat-container/index.tsx | 2 + web/src/pages/chat/hooks.ts | 5 + web/src/pages/chat/share/large.tsx | 2 + web/src/pages/chat/shared-hooks.ts | 3 +- web/src/pages/flow/chat/box.tsx | 2 + web/src/pages/flow/chat/hooks.ts | 5 +- web/src/pages/search/hooks.ts | 5 +- web/src/pages/search/index.less | 6 + web/src/pages/search/index.tsx | 27 +++- 13 files changed, 184 insertions(+), 121 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 016498e..43fb1b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,101 +53,101 @@ jobs: version: ">=0.8.2" args: "check" - - name: Build ragflow:nightly-slim - run: | - RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME} - sudo docker pull ubuntu:22.04 - sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim . + # - name: Build ragflow:nightly-slim + # run: | + # RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME} + # sudo docker pull ubuntu:22.04 + # sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim . - - name: Build ragflow:nightly - run: | - sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly . + # - name: Build ragflow:nightly + # run: | + # sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly . - - name: Start ragflow:nightly-slim - run: | - echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly-slim" >> docker/.env - sudo docker compose -f docker/docker-compose.yml up -d + # - name: Start ragflow:nightly-slim + # run: | + # echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly-slim" >> docker/.env + # sudo docker compose -f docker/docker-compose.yml up -d - - name: Stop ragflow:nightly-slim - if: always() # always run this step even if previous steps failed - run: | - sudo docker compose -f docker/docker-compose.yml down -v + # - name: Stop ragflow:nightly-slim + # if: always() # always run this step even if previous steps failed + # run: | + # sudo docker compose -f docker/docker-compose.yml down -v - - name: Start ragflow:nightly - run: | - echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly" >> docker/.env - sudo docker compose -f docker/docker-compose.yml up -d + # - name: Start ragflow:nightly + # run: | + # echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly" >> docker/.env + # sudo docker compose -f docker/docker-compose.yml up -d - - name: Run sdk tests against Elasticsearch - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py + # - name: Run sdk tests against Elasticsearch + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py - - name: Run frontend api tests against Elasticsearch - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py + # - name: Run frontend api tests against Elasticsearch + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py - - name: Run http api tests against Elasticsearch - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && pytest -s --tb=short -m "not slow" + # - name: Run http api tests against Elasticsearch + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && pytest -s --tb=short -m "not slow" - - name: Stop ragflow:nightly - if: always() # always run this step even if previous steps failed - run: | - sudo docker compose -f docker/docker-compose.yml down -v + # - name: Stop ragflow:nightly + # if: always() # always run this step even if previous steps failed + # run: | + # sudo docker compose -f docker/docker-compose.yml down -v - - name: Start ragflow:nightly - run: | - sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d + # - name: Start ragflow:nightly + # run: | + # sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d - - name: Run sdk tests against Infinity - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py + # - name: Run sdk tests against Infinity + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py - - name: Run frontend api tests against Infinity - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py + # - name: Run frontend api tests against Infinity + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py - - name: Run http api tests against Infinity - run: | - export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - export HOST_ADDRESS=http://host.docker.internal:9380 - until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do - echo "Waiting for service to be available..." - sleep 5 - done - cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && DOC_ENGINE=infinity pytest -s --tb=short -m "not slow" + # - name: Run http api tests against Infinity + # run: | + # export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" + # export HOST_ADDRESS=http://host.docker.internal:9380 + # until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do + # echo "Waiting for service to be available..." + # sleep 5 + # done + # cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && DOC_ENGINE=infinity pytest -s --tb=short -m "not slow" - - name: Stop ragflow:nightly - if: always() # always run this step even if previous steps failed - run: | - sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v + # - name: Stop ragflow:nightly + # if: always() # always run this step even if previous steps failed + # run: | + # sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v diff --git a/README.md b/README.md index 4b338a7..2981652 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,10 @@ This repository is available under the [Ragflow - [v3-admin-vite](https://github.com/un-pany/v3-admin-vite) +## 更新信息获取 + +主要更新日志会在我的微信公众号[我有一计]上发布,欢迎关注。 + ## Star History ![Stargazers over time](https://starchart.cc/zstar1003/ragflow-plus.svg) \ No newline at end of file diff --git a/web/src/components/message-input/index.tsx b/web/src/components/message-input/index.tsx index 6e34271..529ce73 100644 --- a/web/src/components/message-input/index.tsx +++ b/web/src/components/message-input/index.tsx @@ -11,8 +11,6 @@ import { CloseCircleOutlined, InfoCircleOutlined, LoadingOutlined, - PaperClipOutlined, - SendOutlined, } from '@ant-design/icons'; import type { GetProp, UploadFile } from 'antd'; import { @@ -29,6 +27,7 @@ import { UploadProps, } from 'antd'; import get from 'lodash/get'; +import { CircleStop, Paperclip, SendHorizontal } from 'lucide-react'; import { ChangeEventHandler, memo, @@ -72,6 +71,7 @@ interface IProps { isShared?: boolean; showUploadIcon?: boolean; createConversationBeforeUploadDocument?(message: string): Promise; + stopOutputMessage?(): void; } const getBase64 = (file: FileType): Promise => @@ -94,6 +94,7 @@ const MessageInput = ({ showUploadIcon = true, createConversationBeforeUploadDocument, uploadMethod = 'upload_and_parse', + stopOutputMessage, }: IProps) => { const { t } = useTranslate('chat'); const { removeDocument } = useRemoveNextDocument(); @@ -150,6 +151,14 @@ const MessageInput = ({ const isUploadingFile = fileList.some((x) => x.status === 'uploading'); + const handlePressEnter = useCallback(async () => { + if (isUploadingFile) return; + const ids = getFileIds(fileList.filter((x) => isUploadSuccess(x))); + + onPressEnter(ids); + setFileList([]); + }, [fileList, onPressEnter, isUploadingFile]); + const handleKeyDown = useCallback( async (event: React.KeyboardEvent) => { // check if it was shift + enter @@ -160,22 +169,9 @@ const MessageInput = ({ event.preventDefault(); handlePressEnter(); }, - [fileList, onPressEnter, isUploadingFile], + [sendDisabled, isUploadingFile, sendLoading, handlePressEnter], ); - const handlePressEnter = useCallback(async () => { - if (isUploadingFile) return; - const ids = getFileIds(fileList.filter((x) => isUploadSuccess(x))); - - onPressEnter(ids); - setFileList([]); - }, [fileList, onPressEnter, isUploadingFile]); - - const [isComposing, setIsComposing] = useState(false); - - const handleCompositionStart = () => setIsComposing(true); - const handleCompositionEnd = () => setIsComposing(false); - const handleRemove = useCallback( async (file: UploadFile) => { const ids = get(file, 'response.data', []); @@ -199,6 +195,10 @@ const MessageInput = ({ [removeDocument, deleteDocument, isShared], ); + const handleStopOutputMessage = useCallback(() => { + stopOutputMessage?.(); + }, [stopOutputMessage]); + const getDocumentInfoById = useCallback( (id: string) => { return documentInfos.find((x) => x.id === id); @@ -238,8 +238,6 @@ const MessageInput = ({ autoSize={{ minRows: 2, maxRows: 10 }} onKeyDown={handleKeyDown} onChange={onInputChange} - onCompositionStart={handleCompositionStart} - onCompositionEnd={handleCompositionEnd} /> @@ -342,18 +340,24 @@ const MessageInput = ({ }} > )} - + {sendLoading ? ( + + ) : ( + + )} diff --git a/web/src/hooks/logic-hooks.ts b/web/src/hooks/logic-hooks.ts index 2935db9..c0a3535 100644 --- a/web/src/hooks/logic-hooks.ts +++ b/web/src/hooks/logic-hooks.ts @@ -160,6 +160,11 @@ export const useSendMessageWithSse = ( const [answer, setAnswer] = useState({} as IAnswer); const [done, setDone] = useState(true); const timer = useRef(); + const sseRef = useRef(); + + const initializeSseRef = useCallback(() => { + sseRef.current = new AbortController(); + }, []); const resetAnswer = useCallback(() => { if (timer.current) { @@ -176,6 +181,7 @@ export const useSendMessageWithSse = ( body: any, controller?: AbortController, ): Promise<{ response: Response; data: ResponseType } | undefined> => { + initializeSseRef(); try { setDone(false); const response = await fetch(url, { @@ -185,7 +191,7 @@ export const useSendMessageWithSse = ( 'Content-Type': 'application/json', }, body: JSON.stringify(body), - signal: controller?.signal, + signal: controller?.signal || sseRef.current?.signal, }); const res = response.clone().json(); @@ -230,10 +236,14 @@ export const useSendMessageWithSse = ( console.warn(e); } }, - [url, resetAnswer], + [initializeSseRef, url, resetAnswer], ); - return { send, answer, done, setDone, resetAnswer }; + const stopOutputMessage = useCallback(() => { + sseRef.current?.abort(); + }, []); + + return { send, answer, done, setDone, resetAnswer, stopOutputMessage }; }; export const useSpeechWithSse = (url: string = api.tts) => { diff --git a/web/src/pages/chat/chat-container/index.tsx b/web/src/pages/chat/chat-container/index.tsx index 583536f..29b94a9 100644 --- a/web/src/pages/chat/chat-container/index.tsx +++ b/web/src/pages/chat/chat-container/index.tsx @@ -40,6 +40,7 @@ const ChatContainer = ({ controller }: IProps) => { handlePressEnter, regenerateMessage, removeMessageById, + stopOutputMessage, } = useSendNextMessage(controller); const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } = @@ -100,6 +101,7 @@ const ChatContainer = ({ controller }: IProps) => { createConversationBeforeUploadDocument={ createConversationBeforeUploadDocument } + stopOutputMessage={stopOutputMessage} > { const { setConversationIsNew, getConversationIsNew } = useSetChatRouteParams(); + const stopOutputMessage = useCallback(() => { + controller.abort(); + }, [controller]); + const sendMessage = useCallback( async ({ message, @@ -490,6 +494,7 @@ export const useSendNextMessage = (controller: AbortController) => { ref, derivedMessages, removeMessageById, + stopOutputMessage, }; }; diff --git a/web/src/pages/chat/share/large.tsx b/web/src/pages/chat/share/large.tsx index 671534c..dfdd8c5 100644 --- a/web/src/pages/chat/share/large.tsx +++ b/web/src/pages/chat/share/large.tsx @@ -37,6 +37,7 @@ const ChatContainer = () => { ref, derivedMessages, hasError, + stopOutputMessage, } = useSendSharedMessage(); const sendDisabled = useSendButtonDisabled(value); @@ -105,6 +106,7 @@ const ChatContainer = () => { sendLoading={sendLoading} uploadMethod="external_upload_and_parse" showUploadIcon={false} + stopOutputMessage={stopOutputMessage} > {visible && ( diff --git a/web/src/pages/chat/shared-hooks.ts b/web/src/pages/chat/shared-hooks.ts index ba05814..03906b1 100644 --- a/web/src/pages/chat/shared-hooks.ts +++ b/web/src/pages/chat/shared-hooks.ts @@ -49,7 +49,7 @@ export const useSendSharedMessage = () => { const { createSharedConversation: setConversation } = useCreateNextSharedConversation(); const { handleInputChange, value, setValue } = useHandleMessageInputChange(); - const { send, answer, done } = useSendMessageWithSse( + const { send, answer, done, stopOutputMessage } = useSendMessageWithSse( `/api/v1/${from === SharedFrom.Agent ? 'agentbots' : 'chatbots'}/${conversationId}/completions`, ); const { @@ -144,5 +144,6 @@ export const useSendSharedMessage = () => { loading: false, derivedMessages, hasError, + stopOutputMessage, }; }; diff --git a/web/src/pages/flow/chat/box.tsx b/web/src/pages/flow/chat/box.tsx index e9ffba7..a719613 100644 --- a/web/src/pages/flow/chat/box.tsx +++ b/web/src/pages/flow/chat/box.tsx @@ -24,6 +24,7 @@ const FlowChatBox = () => { ref, derivedMessages, reference, + stopOutputMessage, } = useSendNextMessage(); const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } = @@ -75,6 +76,7 @@ const FlowChatBox = () => { conversationId="" onPressEnter={handlePressEnter} onInputChange={handleInputChange} + stopOutputMessage={stopOutputMessage} /> { const { handleInputChange, value, setValue } = useHandleMessageInputChange(); const { refetch } = useFetchFlow(); - const { send, answer, done } = useSendMessageWithSse(api.runCanvas); + const { send, answer, done, stopOutputMessage } = useSendMessageWithSse( + api.runCanvas, + ); const sendMessage = useCallback( async ({ message }: { message: Message; messages?: Message[] }) => { @@ -134,5 +136,6 @@ export const useSendNextMessage = () => { derivedMessages, ref, removeMessageById, + stopOutputMessage, }; }; diff --git a/web/src/pages/search/hooks.ts b/web/src/pages/search/hooks.ts index 20546e0..89c6f41 100644 --- a/web/src/pages/search/hooks.ts +++ b/web/src/pages/search/hooks.ts @@ -17,7 +17,9 @@ import { } from 'react'; export const useSendQuestion = (kbIds: string[]) => { - const { send, answer, done } = useSendMessageWithSse(api.ask); + const { send, answer, done, stopOutputMessage } = useSendMessageWithSse( + api.ask, + ); const { testChunk, loading } = useTestChunkRetrieval(); const [sendingLoading, setSendingLoading] = useState(false); const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer); @@ -116,6 +118,7 @@ export const useSendQuestion = (kbIds: string[]) => { isFirstRender, selectedDocumentIds, isSearchStrEmpty: isEmpty(trim(searchStr)), + stopOutputMessage, }; }; diff --git a/web/src/pages/search/index.less b/web/src/pages/search/index.less index 967a837..d632bce 100644 --- a/web/src/pages/search/index.less +++ b/web/src/pages/search/index.less @@ -137,6 +137,12 @@ .input(); } +.searchInput { + :global(.ant-input-search-button) { + display: none; + } +} + .appIcon { display: inline-block; vertical-align: middle; diff --git a/web/src/pages/search/index.tsx b/web/src/pages/search/index.tsx index b9d12f7..db19e82 100644 --- a/web/src/pages/search/index.tsx +++ b/web/src/pages/search/index.tsx @@ -12,6 +12,7 @@ import { import { useGetPaginationWithRouter } from '@/hooks/logic-hooks'; import { IReference } from '@/interfaces/database/chat'; import { + Button, Card, Divider, Flex, @@ -28,9 +29,11 @@ import { Tag, Tooltip, } from 'antd'; +import classNames from 'classnames'; import DOMPurify from 'dompurify'; import { isEmpty } from 'lodash'; -import { useMemo, useState } from 'react'; +import { CircleStop, SendHorizontal } from 'lucide-react'; +import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import MarkdownContent from '../chat/markdown-content'; import { useSendQuestion, useShowMindMapDrawer } from './hooks'; @@ -64,6 +67,7 @@ const SearchPage = () => { isFirstRender, selectedDocumentIds, isSearchStrEmpty, + stopOutputMessage, } = useSendQuestion(checkedWithoutEmbeddingIdList); const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } = useClickDrawer(); @@ -81,18 +85,35 @@ const SearchPage = () => { handleTestChunk(selectedDocumentIds, pageNumber, pageSize); }; + const handleSearch = useCallback(() => { + sendQuestion(searchStr); + }, [searchStr, sendQuestion]); + const InputSearch = ( + + + ) : ( + + ) + } onSearch={sendQuestion} size="large" loading={sendingLoading} disabled={checkedWithoutEmbeddingIdList.length === 0} - className={isFirstRender ? styles.globalInput : styles.partialInput} + className={classNames( + styles.searchInput, + isFirstRender ? styles.globalInput : styles.partialInput, + )} /> );