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
|
return iodSearch && messages.length > 0 && !iodLoading
|
||||||
}, [iodSearch, messages, iodLoading])
|
}, [iodSearch, messages, iodLoading])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
const currentMessage = messages?.find(
|
const currentMessage = messages?.find(
|
||||||
(message) => message.id === currentMessageId
|
(message) => message.id === currentMessageId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const text = (iodSearch && iodLoading) ? '正' : '已'
|
||||||
|
const text2 = (iodSearch && iodLoading) ? '进行' : '完成'
|
||||||
|
const text3 = (iodSearch && iodLoading) ? '……' : ''
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: (
|
title: (
|
||||||
<p className="font-extrabold">
|
<p className="font-extrabold">
|
||||||
已在
|
{text}在
|
||||||
<span className="text-[#f00000]">
|
<span className="text-[#f00000]">
|
||||||
<CountUp end={29} duration={2.5} separator="," />个
|
<CountUp end={29} duration={2.5} separator="," />个
|
||||||
</span>
|
</span>
|
||||||
@ -250,7 +256,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
|||||||
<CountUp decimals={1} end={53.7} duration={2.5} separator="," />
|
<CountUp decimals={1} end={53.7} duration={2.5} separator="," />
|
||||||
万个
|
万个
|
||||||
</span>
|
</span>
|
||||||
科学数据集中进行搜索
|
科学数据集中{text2}搜索{text3}
|
||||||
</p>
|
</p>
|
||||||
),
|
),
|
||||||
description: showSearchData ? (
|
description: showSearchData ? (
|
||||||
@ -274,7 +280,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
|||||||
{
|
{
|
||||||
title: (
|
title: (
|
||||||
<p className="font-extrabold">
|
<p className="font-extrabold">
|
||||||
已在
|
{text}在
|
||||||
<span className="text-[#f00000]">
|
<span className="text-[#f00000]">
|
||||||
<CountUp end={138} duration={2.5} separator="," />
|
<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="," />
|
<CountUp end={18.3} decimals={1} duration={2.5} separator="," />
|
||||||
万个
|
万个
|
||||||
</span>
|
</span>
|
||||||
数据项目中进行搜索
|
数据项目中{text2}搜索{text3}
|
||||||
</p>
|
</p>
|
||||||
),
|
),
|
||||||
description: showSearchData ? (
|
description: showSearchData ? (
|
||||||
@ -308,7 +314,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
|||||||
{
|
{
|
||||||
title: (
|
title: (
|
||||||
<p className="font-extrabold">
|
<p className="font-extrabold">
|
||||||
已在
|
{text}在
|
||||||
<span className="text-[#f00000]">
|
<span className="text-[#f00000]">
|
||||||
<CountUp end={763} duration={2.5} separator="," />家
|
<CountUp end={763} duration={2.5} separator="," />家
|
||||||
</span>
|
</span>
|
||||||
@ -322,7 +328,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
|
|||||||
{" "}
|
{" "}
|
||||||
<CountUp end={2} duration={2.5} separator="," />万
|
<CountUp end={2} duration={2.5} separator="," />万
|
||||||
</span>
|
</span>
|
||||||
科技人才中进行搜索
|
科技人才中{text2}搜索{text3}
|
||||||
</p>
|
</p>
|
||||||
),
|
),
|
||||||
description: showSearchData ? (
|
description: showSearchData ? (
|
||||||
|
@ -507,7 +507,7 @@ export const useMessage = () => {
|
|||||||
content: fullText
|
content: fullText
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
debugger
|
||||||
await saveMessageOnSuccess({
|
await saveMessageOnSuccess({
|
||||||
historyId,
|
historyId,
|
||||||
setHistoryId,
|
setHistoryId,
|
||||||
|
@ -271,7 +271,7 @@ export const updateDialog = async function (
|
|||||||
traceId: r?.traceId
|
traceId: r?.traceId
|
||||||
})) ?? []
|
})) ?? []
|
||||||
updateBody.IoDSources =
|
updateBody.IoDSources =
|
||||||
botMessage.iodSources?.map((r) => ({
|
Object.values( botMessage.iodSources as AllIodRegistryEntry).flatMap(iod => iod.data)?.map((r) => ({
|
||||||
id: r.doId,
|
id: r.doId,
|
||||||
tokenCount:
|
tokenCount:
|
||||||
r.content || r.description
|
r.content || r.description
|
||||||
|
Loading…
x
Reference in New Issue
Block a user