listpage-next-nest 0.0.144 → 0.0.150
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/cjs/index.cjs +16 -10
- package/dist/cjs/index.d.ts +6 -2
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -600,14 +600,14 @@ class VolcengineProvider extends BaseProvider {
|
|
|
600
600
|
if (event.data?.object !== 'chat.completion.chunk') return;
|
|
601
601
|
const delta = event.data.choices[0].delta;
|
|
602
602
|
if (delta.reasoning_content) return void subject.next({
|
|
603
|
-
type:
|
|
603
|
+
type: 'thinking',
|
|
604
604
|
data: {
|
|
605
605
|
model: event.data.model,
|
|
606
606
|
content: delta.reasoning_content
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
609
|
if (delta.content) return void subject.next({
|
|
610
|
-
type:
|
|
610
|
+
type: 'chunk',
|
|
611
611
|
data: {
|
|
612
612
|
model: event.data.model,
|
|
613
613
|
content: delta.content
|
|
@@ -616,7 +616,7 @@ class VolcengineProvider extends BaseProvider {
|
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
subject.next({
|
|
619
|
-
type:
|
|
619
|
+
type: 'complete',
|
|
620
620
|
data: {
|
|
621
621
|
usage: {
|
|
622
622
|
input: 0,
|
|
@@ -658,21 +658,27 @@ function llm_provider_service_ts_decorate(decorators, target, key, desc) {
|
|
|
658
658
|
class LLMProviderService {
|
|
659
659
|
call(options) {
|
|
660
660
|
const { provider, params } = options;
|
|
661
|
-
if (
|
|
661
|
+
if ('volcengine' === provider) {
|
|
662
662
|
const volcengine = new VolcengineProvider();
|
|
663
663
|
return volcengine.call(params);
|
|
664
664
|
}
|
|
665
665
|
throw new common_namespaceObject.BadRequestException('不支持该大模型提供商');
|
|
666
666
|
}
|
|
667
|
-
sse(options) {
|
|
667
|
+
async sse(options, callback) {
|
|
668
668
|
const { provider, params } = options;
|
|
669
669
|
const ProviderConstructors = {
|
|
670
|
-
|
|
670
|
+
volcengine: VolcengineProvider
|
|
671
671
|
};
|
|
672
672
|
const Constructor = ProviderConstructors[provider];
|
|
673
673
|
if (!Constructor) throw new common_namespaceObject.BadRequestException('不支持该大模型提供商');
|
|
674
674
|
const instance = new Constructor();
|
|
675
|
-
|
|
675
|
+
const subject = await instance.sse(params);
|
|
676
|
+
subject.subscribe({
|
|
677
|
+
next ({ type, data }) {
|
|
678
|
+
callback?.(type, data);
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
return subject;
|
|
676
682
|
}
|
|
677
683
|
}
|
|
678
684
|
LLMProviderService = llm_provider_service_ts_decorate([
|
|
@@ -699,9 +705,9 @@ LLMProviderModule = llm_provider_module_ts_decorate([
|
|
|
699
705
|
]
|
|
700
706
|
})
|
|
701
707
|
], LLMProviderModule);
|
|
702
|
-
var types_SupportProvider = /*#__PURE__*/ function(
|
|
703
|
-
|
|
704
|
-
return
|
|
708
|
+
var types_SupportProvider = /*#__PURE__*/ function(SupportProvider) {
|
|
709
|
+
SupportProvider["volcengine"] = "volcengine";
|
|
710
|
+
return SupportProvider;
|
|
705
711
|
}({});
|
|
706
712
|
var types_ServerSendEventName = /*#__PURE__*/ function(ServerSendEventName1) {
|
|
707
713
|
ServerSendEventName1["Received"] = "received";
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare class LLMProviderModule {
|
|
|
71
71
|
|
|
72
72
|
export declare class LLMProviderService {
|
|
73
73
|
call(options: LLMProviderCallOptions): Promise<ServerSendJsonData>;
|
|
74
|
-
sse(options: LLMProviderCallOptions): Promise<ReplaySubject<ServerSendEventData>>;
|
|
74
|
+
sse(options: LLMProviderCallOptions, callback?: ServerSendEventCallback): Promise<ReplaySubject<ServerSendEventData>>;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export declare class LoggingInterceptor implements NestInterceptor {
|
|
@@ -142,8 +142,12 @@ declare interface RouteMapping {
|
|
|
142
142
|
htmlPath: string;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
export declare type ServerSendEventCallback<T extends ServerSendEventData['type'] = ServerSendEventData['type']> = (name: T, data: Extract<ServerSendEventData, {
|
|
146
|
+
type: T;
|
|
147
|
+
}>['data']) => void;
|
|
148
|
+
|
|
145
149
|
export declare type ServerSendEventData = {
|
|
146
|
-
type:
|
|
150
|
+
type: 'received' | 'thinking' | 'processing' | 'chunk' | 'complete';
|
|
147
151
|
data: SevrverSendEventMessages[ServerSendEventData['type']];
|
|
148
152
|
};
|
|
149
153
|
|