Skip to content

Conversation

@BegoniaHe
Copy link
Member

No description provided.

error2913 and others added 28 commits October 5, 2025 02:03
* feature:新增表情包制作工具函数

* feature:新增表情包制作工具函数

* fix spell & make lint happy

* style and bug

进行一些调整。

* 获取表情包info封装到一个函数

* fix image array bug
	modified:   src/tool/tool_meme.ts

* fix: 修复没有正确返回文本的问题

* Update update.ts

---------

Co-authored-by: error2913 <2913949387@qq.com>
* feat:添加“在上下文内添加消息时间”和”活跃时间段随机触发“相关逻辑

issue #33

* 尚未完成工作,只是保存一下下

* finish the work

* fix: 修复特定情况无法正确构建content

* fix: 修复重复触发问题

* fix: 指令解析错误

---------

Co-authored-by: error2913 <2913949387@qq.com>
还有解析优化
1:清除所有上下文,2:清除assistant和tool上下文,3:清除user上下文
* 硬!编码所有指令信息

* Update privilege.ts

* 哈哈做完啦

* 果然有!!!

* feat: 适配了最新依赖

* feat: 合并相同记忆 ( #47 )
* feat:新增获取精华消息列表和删除精华消息工具

* 重构一下,使solve返回`Promise<{ content: string, images: Image[] }>`

* fix: 修复精华消息图片相关

---------

Co-authored-by: error2913 <2913949387@qq.com>
@BegoniaHe BegoniaHe requested a review from Copilot October 23, 2025 15:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the message structure and implements several new features including time display, privilege management, timer improvements, and enhanced tool function support.

Key Changes

  • Refactored message structure from contentArray/msgIdArray to a unified msgArray containing message metadata (ID, timestamp, content)
  • Implemented comprehensive privilege system with command-specific and session-based permissions
  • Enhanced timer functionality with interval and active time timers
  • Improved tool function return format to include both content and images
  • Added JSON string repair functionality for handling malformed tool function arguments

Reviewed Changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/utils/utils_string.ts Added MessageSegment interface, fmtDate function, and fixJsonString utility
src/utils/utils_message.ts Refactored message building to use new msgArray structure with timestamps
src/utils/utils.ts Added null handling for transformMsgId and revive utility function
src/update.ts Updated version history and changelog
src/tool/*.ts Updated all tool functions to return {content, images} format
src/timer.ts Converted TimerInfo to class, added interval and active time timer support
src/service.ts Updated to use transformTextToArray for message processing
src/privilege.ts New file implementing comprehensive privilege management system
src/index.ts Major refactoring of command handling and privilege checking
src/config/*.ts Added time display configuration and updated templates
src/AI/*.ts Refactored to use new message structure and added active timer checking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

src/config/config_reply.ts:1

  • There appears to be a typo in the regex pattern with three consecutive pipe characters │|] which should likely be two characters │|]. This is inconsistent with other parts of the pattern and may cause incorrect matching.
import { ConfigManager } from "./config";

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


const s = `群聊数量: ${data.length}\n` + data.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`;
return { content: `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above - returning an object inside a .map() that's being joined. Should return a string directly.

Copilot uses AI. Check for mistakes.
}
const s = `管理员数量: ${admins.length}\n` + admins.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''}`;
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.
}
const s = `机器人数量: ${robots.length}\n` + robots.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''}`;
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.

const s = `群成员数量: ${data.length}\n` + data.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''} ${item.title ? `头衔: ${item.title}` : ''} ${item.role === 'owner' ? '【群主】' : item.role === 'admin' ? '【管理员】' : item.is_robot ? '【机器人】' : ''}`;
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.card && item.card !== item.nickname ? `群名片: ${item.card}` : ''} ${item.title ? `头衔: ${item.title}` : ''} ${item.role === 'owner' ? '【群主】' : item.role === 'admin' ? '【管理员】' : item.is_robot ? '【机器人】' : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.

const s = `搜索结果好友数量: ${arr.length}\n` + arr.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nickname}(${item.user_id}) ${item.remark && item.remark !== item.nickname ? `备注: ${item.remark}` : ''}`;
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.remark && item.remark !== item.nickname ? `备注: ${item.remark}` : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.

const s = `搜索结果群聊数量: ${arr.length}\n` + arr.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`;
return { content: `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.

const s = `搜索结果好友数量: ${arr1.length}\n` + arr1.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nickname}(${item.user_id}) ${item.remark && item.remark !== item.nickname ? `备注: ${item.remark}` : ''}`;
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.remark && item.remark !== item.nickname ? `备注: ${item.remark}` : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.
return { content: `${index + 1}. ${item.nickname}(${item.user_id}) ${item.remark && item.remark !== item.nickname ? `备注: ${item.remark}` : ''}`, images: [] };
}).join('\n') + `\n搜索结果群聊数量: ${arr2.length}\n` + arr2.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`;
return { content: `${index + 1}. ${item.group_name}(${item.group_id}) 人数: ${item.member_count}/${item.max_member_count}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Copilot uses AI. Check for mistakes.

const s = `共群数量: ${arr.length}\n` + arr.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.group_info.group_name}(${item.group_info.group_id}) 人数: ${item.group_info.member_count}/${item.group_info.max_member_count} ${item.user_info.card && item.user_info.card !== item.user_info.nickname ? `群名片: ${item.user_info.card}` : ''}`;
return { content: `${index + 1}. ${item.group_info.group_name}(${item.group_info.group_id}) 人数: ${item.group_info.member_count}/${item.group_info.max_member_count} ${item.user_info.card && item.user_info.card !== item.user_info.nickname ? `群名片: ${item.user_info.card}` : ''}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Suggested change
return { content: `${index + 1}. ${item.group_info.group_name}(${item.group_info.group_id}) 人数: ${item.group_info.member_count}/${item.group_info.max_member_count} ${item.user_info.card && item.user_info.card !== item.user_info.nickname ? `群名片: ${item.user_info.card}` : ''}`, images: [] };
return `${index + 1}. ${item.group_info.group_name}(${item.group_info.group_id}) 人数: ${item.group_info.member_count}/${item.group_info.max_member_count} ${item.user_info.card && item.user_info.card !== item.user_info.nickname ? `群名片: ${item.user_info.card}` : ''}`;

Copilot uses AI. Check for mistakes.

const s = `被禁言成员数量: ${data.length}\n` + data.slice(0, 50).map((item: any, index: number) => {
return `${index + 1}. ${item.nick}(${item.uin}) ${item.cardName && item.cardName !== item.nick ? `群名片: ${item.cardName}` : ''} 禁言结束时间: ${new Date(item.shutUpTime * 1000).toLocaleString()}`;
return { content: `${index + 1}. ${item.nick}(${item.uin}) ${item.cardName && item.cardName !== item.nick ? `群名片: ${item.cardName}` : ''} 禁言结束时间: ${fmtDate(item.shutUpTime)}`, images: [] };
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an object inside .map() that's being joined. Should return a string.

Suggested change
return { content: `${index + 1}. ${item.nick}(${item.uin}) ${item.cardName && item.cardName !== item.nick ? `群名片: ${item.cardName}` : ''} 禁言结束时间: ${fmtDate(item.shutUpTime)}`, images: [] };
return `${index + 1}. ${item.nick}(${item.uin})${item.cardName && item.cardName !== item.nick ? ` 群名片: ${item.cardName}` : ''} 禁言结束时间: ${fmtDate(item.shutUpTime)}`;

Copilot uses AI. Check for mistakes.
error2913 and others added 29 commits October 28, 2025 13:13
* 重构完成,下一步是移动帮助文本和重构部分指令 #52

* 完成重构后的重构 #52
* feat: 添加向量记忆

* 修改memory相关函数

* 调整分数计算

* 配置记忆配置解析 #56

* 新增知识库 #56

* bugfix

* 数值计算调整

* 数值计算调整

* style

* 优化自动更新名字的逻辑

好像跑题了

* search调整

* 调整tool默认搜索模式
* feat: 添加markdown/html图片渲染工具和相关后端项目

* style调整

* feat:将md和html拆分成两个函数

* style

* feat:修改为base64返回,允许长久储存

* style

* 对image进行重构

---------

Co-authored-by: error2913 <2913949387@qq.com>
* feat:允许render工具渲染url和base64图片

* fix:添加对html中图片作为背景的替换兼容

* 改回第一版(

* update update info

---------

Co-authored-by: error2913 <2913949387@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants