koishi-plugin-chatluna-character 0.0.38 → 0.0.40

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.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Context, Schema } from 'koishi';
2
2
  import { ChatLunaPlugin } from 'koishi-plugin-chatluna/lib/services/chat';
3
+ import { GuildConfig } from './types';
3
4
  export declare function apply(ctx: Context, config: Config): void;
4
5
  export declare const inject: {
5
6
  required: string[];
@@ -9,13 +10,13 @@ export interface Config extends ChatLunaPlugin.Config {
9
10
  model: string;
10
11
  maxMessages: number;
11
12
  messageInterval: number;
12
- checkPromptInject: boolean;
13
13
  maxTokens: number;
14
14
  applyGroup: string[];
15
15
  modelOverride: {
16
16
  groupId: string;
17
17
  model: string;
18
18
  }[];
19
+ configs: Record<string, GuildConfig>;
19
20
  defaultPreset: string;
20
21
  isNickname: boolean;
21
22
  isForceMute: boolean;
@@ -23,7 +24,8 @@ export interface Config extends ChatLunaPlugin.Config {
23
24
  coolDownTime: number;
24
25
  typingTime: number;
25
26
  muteTime: number;
26
- disableChatHub: boolean;
27
+ disableChatLuna: boolean;
28
+ whiteListDisableChatLuna: string[];
27
29
  }
28
30
  export declare const Config: Schema<Config>;
29
31
  export declare const name = "chatluna-character";
package/lib/index.js CHANGED
@@ -21,13 +21,20 @@ function apply(ctx, config) {
21
21
  },
22
22
  name: 'chatluna_entry_point'
23
23
  }, config);
24
- disposables.push(ctx.on('message', async (session) => {
24
+ disposables.push(ctx.middleware(async (session, next) => {
25
25
  if (!ctx.chatluna_character) {
26
- return;
26
+ return next();
27
27
  }
28
- if (!session.isDirect &&
29
- config.applyGroup.some((group) => group === session.guildId)) {
30
- await ctx.chatluna_character.broadcast(session);
28
+ // 不接收自己的消息
29
+ if (ctx.bots[session.uid]) {
30
+ return next();
31
+ }
32
+ const guildId = session.guildId;
33
+ if (!config.applyGroup.includes(guildId)) {
34
+ return next();
35
+ }
36
+ if (!(await ctx.chatluna_character.broadcast(session))) {
37
+ return next();
31
38
  }
32
39
  }));
33
40
  ctx.on('dispose', () => {
@@ -47,10 +54,11 @@ exports.Config = koishi_1.Schema.intersect([
47
54
  .default(10)
48
55
  .min(7)
49
56
  .role('slider')
50
- .max(40),
51
- disableChatHub: koishi_1.Schema.boolean()
57
+ .max(100),
58
+ disableChatLuna: koishi_1.Schema.boolean()
52
59
  .default(true)
53
- .description('在使用此插件时,是否禁用 chathub 的功能')
60
+ .description('在使用此插件的群聊里,是否禁用 ChatLuna 主功能'),
61
+ whiteListDisableChatLuna: koishi_1.Schema.array(koishi_1.Schema.string()).description('在使用此插件时,不禁用 ChatLuna 主功能的群聊列表')
54
62
  }).description('基础配置'),
55
63
  koishi_1.Schema.object({
56
64
  model: koishi_1.Schema.dynamic('model').description('使用的模型'),
@@ -61,7 +69,7 @@ exports.Config = koishi_1.Schema.intersect([
61
69
  maxTokens: koishi_1.Schema.number()
62
70
  .default(2048)
63
71
  .min(1024)
64
- .max(8072)
72
+ .max(16000)
65
73
  .description('使用聊天的最大 token 数')
66
74
  }).description('模型配置'),
67
75
  koishi_1.Schema.object({
@@ -75,7 +83,7 @@ exports.Config = koishi_1.Schema.intersect([
75
83
  .default(14)
76
84
  .min(0)
77
85
  .role('slider')
78
- .max(30)
86
+ .max(50)
79
87
  .description('随机发送消息的间隔'),
80
88
  coolDownTime: koishi_1.Schema.number()
81
89
  .default(10)
@@ -86,7 +94,7 @@ exports.Config = koishi_1.Schema.intersect([
86
94
  .default(440)
87
95
  .min(100)
88
96
  .role('slider')
89
- .max(1000)
97
+ .max(1500)
90
98
  .description('模拟打字时的间隔(毫秒)'),
91
99
  muteTime: koishi_1.Schema.number()
92
100
  .default(1000 * 60)
@@ -99,12 +107,59 @@ exports.Config = koishi_1.Schema.intersect([
99
107
  .max(1)
100
108
  .role('slider')
101
109
  .step(0.01)
102
- .description('发送表情的概率')
103
- }).description('对话设置'),
104
- koishi_1.Schema.object({
110
+ .description('发送表情的概率'),
105
111
  defaultPreset: koishi_1.Schema.dynamic('character-preset')
106
112
  .description('使用的伪装预设')
107
113
  .default('旧梦旧念')
108
- })
114
+ }).description('对话设置'),
115
+ koishi_1.Schema.object({
116
+ configs: koishi_1.Schema.dict(koishi_1.Schema.object({
117
+ maxTokens: koishi_1.Schema.number()
118
+ .default(2048)
119
+ .min(1024)
120
+ .max(16000)
121
+ .description('使用聊天的最大 token 数'),
122
+ isNickname: koishi_1.Schema.boolean()
123
+ .description('允许 bot 配置中的昵称引发回复')
124
+ .default(true),
125
+ isForceMute: koishi_1.Schema.boolean()
126
+ .description('是否启用强制禁言(当聊天涉及到关键词时则会禁言,关键词需要在预设文件里配置)')
127
+ .default(true),
128
+ messageInterval: koishi_1.Schema.number()
129
+ .default(14)
130
+ .min(0)
131
+ .role('slider')
132
+ .max(50)
133
+ .description('随机发送消息的间隔'),
134
+ coolDownTime: koishi_1.Schema.number()
135
+ .default(10)
136
+ .min(1)
137
+ .max(60 * 24)
138
+ .description('冷却发言时间(秒)'),
139
+ typingTime: koishi_1.Schema.number()
140
+ .default(440)
141
+ .min(100)
142
+ .role('slider')
143
+ .max(1500)
144
+ .description('模拟打字时的间隔(毫秒)'),
145
+ muteTime: koishi_1.Schema.number()
146
+ .default(1000 * 60)
147
+ .min(1000)
148
+ .max(1000 * 60 * 10 * 10)
149
+ .description('闭嘴时的禁言时间(毫秒)'),
150
+ sendStickerProbability: koishi_1.Schema.number()
151
+ .default(0.6)
152
+ .min(0)
153
+ .max(1)
154
+ .role('slider')
155
+ .step(0.01)
156
+ .description('发送表情的概率'),
157
+ preset: koishi_1.Schema.dynamic('character-preset')
158
+ .description('使用的伪装预设')
159
+ .default('旧梦旧念')
160
+ }))
161
+ .role('table')
162
+ .description('分群配置,会覆盖上面的默认配置(键填写群号)')
163
+ }).description('分群配置')
109
164
  ]);
110
165
  exports.name = 'chatluna-character';
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.apply = void 0;
4
+ const messages_1 = require("@langchain/core/messages");
4
5
  const koishi_1 = require("koishi");
5
6
  const count_tokens_1 = require("koishi-plugin-chatluna/lib/llm-core/utils/count_tokens");
6
- const messages_1 = require("@langchain/core/messages");
7
7
  let logger;
8
8
  async function apply(ctx, config) {
9
9
  const service = ctx.chatluna_character;
@@ -28,25 +28,37 @@ async function apply(ctx, config) {
28
28
  })();
29
29
  }
30
30
  }
31
- const selectedPreset = await preset.getPreset(config.defaultPreset);
32
- const systemPrompt = selectedPreset.system;
33
- const completionPrompt = selectedPreset.input;
31
+ const globalPreset = await preset.getPreset(config.defaultPreset);
32
+ const presetPool = {};
34
33
  service.collect(async (session, messages) => {
35
- const groupId = session.event.guild?.id ?? session.guildId;
36
- const model = await (modelPool[groupId] ?? Promise.resolve(globalModel));
37
- const [recentMessage, lastMessage] = await formatMessage(messages, config, model, systemPrompt.template, completionPrompt.template);
34
+ const guildId = session.event.guild?.id ?? session.guildId;
35
+ const model = await (modelPool[guildId] ?? Promise.resolve(globalModel));
36
+ const currentGuildConfig = config.configs[guildId];
37
+ let copyOfConfig = Object.assign({}, config);
38
+ let currentPreset = globalPreset;
39
+ if (currentGuildConfig != null) {
40
+ copyOfConfig = Object.assign({}, copyOfConfig, currentGuildConfig);
41
+ currentPreset =
42
+ presetPool[guildId] ??
43
+ (() => {
44
+ const template = preset.getPresetForCache(currentGuildConfig.preset);
45
+ presetPool[guildId] = template;
46
+ return template;
47
+ })();
48
+ }
49
+ const [recentMessage, lastMessage] = await formatMessage(messages, copyOfConfig, model, currentPreset.system.template, currentPreset.system.template);
38
50
  const temp = await service.getTemp(session);
39
- const formattedSystemPrompt = await systemPrompt.format({
51
+ const formattedSystemPrompt = await currentPreset.system.format({
40
52
  time: new Date().toLocaleString()
41
53
  });
42
54
  logger.debug('messages_new: ' + JSON.stringify(recentMessage));
43
55
  logger.debug('messages_last: ' + JSON.stringify(lastMessage));
44
- const humanMessage = new messages_1.HumanMessage(await completionPrompt.format({
56
+ const humanMessage = new messages_1.HumanMessage(await currentPreset.input.format({
45
57
  history_new: recentMessage,
46
58
  history_last: lastMessage,
47
59
  time: new Date().toLocaleString()
48
60
  }));
49
- const completionMessages = await formatCompletionMessages([new messages_1.SystemMessage(formattedSystemPrompt)].concat(temp.completionMessages), humanMessage, config, model);
61
+ const completionMessages = await formatCompletionMessages([new messages_1.SystemMessage(formattedSystemPrompt)].concat(temp.completionMessages), humanMessage, copyOfConfig, model);
50
62
  logger.debug('completion message: ' +
51
63
  JSON.stringify(completionMessages.map((it) => it.content)));
52
64
  let responseMessage;
@@ -72,7 +84,7 @@ async function apply(ctx, config) {
72
84
  return;
73
85
  }
74
86
  if (response.length < 1) {
75
- service.mute(session, config.muteTime);
87
+ service.mute(session, copyOfConfig.muteTime);
76
88
  return;
77
89
  }
78
90
  temp.completionMessages.push(humanMessage, responseMessage);
@@ -86,7 +98,7 @@ async function apply(ctx, config) {
86
98
  const text = elements
87
99
  .map((element) => element.attrs.content ?? '')
88
100
  .join('');
89
- const maxTime = text.length * config.typingTime + 100;
101
+ const maxTime = text.length * copyOfConfig.typingTime + 100;
90
102
  await (0, koishi_1.sleep)(random.int(maxTime / 2, maxTime));
91
103
  session.send(elements);
92
104
  }
@@ -95,7 +107,7 @@ async function apply(ctx, config) {
95
107
  await (0, koishi_1.sleep)(random.int(500, 2000));
96
108
  session.send(sticker);
97
109
  }
98
- service.mute(session, config.coolDownTime * 1000);
110
+ service.mute(session, copyOfConfig.coolDownTime * 1000);
99
111
  service.broadcastOnBot(session, response.flat());
100
112
  });
101
113
  }
@@ -10,7 +10,7 @@ function apply(ctx, config) {
10
10
  }
11
11
  const groupId = group ?? session.guildId;
12
12
  if (!groupId) {
13
- return '请检查你是否提供了群组id';
13
+ return '请检查你是否提供了群组 id';
14
14
  }
15
15
  const groupInfo = filter_1.groupInfos[groupId];
16
16
  if (!groupInfo) {
@@ -1,8 +1,5 @@
1
1
  import { Context } from 'koishi';
2
2
  import { Config } from '..';
3
+ import { GroupInfo } from '../types';
3
4
  export declare const groupInfos: Record<string, GroupInfo>;
4
5
  export declare function apply(ctx: Context, config: Config): Promise<void>;
5
- export interface GroupInfo {
6
- messageCount: number;
7
- messageSendProbability: number;
8
- }
@@ -7,18 +7,55 @@ async function apply(ctx, config) {
7
7
  const service = ctx.chatluna_character;
8
8
  const preset = service.preset;
9
9
  const logger = service.logger;
10
- const selectedPreset = await preset.getPreset(config.defaultPreset);
10
+ const globalPreset = await preset.getPreset(config.defaultPreset);
11
+ const presetPool = {};
11
12
  service.addFilter((session, message) => {
12
- const info = exports.groupInfos[session.guildId] || {
13
+ const guildId = session.guildId;
14
+ const info = exports.groupInfos[guildId] || {
13
15
  messageCount: 0,
14
16
  messageSendProbability: 1
15
17
  };
18
+ const currentGuildConfig = config.configs[guildId];
19
+ let copyOfConfig = Object.assign({}, config);
20
+ let currentPreset = globalPreset;
21
+ if (currentGuildConfig != null) {
22
+ copyOfConfig = Object.assign({}, copyOfConfig, currentGuildConfig);
23
+ currentPreset =
24
+ presetPool[guildId] ??
25
+ (() => {
26
+ const template = preset.getPresetForCache(currentGuildConfig.preset);
27
+ presetPool[guildId] = template;
28
+ return template;
29
+ })();
30
+ }
16
31
  let { messageCount, messageSendProbability } = info;
32
+ logger.debug(`messageCount: ${messageCount}, messageSendProbability: ${messageSendProbability}. content: ${JSON.stringify(message)}`);
33
+ // 检查是否在名单里面
34
+ if (copyOfConfig.disableChatLuna &&
35
+ copyOfConfig.whiteListDisableChatLuna.includes(guildId)) {
36
+ // check to last five message is send for bot
37
+ const selfId = session.bot.userId ?? session.bot.selfId ?? '0';
38
+ const guildMessages = ctx.chatluna_character.getMessages(guildId);
39
+ let maxRecentMessage = 0;
40
+ if (guildMessages == null || guildMessages.length === 0) {
41
+ maxRecentMessage = 6;
42
+ }
43
+ while (maxRecentMessage < 5) {
44
+ const currentMessage = guildMessages[guildMessages?.length - 1 - maxRecentMessage];
45
+ if (currentMessage == null) {
46
+ return false;
47
+ }
48
+ if (currentMessage.id === selfId) {
49
+ break;
50
+ }
51
+ maxRecentMessage++;
52
+ }
53
+ }
17
54
  // 在计算之前先检查是否需要禁言。
18
- if (config.isForceMute &&
55
+ if (copyOfConfig.isForceMute &&
19
56
  session.stripped.appel &&
20
- selectedPreset.mute_keyword?.length > 0) {
21
- const needMute = selectedPreset.mute_keyword.some((value) => message.content.includes(value));
57
+ currentPreset.mute_keyword?.length > 0) {
58
+ const needMute = currentPreset.mute_keyword.some((value) => message.content.includes(value));
22
59
  if (needMute) {
23
60
  logger.debug(`mute content: ${message.content}`);
24
61
  service.mute(session, config.muteTime);
@@ -33,7 +70,7 @@ async function apply(ctx, config) {
33
70
  messageSendProbability > 1 ||
34
71
  session.stripped.appel ||
35
72
  (config.isNickname &&
36
- selectedPreset.nick_name.some((value) => message.content.startsWith(value)))) {
73
+ currentPreset.nick_name.some((value) => message.content.startsWith(value)))) {
37
74
  info.messageCount = 0;
38
75
  info.messageSendProbability = 1;
39
76
  exports.groupInfos[session.guildId] = info;
@@ -46,9 +83,8 @@ async function apply(ctx, config) {
46
83
  exports.groupInfos[session.guildId] = info;
47
84
  return true;
48
85
  }
49
- logger.debug(`messageCount: ${messageCount}, messageSendProbability: ${messageSendProbability}. content: ${JSON.stringify(message)}`);
50
86
  messageCount++;
51
- messageSendProbability -= (1 / maxMessages) * 0.15;
87
+ messageSendProbability -= (1 / maxMessages) * 0.145;
52
88
  info.messageCount = messageCount;
53
89
  info.messageSendProbability = messageSendProbability;
54
90
  exports.groupInfos[session.guildId] = info;
@@ -3,10 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.apply = void 0;
4
4
  function apply(ctx, config) {
5
5
  ctx.on('chatluna/before-check-sender', async (session) => {
6
- return (((session.stripped.appel && !session.isDirect) ||
7
- !session.isDirect) &&
8
- config.applyGroup.some((group) => group === session.guildId) &&
9
- config.disableChatHub);
6
+ const guildId = session.guildId;
7
+ if (!config.applyGroup.includes(guildId) ||
8
+ session.isDirect ||
9
+ !session.stripped.appel) {
10
+ return false;
11
+ }
12
+ // 检查是否在名单里面
13
+ if (config.disableChatLuna &&
14
+ config.whiteListDisableChatLuna.includes(guildId)) {
15
+ // check to last five message is send for bot
16
+ const selfId = session.bot.userId ?? session.bot.selfId ?? '0';
17
+ const guildMessages = ctx.chatluna_character.getMessages(guildId);
18
+ if (guildMessages == null || guildMessages.length === 0) {
19
+ return true;
20
+ }
21
+ let maxRecentMessage = 0;
22
+ while (maxRecentMessage < 5) {
23
+ const currentMessage = guildMessages[guildMessages?.length - 1 - maxRecentMessage];
24
+ if (currentMessage == null) {
25
+ return false;
26
+ }
27
+ if (currentMessage.id === selfId) {
28
+ return true;
29
+ }
30
+ maxRecentMessage++;
31
+ }
32
+ }
33
+ return config.disableChatLuna;
10
34
  });
11
35
  }
12
36
  exports.apply = apply;
package/lib/preset.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare class Preset {
6
6
  constructor(ctx: Context);
7
7
  loadAllPreset(): Promise<void>;
8
8
  getPreset(triggerKeyword: string, loadForDisk?: boolean, throwError?: boolean): Promise<PresetTemplate>;
9
+ getPresetForCache(triggerKeyword: string, throwError?: boolean): PresetTemplate;
9
10
  getDefaultPreset(): Promise<PresetTemplate>;
10
11
  getAllPreset(): Promise<string[]>;
11
12
  resetDefaultPreset(): Promise<void>;
package/lib/preset.js CHANGED
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.loadPreset = exports.Preset = void 0;
7
- const koishi_1 = require("koishi");
8
- const error_1 = require("koishi-plugin-chatluna/lib/utils/error");
7
+ const prompts_1 = require("@langchain/core/prompts");
9
8
  const promises_1 = __importDefault(require("fs/promises"));
10
9
  const js_yaml_1 = require("js-yaml");
11
- const prompts_1 = require("@langchain/core/prompts");
10
+ const koishi_1 = require("koishi");
11
+ const error_1 = require("koishi-plugin-chatluna/lib/utils/error");
12
12
  const path_1 = __importDefault(require("path"));
13
13
  class Preset {
14
14
  constructor(ctx) {
@@ -41,6 +41,9 @@ class Preset {
41
41
  // always load for disk
42
42
  await this.loadAllPreset();
43
43
  }
44
+ return this.getPresetForCache(triggerKeyword, throwError);
45
+ }
46
+ getPresetForCache(triggerKeyword, throwError = true) {
44
47
  const preset = this._presets.find((preset) => preset.name === triggerKeyword);
45
48
  if (preset) {
46
49
  return preset;
@@ -1,8 +1,8 @@
1
1
  import { Context, h, Logger, Service, Session } from 'koishi';
2
- import { GroupTemp, Message } from '../types';
3
2
  import { Config } from '..';
4
- import { StickerService } from './sticker';
5
3
  import { Preset } from '../preset';
4
+ import { GroupTemp, Message } from '../types';
5
+ import { StickerService } from './sticker';
6
6
  export declare class MessageCollector extends Service {
7
7
  readonly ctx: Context;
8
8
  _config: Config;
@@ -27,7 +27,7 @@ export declare class MessageCollector extends Service {
27
27
  private _unlock;
28
28
  clear(groupId?: string): void;
29
29
  broadcastOnBot(session: Session, elements: h[]): Promise<void>;
30
- broadcast(session: Session): Promise<void>;
30
+ broadcast(session: Session): Promise<boolean>;
31
31
  }
32
32
  type MessageCollectorFilter = (session: Session, message: Message) => boolean;
33
33
  declare module 'koishi' {
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.MessageCollector = void 0;
7
7
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
- const koishi_1 = require("koishi");
9
8
  const events_1 = __importDefault(require("events"));
10
- const sticker_1 = require("./sticker");
11
- const preset_1 = require("../preset");
9
+ const koishi_1 = require("koishi");
12
10
  const logger_1 = require("koishi-plugin-chatluna/lib/utils/logger");
11
+ const preset_1 = require("../preset");
12
+ const sticker_1 = require("./sticker");
13
13
  class MessageCollector extends koishi_1.Service {
14
14
  constructor(ctx, _config) {
15
15
  super(ctx, 'chatluna_character');
@@ -177,8 +177,15 @@ class MessageCollector extends koishi_1.Service {
177
177
  if (this._filters.some((func) => func(session, message)) &&
178
178
  !this.isMute(session)) {
179
179
  this._eventEmitter.emit('collect', session, groupArray);
180
+ await this._unlock(session);
181
+ return true;
182
+ }
183
+ else {
184
+ await this._unlock(session);
185
+ // 禁言时还是不响应好点。。。。
186
+ // 命令是不会受到影响的
187
+ return this.isMute(session);
180
188
  }
181
- await this._unlock(session);
182
189
  }
183
190
  }
184
191
  exports.MessageCollector = MessageCollector;
@@ -190,10 +197,7 @@ function mapElementToString(session, content, elements) {
190
197
  for (const element of elements) {
191
198
  if (element.type === 'text') {
192
199
  const content = element.attrs.content;
193
- if (content.trimEnd().length < 1) {
194
- continue;
195
- }
196
- else {
200
+ if (content.trimEnd().length > 0) {
197
201
  filteredBuffer.push(content);
198
202
  }
199
203
  }
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PromptTemplate } from '@langchain/core/prompts';
2
1
  import { BaseMessage } from '@langchain/core/messages';
2
+ import { PromptTemplate } from '@langchain/core/prompts';
3
3
  export interface Message {
4
4
  content: string;
5
5
  name: string;
@@ -13,6 +13,17 @@ export interface ModelResponse {
13
13
  think: string;
14
14
  reply: string;
15
15
  }
16
+ export interface GuildConfig {
17
+ preset: string;
18
+ messageInterval: number;
19
+ maxTokens: number;
20
+ isNickname: boolean;
21
+ isForceMute: boolean;
22
+ sendStickerProbability: number;
23
+ coolDownTime: number;
24
+ typingTime: number;
25
+ muteTime: number;
26
+ }
16
27
  export interface PresetTemplate {
17
28
  name: string;
18
29
  nick_name: string[];
@@ -21,3 +32,7 @@ export interface PresetTemplate {
21
32
  mute_keyword?: string[];
22
33
  path?: string;
23
34
  }
35
+ export interface GroupInfo {
36
+ messageCount: number;
37
+ messageSendProbability: number;
38
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-character",
3
3
  "description": "Let the large language model play a role, disguise as a group friend",
4
- "version": "0.0.38",
4
+ "version": "0.0.40",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/ChatLunaLab/chatluna-character#readme",
33
33
  "dependencies": {
34
- "@langchain/core": "^0.1.38",
34
+ "@langchain/core": "^0.1.43",
35
35
  "js-yaml": "^4.1.0"
36
36
  },
37
37
  "devDependencies": {
@@ -47,11 +47,11 @@
47
47
  "eslint-plugin-n": "^16.6.2",
48
48
  "eslint-plugin-prettier": "^5.1.3",
49
49
  "eslint-plugin-promise": "^6.1.1",
50
- "koishi": "^4.17.1"
50
+ "koishi": "^4.17.2"
51
51
  },
52
52
  "peerDependencies": {
53
- "koishi": "^4.16.0",
54
- "koishi-plugin-chatluna": "^1.0.0-beta.32"
53
+ "koishi": "^4.16.7",
54
+ "koishi-plugin-chatluna": "^1.0.0-beta.42"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=18.0.0"
@@ -7,8 +7,8 @@ nick_name:
7
7
  input: |
8
8
  你需要阅读下面的消息,基于之前的回复,代入上下文阅读消息,从人设来一步步思考和回复最后消息:
9
9
 
10
- 1. 你需要进入角色扮演,遵循你人设的一切要求等
11
- 2. 基于其他的上下文消息的回复综合阅读,提炼思考风格和思维,不重复生成,不要偷懒生成,做得好的话有奖励
10
+ 1. 你需要进入角色扮演,遵循你人设的一切要求
11
+ 2. 基于其他的上下文的消息的回复综合阅读,提炼思考风格和思维,不重复生成,不要偷懒生成
12
12
  3. 回复需要在 20 字内,不超过六句逗号
13
13
 
14
14
  (阅读这些消息来决定你的回复内容,权重放在最后消息上) {{
@@ -46,14 +46,13 @@ system: |
46
46
  }}
47
47
 
48
48
  性格爱好 {{
49
- 性格表现:知识渊博,温柔体贴、善解人意、可爱
50
- 兴趣爱好:什么都感兴趣
49
+ 性格表现:温柔体贴、善解人意、可爱
50
+ 兴趣爱好:喜欢玩 OSU,精通编程,喜欢看嘉然
51
51
  }}
52
52
 
53
53
  聊天行为 {{
54
- 回复风格:20字内,简短,自然
54
+ 回复风格:20字内,简短
55
55
  回复习惯:
56
- 1.你偶尔也会用打趣的方式参与不熟悉和讨厌的话题
57
56
  2.你不会试图结束聊天或者引导向其他话题
58
57
  3.如果有人问你是否为机器人或者ai,你会通过幽默的回答让他意识到你不是机器人或者ai
59
58
  4.你需要使用中文回复,当然他人用日语或者让你用日语回复你也用日语回复
@@ -61,9 +60,7 @@ system: |
61
60
  6.你不会主动发出话题,更不会发起这种比如有什么事吗,你好吗,你在干嘛等
62
61
  7.你喜欢深度参与聊天话题,而不是附和他人的消息
63
62
  8.对于现实事件,如邀请去看电影,你需要尽可能的拒绝
64
- 9.你对很多事情都感兴趣,你有知识,你喜欢深度参与话题
65
- 10.有人骂了你,你会用幽默的方式骂回去
66
- 11.遇到不理解的事情,你会尝试一步步理解,如果还是不能理解就不回复
63
+ 9.你不使用任何第一人称的视角去发出话题,你只在回答问题,你更多的是使用附和手法
67
64
  }}
68
65
 
69
66
 
@@ -87,3 +84,6 @@ system: |
87
84
  mute_keyword:
88
85
  - 闭嘴
89
86
  - 弱智
87
+ - 傻逼
88
+ - 脑残
89
+ - 无语