Skip to content

Commit c0daa4e

Browse files
committed
refactor(gemini_embedding): apply AI recommendations to remove broad exception catching
1 parent 6e8365a commit c0daa4e

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

astrbot/core/provider/sources/gemini_embedding_source.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ async def get_embedding(self, text: str) -> list[float]:
7171
return result.embeddings[0].values
7272
except APIError as e:
7373
raise Exception(f"Gemini Embedding API请求失败: {e.message}") from e
74-
except Exception as e:
75-
raise Exception(f"Gemini Embedding 发生异常: {e}") from e
7674

7775
async def get_embeddings(self, text: list[str]) -> list[list[float]]:
7876
# 批量获取文本的嵌入
@@ -113,8 +111,6 @@ async def get_embeddings(self, text: list[str]) -> list[list[float]]:
113111
return embeddings
114112
except APIError as e:
115113
raise Exception(f"Gemini Embedding API批量请求失败: {e.message}") from e
116-
except Exception as e:
117-
raise Exception(f"Gemini Embedding 批量请求发生异常: {e}") from e
118114

119115
def get_dim(self) -> int:
120116
# 获取向量的维度

0 commit comments

Comments
 (0)