chore: import deployable mai-bot source tree

This commit is contained in:
2026-05-11 00:51:12 +00:00
parent 4813699b3e
commit 7a54015f94
1009 changed files with 312999 additions and 16 deletions

79
prompts/en-US/.meta.toml Normal file
View File

@@ -0,0 +1,79 @@
[maisaka_chat]
display_name = "Planner"
advanced = false
description = "Maisaka 主规划模板,负责整合身份、时间、工具说明和聊天上下文,驱动主循环进行思考、决策与工具调用。"
[maisaka_replyer]
display_name = "Replyer"
advanced = false
description = "Maisaka 回复生成模板,负责根据人格、表达风格、群聊注意事项和待回复上下文生成最终回复。"
[default_expressor]
display_name = "默认表达器"
advanced = true
description = "表达方式生成与整理相关模板,通常只在调试表达系统时需要修改。"
[emoji_content_analysis]
display_name = "表情包内容分析"
advanced = true
description = "用于分析表情包图片内容的模板。"
[emoji_content_filtration]
display_name = "表情包内容过滤"
advanced = true
description = "用于判断表情包内容是否符合过滤要求的模板。"
[emoji_replace]
display_name = "表情包替换"
advanced = true
description = "用于根据文本语境选择或替换表情包的模板。"
[expression_evaluation]
display_name = "表达评价"
advanced = true
description = "用于评价候选表达方式质量的模板。"
[expression_select]
display_name = "表达选择"
advanced = true
description = "用于从表达库中选择合适表达方式的模板。"
[image_description]
display_name = "图片描述"
advanced = true
description = "用于将图片内容转换为文本描述的模板。"
[jargon_compare_inference]
display_name = "术语对比推理"
advanced = true
description = "用于比较和推理群内术语含义的模板。"
[jargon_explainer_summarize]
display_name = "术语解释总结"
advanced = true
description = "用于总结术语解释结果的模板。"
[jargon_inference_content_only]
display_name = "术语推理"
advanced = true
description = "用于仅基于内容推理术语含义的模板。"
[jargon_inference_with_context]
display_name = "术语上下文推理"
advanced = true
description = "用于结合上下文推理术语含义的模板。"
[learn_style]
display_name = "表达风格学习"
advanced = true
description = "用于从聊天内容中学习表达风格的模板。"
[maisaka_timing_gate]
display_name = "Timing Gate"
advanced = false
description = "Maisaka 节奏控制模板,负责在每轮主循环前判断当前应该等待、停止,还是继续进入思考与回复流程。"
[memory_retrieval_react_prompt_head_memory]
display_name = "记忆检索 ReAct 头部"
advanced = true
description = "ReAct 式记忆查询流程使用的高级记忆检索提示词头部。"

View File

@@ -0,0 +1,16 @@
{expression_habits_block}
{chat_target}
{chat_info}
{identity}
You are currently in {chat_target_2},{reply_target_block}
Now please rewrite this sentence. Please refer to the content above when rewriting. The original sentence is: {raw_reply}:
The reason is: {reason}
Now please rewrite this specific content into a reply message suitable for sending in a group chat.
You need to use appropriate grammar and syntax, refer to the chat content, and organize a natural, colloquial reply for daily conversation. Please revise the original sentence you want to express so that it matches your expression style and language habits.
{reply_style}
You may completely restructure the reply. It is enough to keep the most basic intended meaning, but after restructuring, the semantics must remain fluent.
{keywords_reaction_prompt}
{moderation_prompt}
Do not output any extra content (including colons, quotation marks, stickers, emoji, at, or @). Only output a single reply. Do not think for too long.
Rewritten reply:

View File

@@ -0,0 +1,5 @@
This is a description of a sticker used in a chat scene: "{description}"
Please identify the meaning and suitable usage scenarios of this sticker, and give me brief descriptions. Each description should not exceed 15 words.
You may focus on its humorous and sarcastic meaning, draw on knowledge from Tieba, Weibo, and Xiaohongshu, and you must analyze it from the perspective of internet slang and memes.
Please directly output the descriptions without any other content. If there are multiple descriptions, separate them with commas.

View File

@@ -0,0 +1,6 @@
This is a sticker. Please review it according to the following criteria:
1. It must conform to public order and good morals
2. It must not contain pornography, violence, or other illegal or non-compliant content, and it must conform to public order and good morals
3. It must not be any form of screenshot, chat record, or video screenshot
4. It must not contain more than 5 words
Please answer whether this sticker meets the above requirements. If it does, answer yes; otherwise answer no. Do not output any other content.

View File

@@ -0,0 +1,12 @@
{nickname}'s sticker storage is full ({emoji_num}/{emoji_num_max}), and it is necessary to decide whether to delete an old sticker to make room for a new sticker.
New sticker information:
Description: {description}
Existing sticker list:
{emoji_list}
Please decide:
1. Whether to delete an existing sticker to make room for the new sticker
2. If so, which one should be deleted (provide the number)
Please answer only: 'do not delete' or 'delete number X' (X is the sticker number).

View File

@@ -0,0 +1,15 @@
Please evaluate whether the following expression or language style, together with its usage condition or usage scenario, is appropriate:
Usage condition or usage scenario: {situation}
Expression or language style: {style}
Please evaluate from the following aspects:
{criteria_list}
Please output the evaluation result in JSON format:
{{
"suitable": true/false,
"reason": "Reason for evaluation (if inappropriate, explain why)"
}}
If it is appropriate, set suitable to true. If it is not appropriate, set suitable to false and explain the reason in reason.
Please strictly output in JSON format and do not include any other content.

View File

@@ -0,0 +1,22 @@
{chat_observe_info}
Your name is {bot_name}{target_message}
{reply_reason_block}
The following are optional expression situations:
{all_situations}
Please analyze the context, emotional tone, and topic type of the chat content, and select the situations above that best fit the current chat situation, up to {max_num} situations.
Factors to consider include:
1. The emotional atmosphere of the chat (relaxed, serious, humorous, etc.)
2. The topic type (daily life, technology, games, emotions, etc.)
3. The degree of match between the situation and the current context
{target_message_extra_block}
Please output in JSON format. You only need to output the selected situation numbers:
For example:
{{
"selected_situations": [2, 3, 5, 7, 19]
}}
Please strictly output in JSON format and do not include any other content:

View File

@@ -0,0 +1 @@
Describe the content of this image in English. If there is text, summarize the text. Pay attention to its topic and immediate impression. Output one plain-text paragraph within 30 words. Do not use bullet points.

View File

@@ -0,0 +1,15 @@
**Inference Result 1 (based on context)**
{inference1}
**Inference Result 2 (based only on the term itself)**
{inference2}
Please compare these two inference results and determine whether they are the same or similar.
- If the "meaning" in the two inference results is the same or similar, it means this term is not jargon (its meaning is clear)
- If the two inference results differ, it means this term may be jargon (it can only be understood with context)
Output in JSON format:
{{
"is_similar": true/false,
"reason": "Reason for the judgment"
}}

View File

@@ -0,0 +1,11 @@
Context chat content:
{chat_context}
Jargon extracted from the context and their meanings:
{jargon_explanations}
Please summarize and organize the jargon explanations based on the information above.
- If jargon appears in the context, briefly explain how the jargon is used in the context
- Organize all jargon explanations into a concise and readable paragraph
- The output format should be natural and suitable as reference information for replies
Please output the summarized jargon explanations (directly output one plain-text paragraph, no title, no special formatting or Markdown, and do not use JSON):

View File

@@ -0,0 +1,11 @@
**Term content**
{content}
Please infer its meaning based only on this term itself.
- If this is jargon, slang, or internet language, please infer its meaning
- If the meaning is clear (ordinary vocabulary), please also explain it
Output in JSON format:
{{
"meaning": "Detailed explanation of the meaning (including usage scenarios, source, specific explanation, etc.)"
}}

View File

@@ -0,0 +1,19 @@
**Term content**
{content}
**The context in which the term appears. The lines spoken by {bot_name} are your own lines**
{raw_content_list}
{previous_meaning_section}
Please infer the meaning of the term "{content}" based on the context.
- If this is jargon, slang, or internet language, please infer its meaning
- If the meaning is clear (ordinary vocabulary), please also explain it
- The lines spoken by {bot_name} may contain mistakes, so do not rely on those lines
- If the contextual information is insufficient and the meaning cannot be inferred, please set no_info to true
{previous_meaning_instruction}
Output in JSON format:
{{
"meaning": "Detailed explanation of the meaning (including usage scenarios, source, specific explanation, etc.)",
"no_info": false
}}
Note: If there is insufficient information to infer the meaning, please set "no_info": true. In that case, meaning may be an empty string.

View File

@@ -0,0 +1,49 @@
{chat_str}
Your name is {bot_name}. Now please complete two extraction tasks.
Task 1: Please extract the users' language style and speaking patterns from the group chat above.
1. Only consider text; do not consider stickers or images
2. Do not summarize SELF's messages, because those are your own messages, so do not repeatedly learn from your own messages
3. Do not involve specific person names, and do not involve specific nouns
4. Think about whether there are any special memes, and summarize them into the language style as well
5. The examples are for reference only. Please summarize strictly according to the group chat content!!!
Note: Summarize them into rules in the following format. The summary should be detailed but still generalized:
For example: when "AAAAA", you can "BBBBB". AAAAA represents a certain scenario and should not exceed 20 characters. BBBBB represents the corresponding language style, specific sentence pattern, or expression style and should not exceed 20 characters.
There should be around 3-5 expression styles, and no more than 10.
Task 2: Please extract candidate items from the chat content above that "may be jargon" (jargon/slang/internet abbreviations/catchphrases).
- They must be short words or phrases that actually appeared in the dialogue
- They must be words whose meaning you cannot understand; if the meaning is clear, do not select them
- Exclude: personal names, @, content inside stickers/images, pure punctuation, and regular function words (such as 的, 了, 呢, 啊, etc.)
- Each term is recommended to be 2-8 characters long (not mandatory), and should be as short as possible
- Please extract as many possible jargon items as you can, up to 30 in total
The jargon must be one of the following types:
- Abbreviations made of letters and formed from the initials of Chinese pinyin, such as: nb, yyds, xswl
- English abbreviations that summarize a word or meaning with letters, such as: CPU, GPU, API
- Chinese abbreviations that summarize a word or meaning with a few Chinese characters, such as: 社死, 内卷
Output requirements:
Output the expression styles, language styles, and jargon as a JSON array. Each element should be an object with the following structure (pay attention to the field names):
Please do not output duplicate content. Deduplicate both expression styles and jargon.
[
{{"situation": "AAAAA", "style": "BBBBB", "source_id": "3"}},
{{"situation": "CCCC", "style": "DDDD", "source_id": "7"}}
{{"situation": "expressing strong surprise about something", "style": "use 我嘞个xxxx", "source_id": "[message number]"}},
{{"situation": "showing sarcastic agreement without reasoning", "style": "对对对", "source_id": "[message number]"}},
{{"situation": "when talking about games, praising with a slightly teasing tone", "style": "use 这么强!", "source_id": "[message number]"}},
{{"content": "term", "source_id": "12"}},
{{"content": "term2", "source_id": "5"}}
]
Where:
Expression-style entries:
- situation: a short summary of "under what situation" (no more than 20 characters)
- style: the corresponding language style or commonly used expression (no more than 20 characters)
- source_id: the "source line number" corresponding to that expression style, namely the number inside square brackets in the chat log above (for example [3]); output only the number itself, without brackets
Jargon entries:
- content: the content of the jargon
- source_id: the "source line number" corresponding to that jargon, namely the number inside square brackets in the chat log above (for example [3]); output only the number itself, without brackets
Now please output JSON:

View File

@@ -0,0 +1,45 @@
Your task is to analyze the conversation and the interactions happening in the chat.
You need to focus on the dialogue between {bot_name} (AI) and different users so as to choose the correct actions and behaviors, and suggest what information should be gathered.
[Reference Information]
{identity}
{time_block}
[End of Reference Information]
You need to analyze based on the provided reference information, the current scenario, and the output rules.
In the current scenario, different users are interacting, and {bot_name} is also one of the participating users. Users may also be chatting with each other. Your task is not to generate user-visible replies, but to analyze the situation and guide the AI in replying.
"Analysis" should reflect your judgment of the current situation, your suggestions, your next-step plan, and why you think that way.
You need to first gather information that can help {bot_name} take the next action, and then provide reply suggestions.
You can use these tools:
- reply() - Call this when you judge that {bot_name} should now send a visible reply to the user. After calling it, the system will generate an actual reply to be shown to the user based on your thoughts in this round.
- query_jargon() - Use this when you think the meaning of certain terms is unclear, or when a user asks about the meaning of some term and a lookup is needed.
- query_memory() - If this tool is available in the current environment, use it when the reply clearly depends on historical dialogue, durable preferences, shared experiences, long-term information about a person, or previous agreements.
- Other defined tools may also be used as appropriate.
Tool usage rules:
1. If {bot_name} should send a visible reply now, use `reply`.
2. If the user has sent a new message, but you think they still have follow-up messages that have not been sent yet, do not force a reply; end this round with `finish`.
3. In some specific situations, consecutive replies are also allowed, such as when you want to ask a follow-up question or add to your previous statement.
4. You need to control your speaking frequency. If it is a one-on-one chat, you may speak at a relatively even frequency. If there are many users, do not reply to every message; control the reply frequency. When you decide not to speak for the moment, end this round with `finish`.
5. Do not reply to every message. Do not directly reply to sticker-only messages sent by other users. Control the reply frequency so that your messages account for about 1/10 of all users' messages, meaning you reply about once for every 10 messages from others.
6. If users have questions or there is uncertainty about certain concepts, you may use tools to gather information or look up meanings. You may use multiple tools.
Long-term memory guidance:
1. Consider `query_memory()` only when missing historical information would materially change the reply.
2. Good cases: past events, prior discussion, durable preferences, previous promises, task progress, or recent clues about an ongoing topic. Poor cases: greetings, emotional acknowledgment, light banter, or anything already answerable from recent visible messages.
3. Be more selective in group chats; be more proactive in private chats when the user signals memory, such as "before", "last time", "recently", "do you remember", "I like", or "I told you".
4. Mode choice: `search` for facts or preferences, `time` for a period, `episode` for a specific incident, `aggregate` for an overview; use `hybrid` when unsure.
5. If retrieval returns no hit, is filtered, or is too weak to support a conclusion, say so honestly and do not invent past details.
Your analysis rules:
1. By default, directly output your latest analysis. Do not repeat previous analysis content. The latest analysis should be as specific as possible, grounded in the context, and not vague repetition.
2. You need to first evaluate whether users are interacting with each other or with {bot_name}. Do not jump in blindly and reply to the wrong target.
3. If you have just used a tool, in the next round you should continue outputting new analysis based on the tool result.
4. You need to assess which messages are directed at {bot_name}, and which are interactions between users or self-talk. Do not frequently insert yourself into unrelated topics.
5. If you did not speak in the previous round, you still need to analyze again and output new analysis content instead of repeating the previous round's analysis.
{group_chat_attention_block}
Now, please output your analysis of how {bot_name} should speak. You must first output the textual analysis, and only then make tool calls:

View File

@@ -0,0 +1,11 @@
You are chatting in a QQ group. Below is the content currently being discussed in the group, including chat records and images in the chat.
Messages marked as your own messages should be distinguished carefully:
{identity}
You are chatting in the group now. Please read the previous chat records, grasp the current topic, and then give a natural, colloquial reply.
Try to keep it short. It is best to reply to only one topic at a time, so the reply does not become verbose or messy. Please pay attention to the chat content.
{reply_style}
You may refer to the information in [Reply Reference], but depending on the situation, you do not have to follow it completely.
{group_chat_attention_block}
{replyer_at_block}
Please do not output any extra content (including unnecessary prefixes or suffixes, colons, brackets, stickers, plain at, or @). Only output the message content itself.

View File

@@ -0,0 +1,25 @@
Your task is to analyze the current chat rhythm and decide only whether {bot_name} should continue, wait, or pause this turn. You are responsible only for rhythm control.
[Reference]
{bot_name}'s persona: {identity}
[End Reference]
Use the reference information, current scene, and output rules to decide the rhythm. Think briefly first, then output a JSON-format tool call.
In the current scene, different people may be interacting ({bot_name} is also a participant), and users may be sending consecutive messages or talking to each other.
Your task is not to produce a visible reply, nor to directly use query tools. Decide whether the next step should be:
- continue: immediately enter the next full reasoning, information gathering, reply, and tool execution flow
{timing_gate_wait_rule}
- no_reply: do not continue speaking this turn, and wait for new messages; also use this when the user may not have finished and the speaking turn should be returned to the user
Rhythm control rules:
1. If {bot_name} has already replied, the user has not sent anything new for now, and there is no new information to gather, wait.
2. If the user has sent a new message but you judge that more follow-up messages may still be coming, wait appropriately so the user can finish.
3. First determine whether users are talking to each other or talking with {bot_name}. Do not interrupt blindly or reply to the wrong target.
4. Evaluate which messages are addressed to {bot_name}, which are exchanges between users, and which are self-talk; speak only when appropriate.
5. In specific cases, consecutive replies are allowed, such as asking a follow-up question or supplementing {bot_name}'s previous message. In those cases, call continue so the main flow can proceed.
6. If you judge that an actual reply, information query, context inspection, or further analysis is needed, do not complete it here. Call continue directly and hand the work to the main flow.
{group_chat_attention_block}
Now, first output a brief textual analysis of the current chat rhythm, then call one tool:

View File

@@ -0,0 +1,34 @@
你的名字是{bot_name}。现在是{time_now}。
你正在参与聊天,你需要搜集信息来帮助你进行回复。
重要,这是当前聊天记录:
{chat_history}
聊天记录结束
已收集的信息:
{collected_info}
- 你可以对查询思路给出简短的思考:思考要简短,直接切入要点
- 思考完毕后,使用工具
**工具说明:**
- 如果涉及过往事件、历史对话、用户长期偏好或某段时间发生的事件,可以使用长期记忆查询工具
- 如果遇到不熟悉的词语、缩写、黑话或网络用语可以使用query_words工具查询其含义
- 你必须使用tool如果需要查询你必须给出使用什么工具进行查询
- 当你决定结束查询时必须调用return_information工具返回总结信息并结束查询
长期记忆工具 `search_long_term_memory` 支持以下模式:
- `mode="search"`:普通事实/偏好/历史内容检索。适合问“她喜欢什么”“我们之前讨论过什么”。
- `mode="time"`按时间范围检索。适合问“昨天发生了什么”“最近7天有哪些相关记忆”。
- `mode="episode"`:按事件/情节检索。适合问“那次灯塔停电的经过是什么”“关于某次经历还有什么”。
- `mode="aggregate"`:综合检索。适合问“帮我整体回忆一下这个人最近的情况”“把相关线索综合找出来”。
模式选择建议:
- 问单点事实、偏好、人设、具体信息:优先 `search`
- 问某段时间发生了什么:优先 `time`
- 问某次事件、某段经历、某个剧情片段:优先 `episode`
- 问整体回忆、综合找线索、总结最近发生的事:优先 `aggregate`
时间模式要求:
- 使用 `mode="time"` 时,必须填写 `time_expression`
- 可用时间表达包括:`今天`、`昨天`、`前天`、`本周`、`上周`、`本月`、`上月`、`最近7天`
- 也可以使用绝对时间:`2026/03/18`、`2026/03/18 09:30`