|
|
|
@ -2,7 +2,7 @@ import { apiInterceptors, collectApp, unCollectApp } from '@/client/api'; |
|
|
|
|
import { ChatContentContext } from '@/pages/chat'; |
|
|
|
|
import { ExportOutlined, LoadingOutlined, StarFilled, StarOutlined, createFromIconfontCN } from '@ant-design/icons'; |
|
|
|
|
import { useRequest } from 'ahooks'; |
|
|
|
|
import { Spin, Tag, Typography, message } from 'antd'; |
|
|
|
|
import { Spin, Tag, Typography, message, Tooltip } from 'antd'; |
|
|
|
|
import copy from 'copy-to-clipboard'; |
|
|
|
|
import React, { useContext, useMemo } from 'react'; |
|
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
@ -145,7 +145,7 @@ const ChatHeader: React.FC<{ isScrollToTop: boolean }> = ({ isScrollToTop }) => |
|
|
|
|
// 吸顶header
|
|
|
|
|
const topHeaderContent = () => { |
|
|
|
|
return ( |
|
|
|
|
<header className='flex items-center border-1 border-b border-[#eee] justify-between w-full h-14 bg-[rgba(255,255,255,0.9)] dark:bg-[rgba(41,63,89,0.9)] px-8 transition-all duration-500 ease-in-out'> |
|
|
|
|
<header className='flex items-center border-b border-[#e3e3e3] justify-between w-full h-14 bg-[rgba(255,255,255,0.9)] dark:bg-[rgba(41,63,89,0.9)] px-8 transition-all duration-500 ease-in-out'> |
|
|
|
|
<div className='flex items-center'> |
|
|
|
|
<div className='flex items-center justify-center w-8 h-8 rounded-lg mr-2 bg-white'> |
|
|
|
|
<AppDefaultIcon scene={appScene} /> |
|
|
|
@ -195,15 +195,51 @@ const ChatHeader: React.FC<{ isScrollToTop: boolean }> = ({ isScrollToTop }) => |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
{!!appInfo?.recommend_questions?.length && ( |
|
|
|
|
<div className='absolute flex justify-start items-start bottom-[-3.75rem] left-[50%] w-full transform translate-x-[-50%] pt-1 px-20 overflow-hidden bg-[rgba(255,255,255,0.9)] dark:bg-[rgba(41,63,89,0.9)]'> |
|
|
|
|
<span className='text-xs text-[#333333] dark:text-[rgba(255,255,255,0.65)] leading-6 w-[100px] flex-none'>或许你想问:</span> |
|
|
|
|
<div className='flex flex-wrap gap-1 overflow-scroll flex-1 h-14'> |
|
|
|
|
{appInfo.recommend_questions.map((item, index) => ( |
|
|
|
|
<Tooltip key={item.id} title={item.question}> |
|
|
|
|
<Tag |
|
|
|
|
key={item.id} |
|
|
|
|
color={tagColors[index]} |
|
|
|
|
className='text-xs p-0.5 px-1 cursor-pointer w-40 truncate' |
|
|
|
|
onClick={async () => { |
|
|
|
|
handleChat(item?.question || '', { |
|
|
|
|
app_code: appInfo.app_code, |
|
|
|
|
...(paramKey.includes('temperature') && { temperature: temperatureValue }), |
|
|
|
|
...(paramKey.includes('resource') && { |
|
|
|
|
select_param: |
|
|
|
|
typeof resourceValue === 'string' |
|
|
|
|
? resourceValue |
|
|
|
|
: JSON.stringify(resourceValue) || currentDialogue.select_param, |
|
|
|
|
}), |
|
|
|
|
}); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
scrollRef.current?.scrollTo({ |
|
|
|
|
top: scrollRef.current?.scrollHeight, |
|
|
|
|
behavior: 'smooth', |
|
|
|
|
}); |
|
|
|
|
}, 0); |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{item.question} |
|
|
|
|
</Tag> |
|
|
|
|
</Tooltip> |
|
|
|
|
))} |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
</header> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
className={`h-14 ${ |
|
|
|
|
appInfo?.recommend_questions && appInfo?.recommend_questions?.length > 0 ? 'mb-6' : '' |
|
|
|
|
} sticky top-0 z-30 transition-all duration-400 ease-in-out`}
|
|
|
|
|
className={`h-14 ${appInfo?.recommend_questions && appInfo?.recommend_questions?.length > 0 ? 'mb-6' : '' |
|
|
|
|
} sticky top-0 z-30 transition-all duration-400 ease-in-out`}
|
|
|
|
|
> |
|
|
|
|
{topHeaderContent()} |
|
|
|
|
</div> |
|
|
|
|