Skip to content

Commit 2b32250

Browse files
cursoragentjxxghp
andcommitted
feat: Require messages to start with /ai
Co-authored-by: jxxghp <jxxghp@qq.com>
1 parent 9b5f863 commit 2b32250

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎app/chain/message.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,16 @@ def _handle_ai_message(self, text: str, channel: MessageChannel, source: str,
943943
return
944944

945945
# 提取用户消息
946+
if not text.startswith("/ai"):
947+
self.post_message(Notification(
948+
channel=channel,
949+
source=source,
950+
userid=userid,
951+
username=username,
952+
title="消息格式错误,请以 /ai 开头"
953+
))
954+
return
955+
946956
user_message = text[3:].strip() # 移除 "/ai" 前缀
947957
if not user_message:
948958
self.post_message(Notification(

0 commit comments

Comments
 (0)