koishi-plugin-chatluna-google-gemini-adapter 1.0.0-beta.23 → 1.0.0-beta.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
- ## chatluna-google-gemini-adapter
2
-
3
- ## [![npm](https://img.shields.io/npm/v/koishi-plugin-chatluna-google-gemini-adapter/next)](https://www.npmjs.com/package/koishi-plugin-chatluna-google-gemini) [![npm](https://img.shields.io/npm/dm/koishi-plugin-chatluna-google-gemini-adapter)](https://www.npmjs.com/package//koishi-plugin-chatluna-google-gemini-adapter)
4
-
5
- > 为 ChatHub 提供 Google-gemini 支持的适配器
6
-
7
- [Google-gemini 适配器文档](https://chatluna.dingyi222666.top/guide/configure-model-platform/google-gemini.html)
1
+ ## chatluna-google-gemini-adapter
2
+
3
+ ## [![npm](https://img.shields.io/npm/v/koishi-plugin-chatluna-google-gemini-adapter/next)](https://www.npmjs.com/package/koishi-plugin-chatluna-google-gemini) [![npm](https://img.shields.io/npm/dm/koishi-plugin-chatluna-google-gemini-adapter)](https://www.npmjs.com/package//koishi-plugin-chatluna-google-gemini-adapter)
4
+
5
+ > 为 ChatHub 提供 Google-gemini 支持的适配器
6
+
7
+ [Google-gemini 适配器文档](https://chatluna.chat/guide/configure-model-platform/google-gemini.html)
package/lib/index.cjs CHANGED
@@ -3,6 +3,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __commonJS = (cb, mod) => function __require() {
7
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ };
6
9
  var __export = (target, all) => {
7
10
  for (var name2 in all)
8
11
  __defProp(target, name2, { get: all[name2], enumerable: true });
@@ -17,6 +20,20 @@ var __copyProps = (to, from, except, desc) => {
17
20
  };
18
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
22
 
23
+ // src/locales/zh-CN.schema.yml
24
+ var require_zh_CN_schema = __commonJS({
25
+ "src/locales/zh-CN.schema.yml"(exports2, module2) {
26
+ module2.exports = { inner: [{}, { $desc: "请求选项", apiKeys: { $inner: ["Gemini 的 API Key", "Gemini API 的请求地址"], $desc: "Gemini 的 API Key 和请求地址列表。" } }, { $desc: "模型配置", maxTokens: "回复的最大 Token 数(16~2097000,必须是 16 的倍数)。注意:仅当您使用的模型最大 Token 为 8000 及以上时,才建议设置超过 2000 token。", temperature: "回复的随机性程度,数值越高,回复越随机(范围:0~2)。" }] };
27
+ }
28
+ });
29
+
30
+ // src/locales/en-US.schema.yml
31
+ var require_en_US_schema = __commonJS({
32
+ "src/locales/en-US.schema.yml"(exports2, module2) {
33
+ module2.exports = { $inner: [{}, { $desc: "API Configuration", apiKeys: { $inner: ["Gemini API Key", "Gemini API Endpoint (optional)"], $desc: "Gemini API access credentials" } }, { $desc: "Model Parameters", maxTokens: "Max output tokens (16-2097000, multiple of 16). >2000 for 8k+ models", temperature: "Sampling temperature (0-2). Higher: more random, Lower: more deterministic" }] };
34
+ }
35
+ });
36
+
20
37
  // src/index.ts
21
38
  var src_exports = {};
22
39
  __export(src_exports, {
@@ -477,6 +494,7 @@ var GeminiRequester = class extends import_api.ModelRequester {
477
494
  }
478
495
  }
479
496
  const body = JSON.stringify(data);
497
+ console.log(body);
480
498
  return this._plugin.fetch(requestUrl, {
481
499
  body,
482
500
  headers: this._buildHeaders(),
@@ -628,19 +646,22 @@ var Config = import_koishi.Schema.intersect([
628
646
  import_koishi.Schema.object({
629
647
  apiKeys: import_koishi.Schema.array(
630
648
  import_koishi.Schema.tuple([
631
- import_koishi.Schema.string().role("secret").description("Gemini 的 API Key").required(),
632
- import_koishi.Schema.string().description("请求 Gemini API 的地址").default("https://generativelanguage.googleapis.com/v1beta")
649
+ import_koishi.Schema.string().role("secret"),
650
+ import_koishi.Schema.string().default(
651
+ "https://generativelanguage.googleapis.com/v1beta"
652
+ )
633
653
  ])
634
- ).description("Gemini 的 API Key 和请求地址列表").default([["", "https://generativelanguage.googleapis.com/v1beta"]])
635
- }).description("请求设置"),
654
+ ).default([["", "https://generativelanguage.googleapis.com/v1beta"]])
655
+ }),
636
656
  import_koishi.Schema.object({
637
- maxTokens: import_koishi.Schema.number().description(
638
- "回复的最大 Token 数(16~2097000,必须是16的倍数)(注意如果你目前使用的模型的最大 Token 为 8000 及以上的话才建议设置超过 512 token)"
639
- ).min(16).max(2097e3).step(16).default(8064),
640
- temperature: import_koishi.Schema.percent().description("回复温度,越高越随机").min(0).max(2).step(0.1).default(0.8)
641
- }).description("模型设置")
657
+ maxTokens: import_koishi.Schema.number().min(16).max(2097e3).step(16).default(8064),
658
+ temperature: import_koishi.Schema.percent().min(0).max(2).step(0.1).default(0.8)
659
+ })
660
+ ]).i18n({
661
+ "zh-CN": require_zh_CN_schema(),
662
+ "en-US": require_en_US_schema()
642
663
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
643
- ]);
664
+ });
644
665
  var inject = ["chatluna"];
645
666
  var name = "chatluna-google-gemini-adapter";
646
667
  // Annotate the CommonJS export names for ESM import in node:
package/lib/index.mjs CHANGED
@@ -1,5 +1,23 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __commonJS = (cb, mod) => function __require() {
5
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
+ };
7
+
8
+ // src/locales/zh-CN.schema.yml
9
+ var require_zh_CN_schema = __commonJS({
10
+ "src/locales/zh-CN.schema.yml"(exports, module) {
11
+ module.exports = { inner: [{}, { $desc: "请求选项", apiKeys: { $inner: ["Gemini 的 API Key", "Gemini API 的请求地址"], $desc: "Gemini 的 API Key 和请求地址列表。" } }, { $desc: "模型配置", maxTokens: "回复的最大 Token 数(16~2097000,必须是 16 的倍数)。注意:仅当您使用的模型最大 Token 为 8000 及以上时,才建议设置超过 2000 token。", temperature: "回复的随机性程度,数值越高,回复越随机(范围:0~2)。" }] };
12
+ }
13
+ });
14
+
15
+ // src/locales/en-US.schema.yml
16
+ var require_en_US_schema = __commonJS({
17
+ "src/locales/en-US.schema.yml"(exports, module) {
18
+ module.exports = { $inner: [{}, { $desc: "API Configuration", apiKeys: { $inner: ["Gemini API Key", "Gemini API Endpoint (optional)"], $desc: "Gemini API access credentials" } }, { $desc: "Model Parameters", maxTokens: "Max output tokens (16-2097000, multiple of 16). >2000 for 8k+ models", temperature: "Sampling temperature (0-2). Higher: more random, Lower: more deterministic" }] };
19
+ }
20
+ });
3
21
 
4
22
  // src/index.ts
5
23
  import { ChatLunaPlugin } from "koishi-plugin-chatluna/services/chat";
@@ -470,6 +488,7 @@ var GeminiRequester = class extends ModelRequester {
470
488
  }
471
489
  }
472
490
  const body = JSON.stringify(data);
491
+ console.log(body);
473
492
  return this._plugin.fetch(requestUrl, {
474
493
  body,
475
494
  headers: this._buildHeaders(),
@@ -621,19 +640,22 @@ var Config = Schema.intersect([
621
640
  Schema.object({
622
641
  apiKeys: Schema.array(
623
642
  Schema.tuple([
624
- Schema.string().role("secret").description("Gemini 的 API Key").required(),
625
- Schema.string().description("请求 Gemini API 的地址").default("https://generativelanguage.googleapis.com/v1beta")
643
+ Schema.string().role("secret"),
644
+ Schema.string().default(
645
+ "https://generativelanguage.googleapis.com/v1beta"
646
+ )
626
647
  ])
627
- ).description("Gemini 的 API Key 和请求地址列表").default([["", "https://generativelanguage.googleapis.com/v1beta"]])
628
- }).description("请求设置"),
648
+ ).default([["", "https://generativelanguage.googleapis.com/v1beta"]])
649
+ }),
629
650
  Schema.object({
630
- maxTokens: Schema.number().description(
631
- "回复的最大 Token 数(16~2097000,必须是16的倍数)(注意如果你目前使用的模型的最大 Token 为 8000 及以上的话才建议设置超过 512 token)"
632
- ).min(16).max(2097e3).step(16).default(8064),
633
- temperature: Schema.percent().description("回复温度,越高越随机").min(0).max(2).step(0.1).default(0.8)
634
- }).description("模型设置")
651
+ maxTokens: Schema.number().min(16).max(2097e3).step(16).default(8064),
652
+ temperature: Schema.percent().min(0).max(2).step(0.1).default(0.8)
653
+ })
654
+ ]).i18n({
655
+ "zh-CN": require_zh_CN_schema(),
656
+ "en-US": require_en_US_schema()
635
657
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
636
- ]);
658
+ });
637
659
  var inject = ["chatluna"];
638
660
  var name = "chatluna-google-gemini-adapter";
639
661
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-google-gemini-adapter",
3
3
  "description": "google-gemini adapter for chatluna",
4
- "version": "1.0.0-beta.23",
4
+ "version": "1.0.0-beta.24",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -48,22 +48,23 @@
48
48
  "adapter"
49
49
  ],
50
50
  "dependencies": {
51
- "@langchain/core": "^0.2.31",
51
+ "@langchain/core": "^0.3.3",
52
52
  "@streamparser/json": "^0.0.21",
53
53
  "zod": "^3.24.0-canary.20240701T200529",
54
- "zod-to-json-schema": "^3.23.2"
54
+ "zod-to-json-schema": "^3.23.3"
55
55
  },
56
56
  "devDependencies": {
57
57
  "atsc": "^2.1.0",
58
- "koishi": "^4.17.12"
58
+ "koishi": "^4.18.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "koishi": "^4.17.12",
62
- "koishi-plugin-chatluna": "^1.0.0-beta.87"
61
+ "koishi": "^4.18.0",
62
+ "koishi-plugin-chatluna": "^1.0.0-beta.90"
63
63
  },
64
64
  "koishi": {
65
65
  "description": {
66
- "zh": "ChatLuna 的 Google gemini 平台适配器"
66
+ "zh": "ChatLuna 的 Google Gemini 适配器",
67
+ "en": "Google Gemini adapter for ChatLuna"
67
68
  },
68
69
  "service": {
69
70
  "required": [