From 3372552391f51a54801abe1f79ea7ed03a07c093 Mon Sep 17 00:00:00 2001 From: AmintaCCCP Date: Tue, 12 Aug 2025 20:48:52 +0800 Subject: [PATCH] 0.1.4 --- dist/index.html | 4 +- package.json | 2 +- src/components/RepositoryCard.tsx | 50 ++++++++++++++++++++---- src/components/RepositoryList.tsx | 65 ++++++++++++++++++++++++------- src/components/SettingsPanel.tsx | 2 +- src/services/aiService.ts | 4 +- src/services/updateService.ts | 2 +- src/types/index.ts | 1 + test-update.html | 2 +- 9 files changed, 103 insertions(+), 29 deletions(-) diff --git a/dist/index.html b/dist/index.html index 4a18582..ebac633 100644 --- a/dist/index.html +++ b/dist/index.html @@ -10,8 +10,8 @@ - - + +
diff --git a/package.json b/package.json index 8d027d9..5ededb5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "github-stars-manager", "private": true, - "version": "0.1.3", + "version": "0.1.4", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/RepositoryCard.tsx b/src/components/RepositoryCard.tsx index 2ad38e8..a7d064b 100644 --- a/src/components/RepositoryCard.tsx +++ b/src/components/RepositoryCard.tsx @@ -197,7 +197,8 @@ export const RepositoryCard: React.FC = ({ ai_summary: analysis.summary, ai_tags: analysis.tags, ai_platforms: analysis.platforms, - analyzed_at: new Date().toISOString() + analyzed_at: new Date().toISOString(), + analysis_failed: false // 分析成功,清除失败标记 }; updateRepository(updatedRepo); @@ -209,6 +210,16 @@ export const RepositoryCard: React.FC = ({ alert(successMessage); } catch (error) { console.error('AI analysis failed:', error); + + // 标记为分析失败 + const failedRepo = { + ...repository, + analyzed_at: new Date().toISOString(), + analysis_failed: true + }; + + updateRepository(failedRepo); + alert(language === 'zh' ? 'AI分析失败,请检查AI配置和网络连接。' : 'AI analysis failed. Please check AI configuration and network connection.'); } finally { setLoading(false); @@ -232,6 +243,12 @@ export const RepositoryCard: React.FC = ({ content: repository.custom_description, isCustom: true }; + } else if (showAISummary && repository.analysis_failed) { + return { + content: repository.description || (language === 'zh' ? '暂无描述' : 'No description available'), + isAI: false, + isFailed: true + }; } else if (showAISummary && repository.ai_summary) { return { content: repository.ai_summary, @@ -277,7 +294,12 @@ export const RepositoryCard: React.FC = ({ // 获取AI分析按钮的提示文本 const getAIButtonTitle = () => { - if (repository.analyzed_at) { + if (repository.analysis_failed) { + const analyzeTime = new Date(repository.analyzed_at!).toLocaleString(); + return language === 'zh' + ? `分析失败于 ${analyzeTime},点击重新分析` + : `Analysis failed on ${analyzeTime}, click to retry`; + } else if (repository.analyzed_at) { const analyzeTime = new Date(repository.analyzed_at).toLocaleString(); return language === 'zh' ? `已于 ${analyzeTime} 分析过,点击重新分析` @@ -315,9 +337,12 @@ export const RepositoryCard: React.FC = ({ + )} @@ -414,6 +446,11 @@ export const RepositoryList: React.FC = ({ • {analyzedCount} {t('个已AI分析', 'AI analyzed')} )} + {failedCount > 0 && ( + + • {failedCount} {t('个分析失败', 'analysis failed')} + + )} {unanalyzedCount > 0 && ( • {unanalyzedCount} {t('个未分析', 'unanalyzed')} diff --git a/src/components/SettingsPanel.tsx b/src/components/SettingsPanel.tsx index c14e655..f04375c 100644 --- a/src/components/SettingsPanel.tsx +++ b/src/components/SettingsPanel.tsx @@ -373,7 +373,7 @@ Focus on practicality and accurate categorization to help users quickly understa

- {t('当前版本: v0.1.3', 'Current Version: v0.1.3')} + {t('当前版本: v0.1.4', 'Current Version: v0.1.4')}

{t('检查是否有新版本可用', 'Check if a new version is available')} diff --git a/src/services/aiService.ts b/src/services/aiService.ts index 0200650..a659543 100644 --- a/src/services/aiService.ts +++ b/src/services/aiService.ts @@ -58,8 +58,8 @@ export class AIService { return this.parseAIResponse(content); } catch (error) { console.error('AI analysis failed:', error); - // Fallback to basic analysis - return this.fallbackAnalysis(repository); + // 抛出错误,让调用方处理失败状态 + throw error; } } diff --git a/src/services/updateService.ts b/src/services/updateService.ts index 69179f7..c8d4053 100644 --- a/src/services/updateService.ts +++ b/src/services/updateService.ts @@ -17,7 +17,7 @@ export class UpdateService { private static getCurrentVersion(): string { // 在实际应用中,这个版本号应该在构建时注入 // 这里暂时硬编码,你可以通过构建脚本或环境变量来动态设置 - return '0.1.3'; + return '0.1.4'; } static async checkForUpdates(): Promise { diff --git a/src/types/index.ts b/src/types/index.ts index 6fbc0aa..e7b0616 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -20,6 +20,7 @@ export interface Repository { ai_tags?: string[]; ai_platforms?: string[]; // 新增:支持的平台类型 analyzed_at?: string; + analysis_failed?: boolean; // 新增:AI分析是否失败 // Release subscription subscribed_to_releases?: boolean; // Manual editing fields diff --git a/test-update.html b/test-update.html index 6dbe311..19027d1 100644 --- a/test-update.html +++ b/test-update.html @@ -64,7 +64,7 @@

GitHub Stars Manager - 更新功能测试

-

当前版本: v0.1.3

+

当前版本: v0.1.4