Skip to content

Commit

Permalink
🐛 fix: 修正搜索引擎插件的实现问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jul 23, 2023
1 parent 7b8d969 commit d19a805
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/api/plugins.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default async function handler(req: Request) {
if (func) {
const result = await func.runner(args as any);

console.log(`[${name}]`, 'args:', args, `Result:`, JSON.stringify(result, null, 2));
console.log(`[${name}]`, args, `result:`, JSON.stringify(result, null, 2));

Check warning on line 23 in src/pages/api/plugins.api.ts

View workflow job for this annotation

GitHub Actions / test

Use `undefined` instead of `null`

const newMessages = createFunctionCallMessages(result) as ChatCompletionRequestMessage[];

Expand Down
7 changes: 6 additions & 1 deletion src/plugins/searchEngine/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ export interface DetectedExtensions {
month_ago: number;
}

const fetchResult = async (keywords: string) => {
const fetchResult = async ({ keywords }: { keywords: string }) => {
const params = {
api_key: API_KEY,
engine: 'google',
gl: 'cn',
google_domain: 'google.com',
hl: 'zh-cn',
location: 'China',
q: keywords,
};

Expand Down

0 comments on commit d19a805

Please sign in to comment.