diff --git a/.gitignore b/.gitignore
index 91514b8d7..0b0a993cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
__pycache__
botpy.log
.vscode
-data.db
+data_v2.db
configs/session
configs/config.yaml
**/.DS_Store
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..35410cacd
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/AstrBot.iml b/.idea/AstrBot.iml
new file mode 100644
index 000000000..5fdd65ba2
--- /dev/null
+++ b/.idea/AstrBot.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 000000000..e33000991
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 000000000..105ce2da2
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 000000000..57d7881b5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/astrbot/message/handler.py b/astrbot/message/handler.py
index b8c57f193..f16127f76 100644
--- a/astrbot/message/handler.py
+++ b/astrbot/message/handler.py
@@ -110,6 +110,7 @@ class MessageHandler():
self.rate_limit_helper = RateLimitHelper(context)
self.content_safety_helper = ContentSafetyHelper(context)
self.llm_wake_prefix = self.context.config_helper.llm_settings.wake_prefix
+ self.llm_identifier = self.context.config_helper.llm_settings.identifier
if self.llm_wake_prefix:
self.llm_wake_prefix = self.llm_wake_prefix.strip()
self.provider = self.context.llms[0].llm_instance if len(self.context.llms) > 0 else None
@@ -235,6 +236,13 @@ class MessageHandler():
else:
# normal chat
tool_use_flag = False
+ # add user info to the prompt
+ if self.llm_identifier:
+ user_id = message.message_obj.sender.user_id
+ user_nickname = message.message_obj.sender.nickname
+ user_info = f"[User ID: {user_id}, Nickname: {user_nickname}]\n"
+ msg_plain = user_info + msg_plain
+
llm_result = await provider.text_chat(
prompt=msg_plain,
session_id=message.session_id,
diff --git a/type/config.py b/type/config.py
index ed2c93b5b..a5093f813 100644
--- a/type/config.py
+++ b/type/config.py
@@ -146,6 +146,7 @@ DEFAULT_CONFIG_VERSION_2 = {
"llm_settings": {
"wake_prefix": "",
"web_search": False,
+ "identifier": False,
},
"content_safety": {
"baidu_aip": {
@@ -312,6 +313,7 @@ CONFIG_METADATA_2 = {
"items": {
"wake_prefix": {"description": "LLM 聊天额外唤醒前缀", "type": "string"},
"web_search": {"description": "启用网页搜索(能访问 Google 时效果最佳)", "type": "bool"},
+ "identifier": {"description": "启动识别群员(略微增加token开销)", "type": "bool"},
}
},
"content_safety": {
diff --git a/util/cmd_config.py b/util/cmd_config.py
index 85285bc5b..4eb60e9fb 100644
--- a/util/cmd_config.py
+++ b/util/cmd_config.py
@@ -90,6 +90,7 @@ class LLMConfig:
class LLMSettings:
wake_prefix: str = ""
web_search: bool = False
+ identifier: bool = False
@dataclass
class BaiduAIPConfig: