@chatluna/v1-shared-adapter 1.0.22 → 1.0.24
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/lib/client.d.ts +2 -0
- package/lib/index.cjs +27 -7
- package/lib/index.mjs +25 -7
- package/package.json +2 -2
package/lib/client.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ModelInfo } from 'koishi-plugin-chatluna/llm-core/platform/types';
|
|
2
2
|
export type OpenAIReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
3
|
+
export declare const reasoningEffortModelSuffixes: readonly ["non-thinking", "minimal-thinking", "low-thinking", "medium-thinking", "high-thinking", "xhigh-thinking", "thinking"];
|
|
4
|
+
export declare function expandReasoningEffortModelVariants(model: string): string[];
|
|
3
5
|
export declare function parseOpenAIModelNameWithReasoningEffort(modelName: string): {
|
|
4
6
|
model: string;
|
|
5
7
|
reasoningEffort?: OpenAIReasoningEffort;
|
package/lib/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
convertMessageToMessageChunk: () => convertMessageToMessageChunk,
|
|
28
28
|
createEmbeddings: () => createEmbeddings,
|
|
29
29
|
createRequestContext: () => createRequestContext,
|
|
30
|
+
expandReasoningEffortModelVariants: () => expandReasoningEffortModelVariants,
|
|
30
31
|
fetchImageUrl: () => fetchImageUrl,
|
|
31
32
|
formatToolToOpenAITool: () => formatToolToOpenAITool,
|
|
32
33
|
formatToolsToOpenAITools: () => formatToolsToOpenAITools,
|
|
@@ -42,6 +43,7 @@ __export(index_exports, {
|
|
|
42
43
|
processReasoningContent: () => processReasoningContent,
|
|
43
44
|
processResponse: () => processResponse,
|
|
44
45
|
processStreamResponse: () => processStreamResponse,
|
|
46
|
+
reasoningEffortModelSuffixes: () => reasoningEffortModelSuffixes,
|
|
45
47
|
removeAdditionalProperties: () => removeAdditionalProperties,
|
|
46
48
|
supportImageInput: () => supportImageInput,
|
|
47
49
|
transformSystemMessages: () => transformSystemMessages
|
|
@@ -50,6 +52,19 @@ module.exports = __toCommonJS(index_exports);
|
|
|
50
52
|
|
|
51
53
|
// src/client.ts
|
|
52
54
|
var import_count_tokens = require("koishi-plugin-chatluna/llm-core/utils/count_tokens");
|
|
55
|
+
var reasoningEffortModelSuffixes = [
|
|
56
|
+
"non-thinking",
|
|
57
|
+
"minimal-thinking",
|
|
58
|
+
"low-thinking",
|
|
59
|
+
"medium-thinking",
|
|
60
|
+
"high-thinking",
|
|
61
|
+
"xhigh-thinking",
|
|
62
|
+
"thinking"
|
|
63
|
+
];
|
|
64
|
+
function expandReasoningEffortModelVariants(model) {
|
|
65
|
+
return reasoningEffortModelSuffixes.map((suffix) => `${model}-${suffix}`);
|
|
66
|
+
}
|
|
67
|
+
__name(expandReasoningEffortModelVariants, "expandReasoningEffortModelVariants");
|
|
53
68
|
function parseOpenAIModelNameWithReasoningEffort(modelName) {
|
|
54
69
|
let model = modelName;
|
|
55
70
|
let reasoningEffort;
|
|
@@ -155,6 +170,7 @@ var imageModelMatchers = [
|
|
|
155
170
|
"gpt-4.1",
|
|
156
171
|
"gpt-5",
|
|
157
172
|
"glm-*v",
|
|
173
|
+
"kimi-k2.5",
|
|
158
174
|
"step3",
|
|
159
175
|
"grok-4"
|
|
160
176
|
].map((pattern) => createGlobMatcher(pattern));
|
|
@@ -397,6 +413,12 @@ function removeAdditionalProperties(schema) {
|
|
|
397
413
|
if (Object.hasOwn(current, "$schema")) {
|
|
398
414
|
delete current["$schema"];
|
|
399
415
|
}
|
|
416
|
+
if (Object.hasOwn(current, "const")) {
|
|
417
|
+
if (!Object.hasOwn(current, "enum")) {
|
|
418
|
+
current["enum"] = [current["const"]];
|
|
419
|
+
}
|
|
420
|
+
delete current["const"];
|
|
421
|
+
}
|
|
400
422
|
for (const key of Object.keys(current)) {
|
|
401
423
|
const value = current[key];
|
|
402
424
|
if (value && typeof value === "object") {
|
|
@@ -813,13 +835,9 @@ async function getModels(requestContext, config) {
|
|
|
813
835
|
push(model);
|
|
814
836
|
if (!isOpenAIReasoningModel(model)) continue;
|
|
815
837
|
if (hasThinkingTag(model)) continue;
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
push(`${model}-low-thinking`);
|
|
820
|
-
push(`${model}-medium-thinking`);
|
|
821
|
-
push(`${model}-high-thinking`);
|
|
822
|
-
push(`${model}-xhigh-thinking`);
|
|
838
|
+
for (const variant of expandReasoningEffortModelVariants(model)) {
|
|
839
|
+
push(variant);
|
|
840
|
+
}
|
|
823
841
|
}
|
|
824
842
|
return expanded;
|
|
825
843
|
} catch (e) {
|
|
@@ -845,6 +863,7 @@ __name(createRequestContext, "createRequestContext");
|
|
|
845
863
|
convertMessageToMessageChunk,
|
|
846
864
|
createEmbeddings,
|
|
847
865
|
createRequestContext,
|
|
866
|
+
expandReasoningEffortModelVariants,
|
|
848
867
|
fetchImageUrl,
|
|
849
868
|
formatToolToOpenAITool,
|
|
850
869
|
formatToolsToOpenAITools,
|
|
@@ -860,6 +879,7 @@ __name(createRequestContext, "createRequestContext");
|
|
|
860
879
|
processReasoningContent,
|
|
861
880
|
processResponse,
|
|
862
881
|
processStreamResponse,
|
|
882
|
+
reasoningEffortModelSuffixes,
|
|
863
883
|
removeAdditionalProperties,
|
|
864
884
|
supportImageInput,
|
|
865
885
|
transformSystemMessages
|
package/lib/index.mjs
CHANGED
|
@@ -3,6 +3,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/client.ts
|
|
5
5
|
import { getModelContextSize } from "koishi-plugin-chatluna/llm-core/utils/count_tokens";
|
|
6
|
+
var reasoningEffortModelSuffixes = [
|
|
7
|
+
"non-thinking",
|
|
8
|
+
"minimal-thinking",
|
|
9
|
+
"low-thinking",
|
|
10
|
+
"medium-thinking",
|
|
11
|
+
"high-thinking",
|
|
12
|
+
"xhigh-thinking",
|
|
13
|
+
"thinking"
|
|
14
|
+
];
|
|
15
|
+
function expandReasoningEffortModelVariants(model) {
|
|
16
|
+
return reasoningEffortModelSuffixes.map((suffix) => `${model}-${suffix}`);
|
|
17
|
+
}
|
|
18
|
+
__name(expandReasoningEffortModelVariants, "expandReasoningEffortModelVariants");
|
|
6
19
|
function parseOpenAIModelNameWithReasoningEffort(modelName) {
|
|
7
20
|
let model = modelName;
|
|
8
21
|
let reasoningEffort;
|
|
@@ -108,6 +121,7 @@ var imageModelMatchers = [
|
|
|
108
121
|
"gpt-4.1",
|
|
109
122
|
"gpt-5",
|
|
110
123
|
"glm-*v",
|
|
124
|
+
"kimi-k2.5",
|
|
111
125
|
"step3",
|
|
112
126
|
"grok-4"
|
|
113
127
|
].map((pattern) => createGlobMatcher(pattern));
|
|
@@ -363,6 +377,12 @@ function removeAdditionalProperties(schema) {
|
|
|
363
377
|
if (Object.hasOwn(current, "$schema")) {
|
|
364
378
|
delete current["$schema"];
|
|
365
379
|
}
|
|
380
|
+
if (Object.hasOwn(current, "const")) {
|
|
381
|
+
if (!Object.hasOwn(current, "enum")) {
|
|
382
|
+
current["enum"] = [current["const"]];
|
|
383
|
+
}
|
|
384
|
+
delete current["const"];
|
|
385
|
+
}
|
|
366
386
|
for (const key of Object.keys(current)) {
|
|
367
387
|
const value = current[key];
|
|
368
388
|
if (value && typeof value === "object") {
|
|
@@ -779,13 +799,9 @@ async function getModels(requestContext, config) {
|
|
|
779
799
|
push(model);
|
|
780
800
|
if (!isOpenAIReasoningModel(model)) continue;
|
|
781
801
|
if (hasThinkingTag(model)) continue;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
push(`${model}-low-thinking`);
|
|
786
|
-
push(`${model}-medium-thinking`);
|
|
787
|
-
push(`${model}-high-thinking`);
|
|
788
|
-
push(`${model}-xhigh-thinking`);
|
|
802
|
+
for (const variant of expandReasoningEffortModelVariants(model)) {
|
|
803
|
+
push(variant);
|
|
804
|
+
}
|
|
789
805
|
}
|
|
790
806
|
return expanded;
|
|
791
807
|
} catch (e) {
|
|
@@ -810,6 +826,7 @@ export {
|
|
|
810
826
|
convertMessageToMessageChunk,
|
|
811
827
|
createEmbeddings,
|
|
812
828
|
createRequestContext,
|
|
829
|
+
expandReasoningEffortModelVariants,
|
|
813
830
|
fetchImageUrl,
|
|
814
831
|
formatToolToOpenAITool,
|
|
815
832
|
formatToolsToOpenAITools,
|
|
@@ -825,6 +842,7 @@ export {
|
|
|
825
842
|
processReasoningContent,
|
|
826
843
|
processResponse,
|
|
827
844
|
processStreamResponse,
|
|
845
|
+
reasoningEffortModelSuffixes,
|
|
828
846
|
removeAdditionalProperties,
|
|
829
847
|
supportImageInput,
|
|
830
848
|
transformSystemMessages
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatluna/v1-shared-adapter",
|
|
3
3
|
"description": "chatluna shared adapter",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"koishi": "^4.18.9",
|
|
73
|
-
"koishi-plugin-chatluna": "^1.3.
|
|
73
|
+
"koishi-plugin-chatluna": "^1.3.20"
|
|
74
74
|
}
|
|
75
75
|
}
|