Skip to content

Commit 2fcec9c

Browse files
committed
fix: 修复 CR 意见
1 parent 2c8035f commit 2fcec9c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

__tests__/utils/deepwiki.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ describe('adaptedQueryDeepWiki', () => {
8585

8686
// DeepWiki 对不存在的仓库可能返回空或报错
8787
// adaptedQueryDeepWiki 应该把异常吞掉,返回 error 字段
88-
expect(
89-
result.documentation === null || typeof result.error === 'string',
90-
).toBe(true);
88+
expect(result.documentation).toBeNull();
89+
expect(typeof result.error).toBe('string');
9190
}, 120000);
9291
});

src/utils/deepwiki.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ export async function queryDeepWiki(_params: {
211211
.map((item: any) => item.text)
212212
.join('\n'); // 如果有多段文本,用换行符拼接
213213

214+
if (result.isError) {
215+
throw new Error('DeepWiki Tool Error, Answer = ' + answer);
216+
}
217+
214218
const regex =
215219
/Wiki pages you might want to explore:|View this search on DeepWiki:/i;
216220
const splitIndex = answer.search(regex);

0 commit comments

Comments
 (0)