listpage-next-nest 0.0.152 → 0.0.162

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.
@@ -760,6 +760,12 @@ class MetaProvider extends BaseProvider {
760
760
  super(...args), this.baseURL = 'https://metaso.cn/api/v1/chat/completions';
761
761
  }
762
762
  }
763
+ function compilePrompt(prompt, params) {
764
+ const compiled = (0, external_lodash_namespaceObject.template)(prompt, {
765
+ interpolate: /{{([\s\S]+?)}}/g
766
+ });
767
+ return compiled(params);
768
+ }
763
769
  function llm_provider_service_ts_decorate(decorators, target, key, desc) {
764
770
  var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
765
771
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
@@ -779,6 +785,26 @@ class LLMProviderService {
779
785
  }
780
786
  throw new common_namespaceObject.BadRequestException('不支持该大模型提供商');
781
787
  }
788
+ async run(options) {
789
+ const { system, user, data = {}, provider, params } = options;
790
+ const messages = [
791
+ {
792
+ role: 'system',
793
+ content: compilePrompt(system, data)
794
+ },
795
+ {
796
+ role: 'user',
797
+ content: user
798
+ }
799
+ ];
800
+ return this.call({
801
+ provider,
802
+ params: {
803
+ ...params,
804
+ messages
805
+ }
806
+ });
807
+ }
782
808
  async sse(options, callback) {
783
809
  const { provider, params } = options;
784
810
  const ProviderConstructors = {
@@ -78,8 +78,17 @@ export declare type LLMProviderCallOptions = {
78
78
  export declare class LLMProviderModule {
79
79
  }
80
80
 
81
+ export declare type LLMProviderRunOptions = {
82
+ system: string;
83
+ user: string;
84
+ data?: any;
85
+ provider: SupportProvider;
86
+ params: Omit<ProviderParams[LLMProviderRunOptions['provider']], 'messages'>;
87
+ };
88
+
81
89
  export declare class LLMProviderService {
82
90
  call(options: LLMProviderCallOptions): Promise<ServerSendJsonData>;
91
+ run(options: LLMProviderRunOptions): Promise<ServerSendJsonData>;
83
92
  sse(options: LLMProviderCallOptions, callback?: ServerSendEventCallback): Promise<ReplaySubject<ServerSendEventData>>;
84
93
  }
85
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next-nest",
3
- "version": "0.0.152",
3
+ "version": "0.0.162",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",