From 0d154572992a64be18e050dcef309978733f692e Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 1 Apr 2026 17:11:36 +0800 Subject: [PATCH] feat(web): memory validation add perceptual_retrieve log --- web/src/i18n/en.ts | 2 +- web/src/i18n/zh.ts | 2 +- web/src/views/MemoryConversation/index.tsx | 95 ++++++++++++++++++---- 3 files changed, 82 insertions(+), 17 deletions(-) diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index 8c5f6237..829def52 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -195,7 +195,7 @@ export const en = { createNewApplicationDesc: 'Build an app in 3 minutes, no code.', createNewKnowledge: 'Create New Knowledge', createNewKnowledgeDesc: 'Create a searchable knowledge base instantly.', - memoryConversation: 'Memory Conversation', + memoryConversation: 'Memory Validation', memoryConversationDesc: 'The more you use it, the better AI knows you.', helpCenter: 'Help Center', helpCenterDesc: 'One place to get help and start fast.', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index c50d86ed..4c181adf 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -906,7 +906,7 @@ export const zh = { createNewApplicationDesc: '零代码,3 分钟搭建应用', createNewKnowledge: '创建知识库', createNewKnowledgeDesc: '秒级生成可搜索知识库', - memoryConversation: '记忆对话', + memoryConversation: '记忆验证', memoryConversationDesc: '越用越懂你的 AI', helpCenter: '帮助中心', helpCenterDesc: '一站式上手与支持', diff --git a/web/src/views/MemoryConversation/index.tsx b/web/src/views/MemoryConversation/index.tsx index 5aace0a8..a5f3592e 100644 --- a/web/src/views/MemoryConversation/index.tsx +++ b/web/src/views/MemoryConversation/index.tsx @@ -10,9 +10,9 @@ * Supports deep thinking, normal reply, and quick reply modes */ -import { type FC, type ReactNode, useState, useEffect } from 'react' +import { type FC, type ReactNode, useState } from 'react' import { useTranslation } from 'react-i18next' -import { Col, Row, App, Skeleton, Segmented, Tooltip, Flex } from 'antd' +import { Col, Row, App, Skeleton, Segmented, Tooltip, Flex, Image } from 'antd' import dayjs from 'dayjs' import type { AnyObject } from 'antd/es/_util/type'; @@ -29,6 +29,8 @@ import type { ChatItem } from '@/components/Chat/types' import RbCard from '@/components/RbCard/Card'; import styles from './index.module.css' import ResultCard from '@/components/RbCard/ResultCard' +import AudioPlayer from '@/views/UserMemoryDetail/components/AudioPlayer' +import VideoPlayer from '@/views/UserMemoryDetail/components/VideoPlayer' /** Search mode configuration */ @@ -92,6 +94,7 @@ export interface LogItem { result?: string; original_query: string; index?: number; + result_count?: number; } /** @@ -144,6 +147,10 @@ const MemoryConversation: FC = () => { const handleChange = (value: string) => { setSearchSwitch(value) } + const handleDownload = (file_path?: string) => { + if (!file_path) return + window.open(file_path, '_blank') + } return ( <> @@ -168,7 +175,7 @@ const MemoryConversation: FC = () => { - + { - + { <>
{vo.id}. {vo.question}
-
{vo.reason}
+
{vo.reason}
))} @@ -247,7 +254,7 @@ const MemoryConversation: FC = () => { <>
{key}
{(log.data as Record)[key].map((item, index) => ( -
{item}
+
{item}
))} @@ -257,16 +264,16 @@ const MemoryConversation: FC = () => { ?
{log.query}
{(log.raw_results.reranked_results as AnyObject)?.communities?.length > 0 && <> -
{t('memoryConversation.communities')}
-
    +
    {t('memoryConversation.communities')}
    +
      {((log.raw_results.reranked_results as AnyObject)?.communities as { content: string }[]).map((item, index: number) => (
    • {item.content}
    • ))}
    } {(log.raw_results.reranked_results as AnyObject)?.summaries?.length > 0 && <> -
    {t('memoryConversation.summaries')}
    -
      +
      {t('memoryConversation.summaries')}
      +
        {((log.raw_results.reranked_results as AnyObject)?.summaries as { content: string }[]).map((item, index: number) => (
      • {item.content}
      • ))} @@ -280,8 +287,8 @@ const MemoryConversation: FC = () => { : log.type === 'verification' ?
        {log.query}
        -
        {log.reason}
        -
        {log.result}
        +
        {log.reason}
        +
        {log.result}
        : log.type === 'output_type' ? @@ -291,8 +298,8 @@ const MemoryConversation: FC = () => { : log.type === 'input_summary' && log.raw_results ?
        {log.query}
        -
        {log.summary}
        -
        +
        {log.summary}
        +
        {typeof log.raw_results === 'string' ? : <> @@ -306,7 +313,65 @@ const MemoryConversation: FC = () => { }
        - : null + : log.type === 'perceptual_retrieve' && log.data && log.data?.length > 0 + ? + {log.data.map((vo: any) => ( + + + {vo.file_path + ? <> + {/(jpg|jpeg|png|gif|webp|svg)$/i.test(vo.file_type) + ? {vo.file_name} + : /(mp4|webm|ogg|mov)$/i.test(vo.file_type) + ? + : /(mp3|wav|ogg|m4a|aac)$/i.test(vo.file_type) + ? + : + +
        +
        +
        {vo.file_name}
        +
        + - +
        +
        +
        +
        handleDownload(vo.file_path)} + >
        +
        + } + + :
        + +
        + } + {['summary', 'keywords', 'topic', 'domain', 'scene', 'speaker_count', 'section_count'].map(key => { + const value = vo[key] + if (value) { + return ( +
        +
        {t(`perceptualDetail.${key}`)}
        + + {typeof value === 'string' + ?
        {value}
        + : Array.isArray(value) + ? + {value.map((vo, index) =>
        {vo}
        )} +
        + : '-' + } +
        + ) + } + return null + })} +
        +
        + ))} +
        + : null } ))}