koishi-plugin-dify-ai 0.1.0 → 0.1.2
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 +13 -13
- package/package.json +11 -2
package/lib/index.js
CHANGED
|
@@ -61,35 +61,35 @@ var conditionSchema = import_koishi.Schema.union([
|
|
|
61
61
|
import_koishi.Schema.object({
|
|
62
62
|
type: import_koishi.Schema.const("keyword-prefix").required(),
|
|
63
63
|
keywords: import_koishi.Schema.string().role("textarea").required().description("关键词,每行一个")
|
|
64
|
-
}).description("关键词开头"),
|
|
64
|
+
}).default({ type: "keyword-prefix", keywords: "" }).description("关键词开头"),
|
|
65
65
|
import_koishi.Schema.object({
|
|
66
66
|
type: import_koishi.Schema.const("keyword-contains").required(),
|
|
67
67
|
keywords: import_koishi.Schema.string().role("textarea").required().description("关键词,每行一个")
|
|
68
|
-
}).description("包含关键词"),
|
|
68
|
+
}).default({ type: "keyword-contains", keywords: "" }).description("包含关键词"),
|
|
69
69
|
import_koishi.Schema.object({
|
|
70
70
|
type: import_koishi.Schema.const("at-bot").required()
|
|
71
|
-
}).description("@ 机器人"),
|
|
71
|
+
}).default({ type: "at-bot" }).description("@ 机器人"),
|
|
72
72
|
import_koishi.Schema.object({
|
|
73
73
|
type: import_koishi.Schema.const("at-user").required(),
|
|
74
74
|
userIds: import_koishi.Schema.string().role("textarea").required().description("用户 ID,每行一个")
|
|
75
|
-
}).description("@ 指定用户"),
|
|
75
|
+
}).default({ type: "at-user", userIds: "" }).description("@ 指定用户"),
|
|
76
76
|
import_koishi.Schema.object({
|
|
77
77
|
type: import_koishi.Schema.const("quote-bot").required()
|
|
78
|
-
}).description("引用机器人"),
|
|
78
|
+
}).default({ type: "quote-bot" }).description("引用机器人"),
|
|
79
79
|
import_koishi.Schema.object({
|
|
80
80
|
type: import_koishi.Schema.const("quote-user").required(),
|
|
81
81
|
userIds: import_koishi.Schema.string().role("textarea").required().description("用户 ID,每行一个")
|
|
82
|
-
}).description("引用指定用户"),
|
|
82
|
+
}).default({ type: "quote-user", userIds: "" }).description("引用指定用户"),
|
|
83
83
|
import_koishi.Schema.object({
|
|
84
84
|
type: import_koishi.Schema.const("schedule").required(),
|
|
85
85
|
cron: import_koishi.Schema.string().default("").description("Cron 表达式"),
|
|
86
86
|
intervalMinutes: import_koishi.Schema.number().default(0).min(0).description("间隔分钟")
|
|
87
|
-
}).description("定时"),
|
|
87
|
+
}).default({ type: "schedule", cron: "", intervalMinutes: 0 }).description("定时"),
|
|
88
88
|
import_koishi.Schema.object({
|
|
89
89
|
type: import_koishi.Schema.const("density").required(),
|
|
90
90
|
densityCount: import_koishi.Schema.natural().default(5).description("条数阈值"),
|
|
91
91
|
densityWindowSeconds: import_koishi.Schema.natural().default(60).description("窗口秒数")
|
|
92
|
-
}).description("消息密度")
|
|
92
|
+
}).default({ type: "density", densityCount: 5, densityWindowSeconds: 60 }).description("消息密度")
|
|
93
93
|
]);
|
|
94
94
|
var sessionKeySchema = import_koishi.Schema.union([
|
|
95
95
|
import_koishi.Schema.const("userId").description("用户 ID"),
|
|
@@ -122,15 +122,15 @@ var variableSchema = import_koishi.Schema.union([
|
|
|
122
122
|
import_koishi.Schema.object({
|
|
123
123
|
key: import_koishi.Schema.const("history").required(),
|
|
124
124
|
limit: import_koishi.Schema.natural().default(0).min(0).max(100).description("条数,0 用全局")
|
|
125
|
-
}),
|
|
125
|
+
}).default({ key: "history", limit: 0 }),
|
|
126
126
|
import_koishi.Schema.object({})
|
|
127
127
|
])
|
|
128
|
-
]).description("会话字段"),
|
|
128
|
+
]).default({ source: "session", field: "", key: "content" }).description("会话字段"),
|
|
129
129
|
import_koishi.Schema.object({
|
|
130
130
|
source: import_koishi.Schema.const("meta").required(),
|
|
131
131
|
field: import_koishi.Schema.string().required().description("字段名"),
|
|
132
132
|
key: metaKeySchema.default("triggerType").description("变量")
|
|
133
|
-
}).description("触发元信息")
|
|
133
|
+
}).default({ source: "meta", field: "", key: "triggerType" }).description("触发元信息")
|
|
134
134
|
]);
|
|
135
135
|
var Config = import_koishi.Schema.intersect([
|
|
136
136
|
import_koishi.Schema.object({
|
|
@@ -292,8 +292,8 @@ function normalizeConfig(config) {
|
|
|
292
292
|
const rules = [];
|
|
293
293
|
for (const entry of config.rules ?? []) {
|
|
294
294
|
if (!entry.name?.trim() || entry.enabled === false) continue;
|
|
295
|
-
const conditions = (entry.conditions ?? []).map(toCondition).filter((condition) => condition != null);
|
|
296
|
-
const variables = (entry.variables ?? []).map(toVariable).filter((variable) => variable != null);
|
|
295
|
+
const conditions = (entry.conditions ?? []).filter((condition) => condition != null).map(toCondition).filter((condition) => condition != null);
|
|
296
|
+
const variables = (entry.variables ?? []).filter((variable) => variable != null).map(toVariable).filter((variable) => variable != null);
|
|
297
297
|
rules.push({
|
|
298
298
|
name: entry.name.trim(),
|
|
299
299
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-dify-ai",
|
|
3
3
|
"description": "Invoke Dify apps (chatflow / workflow / completion) in Koishi with triggers and conversation bindings",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"author": "PinkElysia",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/PinkElysiaDev/dify-ai-plugin-for-Koishi#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/PinkElysiaDev/dify-ai-plugin-for-Koishi.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/PinkElysiaDev/dify-ai-plugin-for-Koishi/issues"
|
|
14
|
+
},
|
|
5
15
|
"main": "lib/index.js",
|
|
6
16
|
"typings": "lib/index.d.ts",
|
|
7
17
|
"files": [
|
|
8
18
|
"lib"
|
|
9
19
|
],
|
|
10
|
-
"license": "MIT",
|
|
11
20
|
"keywords": [
|
|
12
21
|
"chatbot",
|
|
13
22
|
"koishi",
|