### What problem does this PR solve? feat: Hide the upload button in the external agent's chat box #1880 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import MessageInput from '@/components/message-input';
|
||||
import MessageItem from '@/components/message-item';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { MessageType, SharedFrom } from '@/constants/chat';
|
||||
import { useSendButtonDisabled } from '@/pages/chat/hooks';
|
||||
import { Flex, Spin } from 'antd';
|
||||
import { forwardRef } from 'react';
|
||||
import {
|
||||
useCreateSharedConversationOnMount,
|
||||
useGetSharedChatSearchParams,
|
||||
useSelectCurrentSharedConversation,
|
||||
useSendSharedMessage,
|
||||
} from '../shared-hooks';
|
||||
@@ -37,6 +38,7 @@ const ChatContainer = () => {
|
||||
addNewestAnswer,
|
||||
);
|
||||
const sendDisabled = useSendButtonDisabled(value);
|
||||
const { from } = useGetSharedChatSearchParams();
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -74,6 +76,7 @@ const ChatContainer = () => {
|
||||
onPressEnter={handlePressEnter}
|
||||
sendLoading={sendLoading}
|
||||
uploadUrl="/v1/api/document/upload_and_parse"
|
||||
showUploadIcon={from === SharedFrom.Chat}
|
||||
></MessageInput>
|
||||
</Flex>
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { MessageType, SharedFrom } from '@/constants/chat';
|
||||
import {
|
||||
useCreateSharedConversation,
|
||||
useFetchSharedConversation,
|
||||
@@ -225,3 +225,12 @@ export const useSendSharedMessage = (
|
||||
loading: !done,
|
||||
};
|
||||
};
|
||||
|
||||
export const useGetSharedChatSearchParams = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
return {
|
||||
from: searchParams.get('from') as SharedFrom,
|
||||
sharedId: searchParams.get('shared_id'),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user