@chatluna/v1-shared-adapter 1.0.22 → 1.0.23
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 +21 -7
- package/lib/index.mjs +19 -7
- package/lib/utils.d.ts +2 -2
- 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));
|
|
@@ -813,13 +829,9 @@ async function getModels(requestContext, config) {
|
|
|
813
829
|
push(model);
|
|
814
830
|
if (!isOpenAIReasoningModel(model)) continue;
|
|
815
831
|
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`);
|
|
832
|
+
for (const variant of expandReasoningEffortModelVariants(model)) {
|
|
833
|
+
push(variant);
|
|
834
|
+
}
|
|
823
835
|
}
|
|
824
836
|
return expanded;
|
|
825
837
|
} catch (e) {
|
|
@@ -845,6 +857,7 @@ __name(createRequestContext, "createRequestContext");
|
|
|
845
857
|
convertMessageToMessageChunk,
|
|
846
858
|
createEmbeddings,
|
|
847
859
|
createRequestContext,
|
|
860
|
+
expandReasoningEffortModelVariants,
|
|
848
861
|
fetchImageUrl,
|
|
849
862
|
formatToolToOpenAITool,
|
|
850
863
|
formatToolsToOpenAITools,
|
|
@@ -860,6 +873,7 @@ __name(createRequestContext, "createRequestContext");
|
|
|
860
873
|
processReasoningContent,
|
|
861
874
|
processResponse,
|
|
862
875
|
processStreamResponse,
|
|
876
|
+
reasoningEffortModelSuffixes,
|
|
863
877
|
removeAdditionalProperties,
|
|
864
878
|
supportImageInput,
|
|
865
879
|
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));
|
|
@@ -779,13 +793,9 @@ async function getModels(requestContext, config) {
|
|
|
779
793
|
push(model);
|
|
780
794
|
if (!isOpenAIReasoningModel(model)) continue;
|
|
781
795
|
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`);
|
|
796
|
+
for (const variant of expandReasoningEffortModelVariants(model)) {
|
|
797
|
+
push(variant);
|
|
798
|
+
}
|
|
789
799
|
}
|
|
790
800
|
return expanded;
|
|
791
801
|
} catch (e) {
|
|
@@ -810,6 +820,7 @@ export {
|
|
|
810
820
|
convertMessageToMessageChunk,
|
|
811
821
|
createEmbeddings,
|
|
812
822
|
createRequestContext,
|
|
823
|
+
expandReasoningEffortModelVariants,
|
|
813
824
|
fetchImageUrl,
|
|
814
825
|
formatToolToOpenAITool,
|
|
815
826
|
formatToolsToOpenAITools,
|
|
@@ -825,6 +836,7 @@ export {
|
|
|
825
836
|
processReasoningContent,
|
|
826
837
|
processResponse,
|
|
827
838
|
processStreamResponse,
|
|
839
|
+
reasoningEffortModelSuffixes,
|
|
828
840
|
removeAdditionalProperties,
|
|
829
841
|
supportImageInput,
|
|
830
842
|
transformSystemMessages
|
package/lib/utils.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export declare function messageTypeToOpenAIRole(type: MessageType): ChatCompleti
|
|
|
11
11
|
export declare function formatToolsToOpenAITools(tools: StructuredTool[], includeGoogleSearch: boolean): ChatCompletionTool[];
|
|
12
12
|
export declare function formatToolToOpenAITool(tool: StructuredTool): ChatCompletionTool;
|
|
13
13
|
export declare function removeAdditionalProperties(schema: JsonSchema7Type): JsonSchema7Type;
|
|
14
|
-
export declare function convertMessageToMessageChunk(message: ChatCompletionResponseMessage):
|
|
15
|
-
export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum):
|
|
14
|
+
export declare function convertMessageToMessageChunk(message: ChatCompletionResponseMessage): AIMessageChunk | HumanMessageChunk | SystemMessageChunk | FunctionMessageChunk | ToolMessageChunk | ChatMessageChunk;
|
|
15
|
+
export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum): AIMessageChunk | HumanMessageChunk | SystemMessageChunk | FunctionMessageChunk | ToolMessageChunk | ChatMessageChunk;
|
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.23",
|
|
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.16"
|
|
74
74
|
}
|
|
75
75
|
}
|