feat: Add curated expert occupations with local data sources
- Add curated occupations seed files (210 entries in zh/en) with specific domains - Add DBpedia occupations data (2164 entries) for external source option - Refactor expert_source_service to read from local JSON files - Improve keyword generation prompts to leverage expert domain context - Add architecture analysis documentation (ARCHITECTURE_ANALYSIS.md) - Fix expert source selection bug (proper handling of empty custom_experts) - Update frontend to support curated/dbpedia/wikidata expert sources Key changes: - backend/app/data/: Local occupation data files - backend/app/services/expert_source_service.py: Simplified local file reading - backend/app/prompts/expert_transformation_prompt.py: Better domain-aware prompts - Removed expert_cache.py (no longer needed with local files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,9 @@ const { Title, Text } = Typography;
|
||||
|
||||
const EXPERT_SOURCE_OPTIONS = [
|
||||
{ label: 'LLM 生成', value: 'llm' as ExpertSource, description: '使用 AI 模型生成專家' },
|
||||
{ label: 'Wikidata', value: 'wikidata' as ExpertSource, description: '從維基數據查詢職業' },
|
||||
{ label: 'ConceptNet', value: 'conceptnet' as ExpertSource, description: '從知識圖譜查詢概念' },
|
||||
{ label: '精選職業', value: 'curated' as ExpertSource, description: '從 210 個常見職業隨機選取(含具體領域)' },
|
||||
{ label: 'DBpedia', value: 'dbpedia' as ExpertSource, description: '從 DBpedia 隨機選取職業 (2164 筆)' },
|
||||
{ label: 'Wikidata', value: 'wikidata' as ExpertSource, description: '從 Wikidata 查詢職業 (需等待 API)' },
|
||||
];
|
||||
|
||||
interface TransformationInputPanelProps {
|
||||
|
||||
@@ -155,7 +155,7 @@ export function useExpertTransformation(options: UseExpertTransformationOptions
|
||||
});
|
||||
});
|
||||
},
|
||||
[options.model, options.temperature]
|
||||
[options.model, options.temperature, options.expertSource]
|
||||
);
|
||||
|
||||
const transformAll = useCallback(
|
||||
|
||||
@@ -230,7 +230,7 @@ export interface ExpertTransformationDAGResult {
|
||||
results: ExpertTransformationCategoryResult[];
|
||||
}
|
||||
|
||||
export type ExpertSource = 'llm' | 'wikidata' | 'conceptnet';
|
||||
export type ExpertSource = 'llm' | 'curated' | 'dbpedia' | 'wikidata';
|
||||
|
||||
export interface ExpertTransformationRequest {
|
||||
query: string;
|
||||
@@ -240,7 +240,7 @@ export interface ExpertTransformationRequest {
|
||||
keywords_per_expert: number; // 1-3
|
||||
custom_experts?: string[]; // ["藥師", "工程師"]
|
||||
expert_source?: ExpertSource; // 專家來源 (default: 'llm')
|
||||
expert_language?: string; // 外部來源語言 (default: 'zh')
|
||||
expert_language?: string; // 外部來源語言 (default: 'en')
|
||||
model?: string;
|
||||
temperature?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user