chat-excel.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import { ChatContext } from '@/app/chat-context';
  2. import { LinkOutlined } from '@ant-design/icons';
  3. import { useContext } from 'react';
  4. import ExcelUpload from './excel-upload';
  5. interface Props {
  6. onComplete?: () => void;
  7. }
  8. function ChatExcel({ onComplete }: Props) {
  9. const { currentDialogue, scene, chatId } = useContext(ChatContext);
  10. if (scene !== 'chat_excel') return null;
  11. return (
  12. <div className='max-w-md h-full relative'>
  13. {currentDialogue ? (
  14. <div className='flex h-8 overflow-hidden rounded'>
  15. <div className='flex items-center justify-center px-2 bg-gray-600 text-lg'>
  16. <LinkOutlined className='text-white' />
  17. </div>
  18. <div className='flex items-center justify-center px-3 bg-gray-100 text-xs rounded-tr rounded-br dark:text-gray-800 truncate'>
  19. {currentDialogue.select_param}
  20. </div>
  21. </div>
  22. ) : (
  23. <ExcelUpload convUid={chatId} chatMode={scene} onComplete={onComplete} />
  24. )}
  25. </div>
  26. );
  27. }
  28. export default ChatExcel;