From 9d3eb6d925ce4781381b9c2ce12d1c69132cc3ac Mon Sep 17 00:00:00 2001 From: imeepos Date: Tue, 22 Jul 2025 18:06:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96markdown=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/infrastructure/gemini_service.rs | 2 +- apps/desktop/src/components/ChatInterface.tsx | 2 + .../src/components/EnhancedChatMessageV2.tsx | 10 +++- apps/desktop/src/components/ImageCard.tsx | 56 +++++++++++++------ 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/apps/desktop/src-tauri/src/infrastructure/gemini_service.rs b/apps/desktop/src-tauri/src/infrastructure/gemini_service.rs index 46cccfa..156d7af 100644 --- a/apps/desktop/src-tauri/src/infrastructure/gemini_service.rs +++ b/apps/desktop/src-tauri/src/infrastructure/gemini_service.rs @@ -14,7 +14,7 @@ use std::sync::{Arc, Mutex}; // 导入会话管理相关模块 use crate::data::models::conversation::{ ConversationMessage, MessageRole, MessageContent, ConversationHistoryQuery, - CreateConversationSessionRequest, AddMessageRequest, + AddMessageRequest, }; use crate::data::repositories::conversation_repository::ConversationRepository; diff --git a/apps/desktop/src/components/ChatInterface.tsx b/apps/desktop/src/components/ChatInterface.tsx index af95287..7ad0322 100644 --- a/apps/desktop/src/components/ChatInterface.tsx +++ b/apps/desktop/src/components/ChatInterface.tsx @@ -401,6 +401,8 @@ export const ChatInterface: React.FC = ({ showSources={showSources} enableMaterialCards={enableImageCards} enableReferences={true} + selectedTags={selectedTags} + onTagClick={toggleTag} /> ))} diff --git a/apps/desktop/src/components/EnhancedChatMessageV2.tsx b/apps/desktop/src/components/EnhancedChatMessageV2.tsx index faf1a24..7319b8e 100644 --- a/apps/desktop/src/components/EnhancedChatMessageV2.tsx +++ b/apps/desktop/src/components/EnhancedChatMessageV2.tsx @@ -47,6 +47,10 @@ interface EnhancedChatMessageV2Props { enableReferences?: boolean; /** 自定义样式类名 */ className?: string; + /** 已选中的标签列表 */ + selectedTags?: string[]; + /** 标签点击回调 */ + onTagClick?: (tag: string) => void; } /** @@ -58,7 +62,9 @@ export const EnhancedChatMessageV2: React.FC = ({ showSources = true, enableMaterialCards = true, enableReferences = true, - className = '' + className = '', + selectedTags = [], + onTagClick }) => { const [copied, setCopied] = useState(false); const [expandedSources, setExpandedSources] = useState(false); @@ -205,6 +211,8 @@ export const EnhancedChatMessageV2: React.FC = ({ showDetails={true} className="cursor-pointer" onViewLarge={() => handleMaterialClick(source as GroundingSource)} + selectedTags={selectedTags} + onTagClick={onTagClick} /> ))} diff --git a/apps/desktop/src/components/ImageCard.tsx b/apps/desktop/src/components/ImageCard.tsx index 443bffc..3a9e3d5 100644 --- a/apps/desktop/src/components/ImageCard.tsx +++ b/apps/desktop/src/components/ImageCard.tsx @@ -34,6 +34,10 @@ interface ImageCardProps { onViewLarge?: (source: GroundingSource) => void; /** 自定义样式类名 */ className?: string; + /** 已选中的标签列表 */ + selectedTags?: string[]; + /** 标签点击回调 */ + onTagClick?: (tag: string) => void; } /** @@ -46,7 +50,9 @@ export const ImageCard: React.FC = ({ position, onClose, onDownload, - className = '' + className = '', + selectedTags = [], + onTagClick }) => { const [imageLoaded, setImageLoaded] = useState(false); const [imageError, setImageError] = useState(false); @@ -186,14 +192,22 @@ export const ImageCard: React.FC = ({
- {(expandedEnvironmentTags ? environmentTags : environmentTags.slice(0, 2)).map((tag: string, index: number) => ( - - {tag} - - ))} + {(expandedEnvironmentTags ? environmentTags : environmentTags.slice(0, 2)).map((tag: string, index: number) => { + const isSelected = selectedTags.includes(tag); + return ( + + ); + })} {environmentTags.length > 2 && ( + ); + })} {categories.length > 2 && (