koishi-plugin-booth-get 3.0.0 → 3.1.0
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 +28 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -127,6 +127,7 @@ function apply(ctx, config) {
|
|
|
127
127
|
return "截图失败。";
|
|
128
128
|
}).finally(() => page.close());
|
|
129
129
|
});
|
|
130
|
+
|
|
130
131
|
ctx.command("摊位名称 <query>").action(async ({ session }, query) => {
|
|
131
132
|
if (!query)
|
|
132
133
|
return "请输入搜索关键词";
|
|
@@ -203,6 +204,23 @@ ctx.middleware((session, next) => {
|
|
|
203
204
|
|
|
204
205
|
return next();
|
|
205
206
|
});
|
|
207
|
+
function sendItemImage(itemId) {
|
|
208
|
+
fetch(`http://127.0.0.1:8080/generate_image/${itemId}`)
|
|
209
|
+
.then(response => {
|
|
210
|
+
if (response.ok) {
|
|
211
|
+
return response.blob();
|
|
212
|
+
} else {
|
|
213
|
+
throw new Error('Image generation failed');
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
.then(blob => {
|
|
217
|
+
const imageUrl = URL.createObjectURL(blob);
|
|
218
|
+
console.log(imageUrl);
|
|
219
|
+
})
|
|
220
|
+
.catch(error => {
|
|
221
|
+
console.error(error);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
206
224
|
}
|
|
207
225
|
__name(apply, "apply");
|
|
208
226
|
0 && (module.exports = {
|
|
@@ -210,4 +228,13 @@ __name(apply, "apply");
|
|
|
210
228
|
apply,
|
|
211
229
|
inject,
|
|
212
230
|
name
|
|
213
|
-
});
|
|
231
|
+
});
|
|
232
|
+
async function triggerImageGeneration() {
|
|
233
|
+
try {
|
|
234
|
+
const response = await fetch('http://localhost:8000/generate');
|
|
235
|
+
const data = await response.json();
|
|
236
|
+
console.log(data.message); // Log the response from the server
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.error('Error calling the API:', error);
|
|
239
|
+
}
|
|
240
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-booth-get",
|
|
3
3
|
"description": "通过url与名称检查摊位物品并反馈用户搜索的图片",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"rixiang <1148147857@qq.com>"
|
|
7
7
|
],
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"booth"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"koishi": "4.
|
|
32
|
+
"koishi": "4.18.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"atsc": "^2.1.0",
|