fix: resolve compilation errors in advanced filter integration
- Fixed AdvancedFilterPanel import issues by removing unused DEFAULT_COLOR_FILTER - Fixed EnvironmentTagSelector type errors with proper Record<string, string[]> typing - Fixed SimilaritySearchTool executeSearch call by providing required SimilaritySearchRequest parameter - Fixed intelligentSearchService mergeSearchConfigs by adding missing SearchConfig fields: * debug_mode, custom_filters, query_enhancement_enabled, color_thresholds - Made availableEnvironments optional in EnvironmentTagSelector props - Updated type definitions to support enhanced search configuration All compilation errors resolved, build now passes successfully.
This commit is contained in:
parent
2b209e5ad2
commit
a1c40a13ad
|
|
@ -1,11 +1,10 @@
|
|||
import React, { useState, useCallback } from 'react';
|
||||
import {
|
||||
SearchConfig,
|
||||
ColorFilter,
|
||||
COMMON_CATEGORIES,
|
||||
COMMON_ENVIRONMENTS,
|
||||
COMMON_DESIGN_STYLES,
|
||||
DEFAULT_COLOR_FILTER
|
||||
import {
|
||||
SearchConfig,
|
||||
ColorFilter,
|
||||
COMMON_CATEGORIES,
|
||||
COMMON_ENVIRONMENTS,
|
||||
COMMON_DESIGN_STYLES
|
||||
} from '../../types/outfitSearch';
|
||||
import { CategoryFilterSelector } from './CategoryFilterSelector';
|
||||
import { EnvironmentTagSelector } from './EnvironmentTagSelector';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { MapPin, Plus, X, Search, Tag } from 'lucide-react';
|
|||
|
||||
interface EnvironmentTagSelectorProps {
|
||||
selectedEnvironments: string[];
|
||||
availableEnvironments: string[];
|
||||
availableEnvironments?: string[]; // 现在可选,因为我们使用内置的环境分组
|
||||
onEnvironmentsChange: (environments: string[]) => void;
|
||||
maxSelections?: number;
|
||||
allowCustom?: boolean;
|
||||
|
|
@ -17,7 +17,6 @@ interface EnvironmentTagSelectorProps {
|
|||
|
||||
export const EnvironmentTagSelector: React.FC<EnvironmentTagSelectorProps> = ({
|
||||
selectedEnvironments,
|
||||
availableEnvironments,
|
||||
onEnvironmentsChange,
|
||||
maxSelections = 3,
|
||||
allowCustom = true,
|
||||
|
|
@ -28,7 +27,7 @@ export const EnvironmentTagSelector: React.FC<EnvironmentTagSelectorProps> = ({
|
|||
const [customEnvironment, setCustomEnvironment] = useState('');
|
||||
|
||||
// 环境标签分组
|
||||
const environmentGroups = {
|
||||
const environmentGroups: Record<string, string[]> = {
|
||||
'室内环境': ['Indoor', 'Office', 'Home', 'Restaurant', 'Shopping mall'],
|
||||
'室外环境': ['Outdoor', 'City street', 'Park', 'Beach', 'Mountain'],
|
||||
'建筑环境': ['Building facade', 'Modern architecture', 'Historic building'],
|
||||
|
|
@ -41,7 +40,7 @@ export const EnvironmentTagSelector: React.FC<EnvironmentTagSelectorProps> = ({
|
|||
return environmentGroups;
|
||||
}
|
||||
|
||||
const filtered: typeof environmentGroups = {};
|
||||
const filtered: Record<string, string[]> = {};
|
||||
Object.entries(environmentGroups).forEach(([group, environments]) => {
|
||||
const matchedEnvironments = environments.filter(env =>
|
||||
env.toLowerCase().includes(searchQuery.toLowerCase()) &&
|
||||
|
|
|
|||
|
|
@ -107,9 +107,15 @@ const SimilaritySearchTool: React.FC = () => {
|
|||
setSearchConfig(newConfig);
|
||||
// 如果有查询内容,自动重新搜索
|
||||
if (query.trim()) {
|
||||
executeSearch();
|
||||
const request: SimilaritySearchRequest = {
|
||||
query: query.trim(),
|
||||
relevance_threshold: selectedThreshold,
|
||||
page_size: configState.config?.max_results_per_page || 12,
|
||||
page_offset: 0,
|
||||
};
|
||||
executeSearch(request);
|
||||
}
|
||||
}, [query, executeSearch]);
|
||||
}, [query, selectedThreshold, configState.config, executeSearch]);
|
||||
|
||||
// 切换高级过滤器显示
|
||||
const handleToggleAdvancedFilters = useCallback(() => {
|
||||
|
|
|
|||
|
|
@ -322,6 +322,10 @@ export class IntelligentSearchService {
|
|||
...config2.design_styles,
|
||||
},
|
||||
max_keywords: Math.max(config1.max_keywords, config2.max_keywords),
|
||||
debug_mode: config1.debug_mode || config2.debug_mode,
|
||||
custom_filters: [...new Set([...config1.custom_filters, ...config2.custom_filters])],
|
||||
query_enhancement_enabled: config1.query_enhancement_enabled && config2.query_enhancement_enabled,
|
||||
color_thresholds: config1.color_thresholds,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue