koishi-plugin-openai-compatible 1.0.7 → 1.0.8

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/index.js CHANGED
@@ -13,6 +13,8 @@ exports.inject = {
13
13
  function apply(ctx, config) {
14
14
  // 导出配置 Schema
15
15
  ctx.i18n.define('zh', require('./locales/zh'));
16
+ // 确保命令名称存在且有效
17
+ const commandName = config.commandName || 'ai';
16
18
  // 初始化存储
17
19
  const storage = new storage_1.Storage();
18
20
  // 初始化 API 客户端
@@ -24,7 +26,7 @@ function apply(ctx, config) {
24
26
  emotionAnalyzer = new emotion_1.EmotionAnalyzer(emotionApi, config);
25
27
  }
26
28
  // 注册命令
27
- ctx.command(config.commandName, { authority: 1 })
29
+ ctx.command(commandName, { authority: 1 })
28
30
  .alias('chat')
29
31
  .action(async ({ session }, content) => {
30
32
  if (!session)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-openai-compatible",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "这是一个适用于Koishi的OpenAI兼容聊天插件,支持与所有兼容OpenAI API的大模型进行聊天交互。",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -16,6 +16,9 @@ export function apply(ctx: Context, config: Config) {
16
16
  // 导出配置 Schema
17
17
  ctx.i18n.define('zh', require('./locales/zh'));
18
18
 
19
+ // 确保命令名称存在且有效
20
+ const commandName = config.commandName || 'ai';
21
+
19
22
  // 初始化存储
20
23
  const storage = new Storage();
21
24
 
@@ -30,7 +33,7 @@ export function apply(ctx: Context, config: Config) {
30
33
  }
31
34
 
32
35
  // 注册命令
33
- ctx.command(config.commandName, { authority: 1 })
36
+ ctx.command(commandName, { authority: 1 })
34
37
  .alias('chat')
35
38
  .action(async ({ session }, content) => {
36
39
  if (!session) return;