fix: resolve TypeScript iterator error in OutfitRecommendationTool

- Fixed type error where response.recommendations could be undefined
- Added null coalescing operator to ensure safe array spreading
- Updated OutfitRecommendationCard and capabilities configuration
This commit is contained in:
imeepos 2025-07-28 11:56:11 +08:00
parent 2f845db6ac
commit 5c019b48df
3 changed files with 2 additions and 9 deletions

View File

@ -9,6 +9,7 @@
"core:window:allow-center", "core:window:allow-center",
"core:window:allow-set-position", "core:window:allow-set-position",
"core:window:allow-set-resizable", "core:window:allow-set-resizable",
"core:window:allow-set-min-size",
"opener:default", "opener:default",
"opener:allow-open-path", "opener:allow-open-path",
"opener:allow-reveal-item-in-dir", "opener:allow-reveal-item-in-dir",

View File

@ -102,14 +102,6 @@ export const OutfitRecommendationCard: React.FC<OutfitRecommendationCardProps> =
{/* 装饰性背景 */} {/* 装饰性背景 */}
<div className="absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-primary-100 to-primary-200 rounded-full -translate-y-12 translate-x-12 opacity-40 group-hover:opacity-60 transition-all duration-500 group-hover:scale-110"></div> <div className="absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-primary-100 to-primary-200 rounded-full -translate-y-12 translate-x-12 opacity-40 group-hover:opacity-60 transition-all duration-500 group-hover:scale-110"></div>
{/* 顶部标识 */}
<div className="absolute top-3 right-3 flex items-center gap-2">
<div className="flex items-center gap-1 px-2 py-1 bg-primary-100 text-primary-700 rounded-full text-xs font-medium">
<Sparkles className="w-3 h-3" />
AI推荐
</div>
</div>
<div className="relative"> <div className="relative">
{/* 标题和描述 */} {/* 标题和描述 */}
<div className="mb-4"> <div className="mb-4">

View File

@ -142,7 +142,7 @@ const OutfitRecommendationTool: React.FC = () => {
if (group.group_id === groupId) { if (group.group_id === groupId) {
return { return {
...group, ...group,
children: [...group.children, ...response.recommendations] children: [...group.children, ...(response.recommendations || [])]
}; };
} }
return group; return group;