plugin-custom-llm 1.2.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -104
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +2 -2
- package/dist/locale/en-US.json +31 -29
- package/dist/locale/vi-VN.json +31 -29
- package/dist/locale/zh-CN.json +16 -16
- package/dist/server/llm-providers/custom-llm.js +204 -31
- package/package.json +36 -36
- package/src/client/client.d.ts +9 -0
- package/src/client/index.tsx +28 -19
- package/src/client/llm-providers/custom-llm/ModelSettings.tsx +148 -139
- package/src/client/llm-providers/custom-llm/ProviderSettings.tsx +133 -115
- package/src/client/llm-providers/custom-llm/index.ts +19 -10
- package/src/client/locale.ts +17 -8
- package/src/client/plugin.tsx +9 -0
- package/src/index.ts +9 -0
- package/src/locale/en-US.json +31 -29
- package/src/locale/vi-VN.json +31 -29
- package/src/locale/zh-CN.json +16 -16
- package/src/server/index.ts +9 -0
- package/src/server/llm-providers/custom-llm.ts +1249 -992
- package/src/server/plugin.ts +36 -27
- package/src/swagger.ts +18 -9
package/src/server/plugin.ts
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@nocobase/server';
|
|
11
|
+
import PluginAIServer from '@nocobase/plugin-ai';
|
|
12
|
+
import { customLLMProviderOptions } from './llm-providers/custom-llm';
|
|
13
|
+
|
|
14
|
+
export class PluginCustomLLMServer extends Plugin {
|
|
15
|
+
async afterAdd() {}
|
|
16
|
+
|
|
17
|
+
async beforeLoad() {}
|
|
18
|
+
|
|
19
|
+
async load() {
|
|
20
|
+
this.aiPlugin.aiManager.registerLLMProvider('custom-llm', customLLMProviderOptions);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async install() {}
|
|
24
|
+
|
|
25
|
+
async afterEnable() {}
|
|
26
|
+
|
|
27
|
+
async afterDisable() {}
|
|
28
|
+
|
|
29
|
+
async remove() {}
|
|
30
|
+
|
|
31
|
+
private get aiPlugin(): PluginAIServer {
|
|
32
|
+
return this.app.pm.get('ai');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default PluginCustomLLMServer;
|
package/src/swagger.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
info: {
|
|
12
|
+
title: 'NocoBase API - Custom LLM Plugin',
|
|
13
|
+
description:
|
|
14
|
+
'Registers a custom OpenAI-compatible LLM provider with the AI plugin. This plugin has no direct HTTP endpoints — all API access is through the AI API plugin gateway (`/api/ai-llm/v1/*`) using models registered under the `custom-llm` service.',
|
|
15
|
+
},
|
|
16
|
+
tags: [{ name: 'custom-llm', description: 'Custom LLM provider (no direct endpoints)' }],
|
|
17
|
+
paths: {},
|
|
18
|
+
};
|