Skip to content

Commit d0fc888

Browse files
committed
🔥 refactor: remove searchEngine
1 parent 91663ea commit d0fc888

File tree

5 files changed

+4
-171
lines changed

5 files changed

+4
-171
lines changed

api/v1/runner.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// TODO:后续替换为 sdk
22
import { LobeChatPlugins } from '@lobehub/lobe-chat-plugins';
33

4-
import { PluginsMap } from '../../plugins';
54
import { OpenAIPluginPayload } from '../../types/plugins';
65

76
export const config = {
@@ -15,14 +14,14 @@ const INDEX_URL = `https://registry.npmmirror.com/${INDEX_PKG}/latest/files`;
1514
export default async (req: Request) => {
1615
if (req.method !== 'POST') return new Response('Method Not Allowed', { status: 405 });
1716

17+
const res = await fetch(INDEX_URL);
18+
const manifest: LobeChatPlugins = await res.json();
19+
console.log('manifest:', manifest);
20+
1821
const { name, arguments: args } = (await req.json()) as OpenAIPluginPayload;
1922

2023
console.log(`检测到 functionCall: ${name}`);
2124

22-
const res = await fetch(INDEX_URL);
23-
const manifest: LobeChatPlugins = await res.json();
24-
console.log(manifest);
25-
2625
const item = manifest.plugins.find((i) => i.name === name);
2726

2827
// 先通过插件资产 endpoint 路径查询
@@ -33,16 +32,5 @@ export default async (req: Request) => {
3332
return new Response(data);
3433
}
3534

36-
// TODO:兼容性代码,全量完成迁移后移除
37-
const func = PluginsMap[name];
38-
39-
if (func) {
40-
const data = JSON.parse(args);
41-
const result = await func.runner(data);
42-
43-
console.log(`[${name}]`, args, `result:`, JSON.stringify(result, null, 2).slice(0, 3600));
44-
45-
return new Response(JSON.stringify(result));
46-
}
4735
return;
4836
};

plugins/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

plugins/searchEngine/index.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

plugins/searchEngine/runner.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

plugins/searchEngine/type.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)