alemonjs-aichat 1.0.0 → 1.0.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  ## 安装
3
3
  - alemongo安装方式
4
+
4
5
  地址
5
6
  ```
6
7
  https://gitee.com/suancaixianyu/alemonjs-aichat.git
@@ -13,6 +14,29 @@ release
13
14
 
14
15
  - npm安装方式
15
16
 
17
+ ```
18
+ # 使用npm
19
+ npm i alemonjs-aichat
20
+
21
+ # 使用yarn
22
+ yarn add alemonjs-aichat
23
+ ```
24
+
25
+ 配置`alemon.config.yaml`
26
+ ``` yaml
27
+ app:
28
+ - 'alemonjs-aichat'
29
+ ```
30
+
31
+ ## 配置redis
32
+ `alemon.config.yaml`
33
+ ``` yaml
34
+ redis:
35
+ host: 'localhost'
36
+ port: 6379
37
+ password: ''
38
+
39
+ ```
16
40
 
17
41
  ## 使用
18
42
  指令`/ai帮助`查看使用方法
@@ -34,11 +34,13 @@ var mw = onMiddleware(selects, async (event, next) => {
34
34
  return id === event.UserId.toString();
35
35
  });
36
36
  if (!cachedMembers || !userInCache) {
37
- const list = await client.getGroupMemberList({
38
- group_id: event.ChannelId,
39
- });
40
- const memberNames = list[0].data.map((item) => item.user_id + ":" + item.nickname);
41
- await redis.set(redisKey, JSON.stringify(memberNames));
37
+ if (event.ChannelId) {
38
+ const list = await client.getGroupMemberList({
39
+ group_id: event.ChannelId,
40
+ });
41
+ const memberNames = list[0].data.map((item) => item.user_id + ":" + item.nickname);
42
+ await redis.set(redisKey, JSON.stringify(memberNames));
43
+ }
42
44
  }
43
45
  event["self_id"] = event.value.self_id;
44
46
  event["originalMsg"] = event.value.message;
@@ -1,3 +1,4 @@
1
+ import { getAIConfig } from '../../config.js';
1
2
  import { useMessage, Text } from 'alemonjs';
2
3
 
3
4
  const selects = onSelects(["message.create", "private.message.create"]);
@@ -9,6 +10,12 @@ var res = onResponse(selects, async (e, next) => {
9
10
  // 查看指令帮助
10
11
  if (regular$1.test(e.msg)) {
11
12
  message.send(format(Text("当前支持的指令有:\n"), Text("/ai配置 - 查看当前AI配置\n"), Text("/ai列表 - 查看当前AI列表\n"), Text("/切换ai - 切换AI\n"), Text("/提示词列表 - 查看当前提示词列表\n"), Text("/添加提示词 - 添加新的设定\n"), Text("/清空对话 - 清空与AI的对话记录\n"), Text("/好感度 - 查看当前用户的好感度\n")));
13
+ const config = await getAIConfig(e.guid);
14
+ if (config.host.trim() === "" ||
15
+ config.key.trim() === "" ||
16
+ config.model.trim() === "") {
17
+ message.send(format(Text("当前配置不完整,请使用 /切换ai 指令切换到可用的配置")));
18
+ }
12
19
  return;
13
20
  }
14
21
  next();
package/package.json CHANGED
@@ -1,73 +1,72 @@
1
- {
2
- "name": "alemonjs-aichat",
3
- "version": "1.0.0",
4
- "description": "alemonjs-aichat",
5
- "author": "suancaixianyu",
6
- "license": "MIT",
7
- "main": "lib/index.js",
8
- "type": "module",
9
- "scripts": {
10
- "dev": "npx lvy dev",
11
- "build": "npx lvy build",
12
- "review": "npx alemonc start",
13
- "start": "npx pm2 startOrRestart pm2.config.cjs",
14
- "stop": "npx pm2 stop pm2.config.cjs",
15
- "delete": "npx pm2 delete pm2.config.cjs"
16
- },
17
- "devDependencies": {
18
- "@alemonjs/db": "^0.0.13",
19
- "@types/node": "^22",
20
- "alemonjs": "2.1.14",
21
- "cssnano": "^7",
22
- "jsxp": "^1.2.3",
23
- "lvyjs": "^0.2.25",
24
- "pm2": "^5",
25
- "tailwindcss": "3",
26
- "@alemonjs/bubble": "^2.1.0-alpha.12",
27
- "@alemonjs/onebot": "^2.1.0-alpha.14"
28
- },
29
- "dependencies": {},
30
- "export": {
31
- ".": "./lib/index.js",
32
- "./package": "./package.json",
33
- "./desktop": "./lib/desktop.js"
34
- },
35
- "exports": {
36
- ".": "./lib/index.js",
37
- "./package": "./package.json",
38
- "./desktop": "./lib/desktop.js"
39
- },
40
- "publishConfig": {
41
- "registry": "https://registry.npmjs.org",
42
- "access": "public"
43
- },
44
- "repository": {
45
- "type": "gitee",
46
- "url": "https://gitee.com/suancaixianyu/alemonjs-aichat.git"
47
- },
48
- "files": [
49
- "lib/**/*",
50
- "public/**/*",
51
- "config/**/*"
52
- ],
53
- "keywords": [
54
- "alemonjs"
55
- ],
56
- "bugs": "https://gitee.com/suancaixianyu/alemonjs-aichat/issues",
57
- "alemonjs": {
58
- "desktop": {
59
- "commond": [
60
- {
61
- "name": "cheese",
62
- "commond": "open.cheese"
63
- }
64
- ],
65
- "sidebars": [
66
- {
67
- "name": "cheese",
68
- "commond": "open.cheese"
69
- }
70
- ]
71
- }
72
- }
1
+ {
2
+ "name": "alemonjs-aichat",
3
+ "version": "1.0.2",
4
+ "description": "alemonjs-aichat",
5
+ "author": "suancaixianyu",
6
+ "license": "MIT",
7
+ "main": "lib/index.js",
8
+ "type": "module",
9
+ "scripts": {
10
+ "dev": "npx lvy dev",
11
+ "build": "npx lvy build",
12
+ "review": "npx alemonc start",
13
+ "start": "npx pm2 startOrRestart pm2.config.cjs",
14
+ "stop": "npx pm2 stop pm2.config.cjs",
15
+ "delete": "npx pm2 delete pm2.config.cjs"
16
+ },
17
+ "devDependencies": {
18
+ "@alemonjs/bubble": "^2.1.0-alpha.12",
19
+ "@alemonjs/db": "^0.0.13",
20
+ "@alemonjs/onebot": "^2.1.0-alpha.14",
21
+ "@types/node": "^22",
22
+ "alemonjs": "2.1.14",
23
+ "cssnano": "^7",
24
+ "jsxp": "^1.2.3",
25
+ "lvyjs": "^0.2.25",
26
+ "pm2": "^5",
27
+ "tailwindcss": "3"
28
+ },
29
+ "export": {
30
+ ".": "./lib/index.js",
31
+ "./package": "./package.json",
32
+ "./desktop": "./lib/desktop.js"
33
+ },
34
+ "exports": {
35
+ ".": "./lib/index.js",
36
+ "./package": "./package.json",
37
+ "./desktop": "./lib/desktop.js"
38
+ },
39
+ "publishConfig": {
40
+ "registry": "https://registry.npmjs.org",
41
+ "access": "public"
42
+ },
43
+ "repository": {
44
+ "type": "gitee",
45
+ "url": "https://gitee.com/suancaixianyu/alemonjs-aichat.git"
46
+ },
47
+ "files": [
48
+ "lib/**/*",
49
+ "public/**/*",
50
+ "config/**/*"
51
+ ],
52
+ "keywords": [
53
+ "alemonjs"
54
+ ],
55
+ "bugs": "https://gitee.com/suancaixianyu/alemonjs-aichat/issues",
56
+ "alemonjs": {
57
+ "desktop": {
58
+ "commond": [
59
+ {
60
+ "name": "cheese",
61
+ "commond": "open.cheese"
62
+ }
63
+ ],
64
+ "sidebars": [
65
+ {
66
+ "name": "cheese",
67
+ "commond": "open.cheese"
68
+ }
69
+ ]
70
+ }
71
+ }
73
72
  }