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 +3 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
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(
|
|
29
|
+
ctx.command(commandName, { authority: 1 })
|
|
28
30
|
.alias('chat')
|
|
29
31
|
.action(async ({ session }, content) => {
|
|
30
32
|
if (!session)
|
package/package.json
CHANGED
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(
|
|
36
|
+
ctx.command(commandName, { authority: 1 })
|
|
34
37
|
.alias('chat')
|
|
35
38
|
.action(async ({ session }, content) => {
|
|
36
39
|
if (!session) return;
|