refactor(web): 优化 IOD 相关组件和 hooks
- 修改 IodRelevant 组件,根据搜索状态动态显示文本 - 更新 useMessage hook,添加调试断点 - 重构 iod.ts 中的 IoDSources 处理逻辑
This commit is contained in:
parent
ecb90d9035
commit
cb6c3c225b
@ -228,15 +228,21 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
return iodSearch && messages.length > 0 && !iodLoading
|
||||
}, [iodSearch, messages, iodLoading])
|
||||
|
||||
|
||||
|
||||
const data = useMemo(() => {
|
||||
const currentMessage = messages?.find(
|
||||
(message) => message.id === currentMessageId
|
||||
)
|
||||
|
||||
const text = (iodSearch && iodLoading) ? '正' : '已'
|
||||
const text2 = (iodSearch && iodLoading) ? '进行' : '完成'
|
||||
const text3 = (iodSearch && iodLoading) ? '……' : ''
|
||||
return [
|
||||
{
|
||||
title: (
|
||||
<p className="font-extrabold">
|
||||
已在
|
||||
{text}在
|
||||
<span className="text-[#f00000]">
|
||||
<CountUp end={29} duration={2.5} separator="," />个
|
||||
</span>
|
||||
@ -250,7 +256,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
<CountUp decimals={1} end={53.7} duration={2.5} separator="," />
|
||||
万个
|
||||
</span>
|
||||
科学数据集中进行搜索
|
||||
科学数据集中{text2}搜索{text3}
|
||||
</p>
|
||||
),
|
||||
description: showSearchData ? (
|
||||
@ -274,7 +280,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
{
|
||||
title: (
|
||||
<p className="font-extrabold">
|
||||
已在
|
||||
{text}在
|
||||
<span className="text-[#f00000]">
|
||||
<CountUp end={138} duration={2.5} separator="," />
|
||||
万篇
|
||||
@ -284,7 +290,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
<CountUp end={18.3} decimals={1} duration={2.5} separator="," />
|
||||
万个
|
||||
</span>
|
||||
数据项目中进行搜索
|
||||
数据项目中{text2}搜索{text3}
|
||||
</p>
|
||||
),
|
||||
description: showSearchData ? (
|
||||
@ -308,7 +314,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
{
|
||||
title: (
|
||||
<p className="font-extrabold">
|
||||
已在
|
||||
{text}在
|
||||
<span className="text-[#f00000]">
|
||||
<CountUp end={763} duration={2.5} separator="," />家
|
||||
</span>
|
||||
@ -322,7 +328,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
||||
{" "}
|
||||
<CountUp end={2} duration={2.5} separator="," />万
|
||||
</span>
|
||||
科技人才中进行搜索
|
||||
科技人才中{text2}搜索{text3}
|
||||
</p>
|
||||
),
|
||||
description: showSearchData ? (
|
||||
|
@ -507,7 +507,7 @@ export const useMessage = () => {
|
||||
content: fullText
|
||||
}
|
||||
])
|
||||
|
||||
debugger
|
||||
await saveMessageOnSuccess({
|
||||
historyId,
|
||||
setHistoryId,
|
||||
|
@ -271,7 +271,7 @@ export const updateDialog = async function (
|
||||
traceId: r?.traceId
|
||||
})) ?? []
|
||||
updateBody.IoDSources =
|
||||
botMessage.iodSources?.map((r) => ({
|
||||
Object.values( botMessage.iodSources as AllIodRegistryEntry).flatMap(iod => iod.data)?.map((r) => ({
|
||||
id: r.doId,
|
||||
tokenCount:
|
||||
r.content || r.description
|
||||
|
Loading…
x
Reference in New Issue
Block a user