llmconfig 0.0.4 → 0.0.5
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/dist/index.d.mts +2 -14
- package/dist/index.mjs +2 -25
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { LanguageModelUsage, ModelMessage } from "ai";
|
|
2
|
-
import { Table } from "dexie";
|
|
3
2
|
import z$1, { z } from "zod";
|
|
4
3
|
|
|
5
4
|
//#region src/utils/const.d.ts
|
|
6
|
-
declare const TableSchema: {
|
|
7
|
-
readonly provider: "id,name,createdAt";
|
|
8
|
-
readonly llms: "id,pid,model,bility,createdAt";
|
|
9
|
-
};
|
|
10
5
|
declare const LLMBilities: readonly ["text", "image", "image_modify", "video", "video_modify", "speech", "speech_modify", "music", "music_modify"];
|
|
11
6
|
//#endregion
|
|
12
7
|
//#region src/types/llmconfig.d.ts
|
|
@@ -123,16 +118,9 @@ declare class Manager {
|
|
|
123
118
|
}
|
|
124
119
|
//#endregion
|
|
125
120
|
//#region src/library.d.ts
|
|
126
|
-
declare
|
|
127
|
-
#private;
|
|
128
|
-
get modelTable(): Table<LLMConfig>;
|
|
129
|
-
init(models: Table<LLMConfig>): Promise<void>;
|
|
130
|
-
upsertModel(cfg: LLMConfig): Promise<boolean>;
|
|
131
|
-
delModel(id: string): Promise<void>;
|
|
132
|
-
}
|
|
133
|
-
declare const llmcfgInst: Library;
|
|
121
|
+
declare const llmcfgInst: Manager;
|
|
134
122
|
//#endregion
|
|
135
123
|
//#region src/wrapper/providers.d.ts
|
|
136
124
|
declare function listModels(config: LLMConfig): Promise<string[]>;
|
|
137
125
|
//#endregion
|
|
138
|
-
export { type CallResult, type GenerateObjectOptions, type GenerateObjectResult, type ILLMWrapper, type ITextLLMWrapper, type JSONCallResult, LLMBilities, type LLMBility, type LLMConfig,
|
|
126
|
+
export { type CallResult, type GenerateObjectOptions, type GenerateObjectResult, type ILLMWrapper, type ITextLLMWrapper, type JSONCallResult, LLMBilities, type LLMBility, type LLMConfig, Manager, llmcfgInst as default, llmcfgInst, listModels };
|
package/dist/index.mjs
CHANGED
|
@@ -530,33 +530,10 @@ var Manager = class {
|
|
|
530
530
|
|
|
531
531
|
//#endregion
|
|
532
532
|
//#region src/library.ts
|
|
533
|
-
|
|
534
|
-
#modelTable;
|
|
535
|
-
get modelTable() {
|
|
536
|
-
return this.#modelTable;
|
|
537
|
-
}
|
|
538
|
-
async init(models) {
|
|
539
|
-
this.#modelTable = models;
|
|
540
|
-
const allModels = await models.toArray();
|
|
541
|
-
super.reLoad(allModels);
|
|
542
|
-
}
|
|
543
|
-
async upsertModel(cfg) {
|
|
544
|
-
if (!super.upsertWrapper(cfg)) return false;
|
|
545
|
-
return await this.#modelTable.put(cfg) === cfg.id;
|
|
546
|
-
}
|
|
547
|
-
async delModel(id) {
|
|
548
|
-
super.delWrapper(id);
|
|
549
|
-
await this.#modelTable.delete(id);
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
const llmcfgInst = new Library();
|
|
533
|
+
const llmcfgInst = new Manager();
|
|
553
534
|
|
|
554
535
|
//#endregion
|
|
555
536
|
//#region src/utils/const.ts
|
|
556
|
-
const TableSchema = {
|
|
557
|
-
provider: "id,name,createdAt",
|
|
558
|
-
llms: "id,pid,model,bility,createdAt"
|
|
559
|
-
};
|
|
560
537
|
const LLMBilities = [
|
|
561
538
|
"text",
|
|
562
539
|
"image",
|
|
@@ -574,4 +551,4 @@ const LLMBilities = [
|
|
|
574
551
|
var src_default = llmcfgInst;
|
|
575
552
|
|
|
576
553
|
//#endregion
|
|
577
|
-
export { LLMBilities,
|
|
554
|
+
export { LLMBilities, Manager, src_default as default, listModels, llmcfgInst };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llmconfig",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "基于@ai-sdk,允许封装多个llm provider.使得配置与调用分离。",
|
|
6
6
|
"author": "lizhutang",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"@types/lodash": "^4.17.21",
|
|
47
47
|
"@types/node": "^25.0.1",
|
|
48
48
|
"bumpp": "^10.3.2",
|
|
49
|
-
"dexie": "^4.2.1",
|
|
50
49
|
"eslint": "^9.39.2",
|
|
51
50
|
"lint-staged": "^16.2.7",
|
|
52
51
|
"publint": "^0.3.16",
|