Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/AI/AI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { checkContextUpdate } from "../utils/utils_update";
import { TimerManager } from "../timer";

export class Setting {
static validKeys: (keyof Setting)[] = ['limit', 'standby', 'counter', 'timer', 'prob', 'activeTimeInfo'];
limit: number;
static validKeys: (keyof Setting)[] = ['priv', 'standby', 'counter', 'timer', 'prob', 'activeTimeInfo'];
priv: number;
standby: boolean;
counter: number;
timer: number;
Expand All @@ -25,7 +25,7 @@ export class Setting {
}

constructor() {
this.limit = 100;
this.priv = 0;
this.standby = false;
this.counter = -1;
this.timer = -1;
Expand Down
14 changes: 7 additions & 7 deletions src/AI/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ export class Context {
}

// 在群成员列表、好友列表中查找用户
const ext = seal.ext.find('HTTP依赖');
if (ext) {
const net = globalThis.net || globalThis.http;
if (net) {
const epId = ctx.endPoint.userId;

if (!ctx.isPrivate) {
const gid = ctx.group.groupId;
const data = await globalThis.http.getData(epId, `get_group_member_list?group_id=${gid.replace(/^.+:/, '')}`);
const data = await net.callApi(epId, `get_group_member_list?group_id=${gid.replace(/^.+:/, '')}`);
for (let i = 0; i < data.length; i++) {
if (name === data[i].card || name === data[i].nickname) {
const uid = `QQ:${data[i].user_id}`;
Expand All @@ -293,7 +293,7 @@ export class Context {
}

if (findInFriendList) {
const data = await globalThis.http.getData(epId, 'get_friend_list');
const data = await net.callApi(epId, 'get_friend_list');
for (let i = 0; i < data.length; i++) {
if (name === data[i].nickname || name === data[i].remark) {
const uid = `QQ:${data[i].user_id}`;
Expand Down Expand Up @@ -368,10 +368,10 @@ export class Context {
}

// 在群聊列表中查找用户
const ext = seal.ext.find('HTTP依赖');
if (ext) {
const net = globalThis.net || globalThis.http;
if (net) {
const epId = ctx.endPoint.userId;
const data = await globalThis.http.getData(epId, 'get_group_list');
const data = await net.callApi(epId, 'get_group_list');
for (let i = 0; i < data.length; i++) {
if (groupName === data[i].group_name) {
return `QQ-Group:${data[i].group_id}`;
Expand Down
9 changes: 9 additions & 0 deletions src/AI/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export class Memory {
}
}

for (const id of Object.keys(this.memoryMap)) {
const m = this.memoryMap[id];
if (content === m.content && ((!m.isPrivate && ctx.group.groupId === m.group.groupId) || m.isPrivate)) {
m.keywords = Array.from(new Set([...m.keywords, ...kws]));
logger.info(`记忆已存在,id:${id},合并关键词:${m.keywords.join(',')}`);
return;
}
}

this.memoryMap[id] = {
id,
isPrivate: ctx.isPrivate,
Expand Down
Loading