From a721ed7dddf09b4deaa7e142cf537e9884e5edfa Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:19:45 +0800 Subject: [PATCH 001/142] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Chart=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 helm-chart/Chart.yaml diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml new file mode 100644 index 00000000..aaa8a215 --- /dev/null +++ b/helm-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: maibot +description: "Maimai Bot, a cyber friend dedicated to group chats" +type: application +version: 0.10.0-alpha.0 +appVersion: 0.10.0-alpha \ No newline at end of file From 08d701b406960d1caac48e168584611d6dea33ff Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:20:29 +0800 Subject: [PATCH 002/142] =?UTF-8?q?=E8=AE=BE=E8=AE=A1values=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 648 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 648 insertions(+) create mode 100644 helm-chart/values.yaml diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml new file mode 100644 index 00000000..689b27c1 --- /dev/null +++ b/helm-chart/values.yaml @@ -0,0 +1,648 @@ +# 麦麦Adapter的部署配置 +adapter: + + image: + repository: unclas/maimbot-adapter + tag: main-20250807151247 + pullPolicy: IfNotPresent + pullSecrets: [ ] + + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + + nodeSelector: {} + tolerations: [] + + # 配置adapter的napcat websocket service + # adapter会启动一个websocket服务端,用于与napcat通信 + # 这里的选项可以帮助你自定义服务端口 + # !!!默认不使用NodePort。如果通过NodePort将服务端口映射到公网可能会被恶意客户端连接,请自行使用中间件鉴权!!! + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的websocket端口映射到物理节点的端口 + port: 8095 # websocket监听端口ClusterIP的端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + + persistence: + storageClass: + accessModes: + - ReadWriteOnce + size: 1Gi + +# 麦麦本体的部署配置 +core: + + # 只有同意了EULA和PRIVACY协议才可以部署麦麦 + # 配置以下的选项为true表示你同意了EULA和PRIVACY条款 + # https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md + # https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md + EULA_AGREE: false + PRIVACY_AGREE: false + + image: + repository: sengokucola/maibot + tag: main-d919c34 + pullPolicy: IfNotPresent + pullSecrets: [ ] + + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + + nodeSelector: {} + tolerations: [] + + persistence: + storageClass: + accessModes: + - ReadWriteOnce + size: 10Gi + +# 麦麦的运行统计看板配置 +# 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以作为静态网页访问 +# 此功能默认禁用。如果你认为报告可以被公开访问(报告包含联系人/群组名称、模型token花费信息等),则可以启用此功能 +# 如果启用此功能,你也可以考虑使用中间件进行鉴权,保护隐私信息 +statistics_dashboard: + + enabled: false # 是否启用运行统计看板 + + replicaCount: 1 + + image: + repository: nginx + tag: latest + pullPolicy: IfNotPresent + pullSecrets: [ ] + + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + + nodeSelector: {} + tolerations: [] + + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 + port: 80 # 服务端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + ingress: + enabled: false + className: nginx + annotations: { } + hosts: + - host: maim-statistics.example.com # 访问运行统计看板的域名 + paths: + - path: / + pathType: Prefix + + persistence: + storageClass: + # 如果你希望运行统计看板服务与麦麦本体运行在不同的节点(多活部署),那么需要ReadWriteMany访问模式 + # 注意:ReadWriteMany特性需要存储类底层支持 + accessModes: + - ReadWriteOnce + size: 100Mi + +# napcat的部署配置 +# !!!napcat部署完毕后,务必修改默认密码!!! +napcat: + + # 考虑到复用外部napcat实例的情况,napcat部署已被解耦 + # 如果你有外部部署的napcat,则可以修改下面的enabled为false,本次不会重复部署napcat + # 如果没有外部部署的napcat,默认会捆绑部署napcat,不需要修改此项 + enabled: true + + image: + repository: mlikiowa/napcat-docker + tag: v4.8.98 + pullPolicy: IfNotPresent + pullSecrets: [ ] + + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + + nodeSelector: {} + tolerations: [] + + # napcat进程的权限,默认不是特权用户 + permission: + uid: 1000 + gid: 1000 + + # 配置napcat web面板的service + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 + port: 6099 # 服务端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + + # 配置napcat web面板的ingress + ingress: + enabled: false # 是否启用 + className: nginx + annotations: { } + hosts: + - host: napcat.example.com # 暴露napcat web面板使用的域名 + paths: + - path: / + pathType: Prefix + + persistence: + storageClass: + accessModes: + - ReadWriteOnce + size: 5Gi + +# sqlite-web的部署配置 +sqlite-web: + + # 通过sqlite-web可以在网页上操作麦麦的数据库,方便调试。不部署对麦麦的运行无影响 + # 默认不会捆绑部署sqlite-web,如果你需要部署,请修改下面的enabled为true + # !!!sqlite-web服务无鉴权,暴露在公网上十分危险,推荐使用集群ClusterIP内网访问!!! + # !!!如果一定要暴露在公网,请自行使用中间件鉴权!!! + enabled: false + + image: + repository: coleifer/sqlite-web + tag: latest + pullPolicy: IfNotPresent + pullSecrets: [ ] + + resources: + limits: + cpu: + memory: + requests: + cpu: + memory: + + # 配置sqlite-web面板的service + # !!!默认不使用NodePort。如果使用NodePort暴露到公网,请自行使用中间件鉴权!!! + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 + port: 8080 # 服务端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + + # 配置sqlite-web面板的ingress + # !!!默认不使用ingress。如果使用ingress暴露到公网,请自行使用中间件鉴权!!! + ingress: + enabled: false # 是否启用 + className: nginx + annotations: { } + hosts: + - host: maim-sqlite.example.com # 暴露websocket使用的域名 + paths: + - path: / + pathType: Prefix + +# 麦麦各部分组件的运行配置文件 +config: + + # adapter的config.toml + adapter_config: | + [inner] + version = "0.1.1" # 版本号 + # 请勿修改版本号,除非你知道自己在做什么 + + [nickname] # 现在没用 + nickname = "" + + [napcat_server] # Napcat连接的ws服务设置 + host = "0.0.0.0" # Napcat设定的主机地址 + port = 8095 # Napcat设定的端口 + heartbeat_interval = 30 # 与Napcat设置的心跳相同(按秒计) + + [maibot_server] # 连接麦麦的ws服务设置 + host = "localhost" # 麦麦在.env文件中设置的主机地址,即HOST字段 + port = 8000 # 麦麦在.env文件中设置的端口,即PORT字段 + + [chat] # 黑白名单功能 + group_list_type = "whitelist" # 群组名单类型,可选为:whitelist, blacklist + group_list = [] # 群组名单 + # 当group_list_type为whitelist时,只有群组名单中的群组可以聊天 + # 当group_list_type为blacklist时,群组名单中的任何群组无法聊天 + private_list_type = "whitelist" # 私聊名单类型,可选为:whitelist, blacklist + private_list = [] # 私聊名单 + # 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天 + # 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天 + ban_user_id = [] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天) + ban_qq_bot = false # 是否屏蔽QQ官方机器人 + enable_poke = true # 是否启用戳一戳功能 + + [voice] # 发送语音设置 + use_tts = false # 是否使用tts语音(请确保你配置了tts并有对应的adapter) + + [debug] + level = "INFO" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL) + + # core的model_config.toml + core_model_config: | + [inner] + version = "1.3.0" + + # 配置文件版本号迭代规则同bot_config.toml + + [[api_providers]] # API服务提供商(可以配置多个) + name = "DeepSeek" # API服务商名称(可随意命名,在models的api-provider中需使用这个命名) + base_url = "https://api.deepseek.cn/v1" # API服务商的BaseURL + api_key = "your-api-key-here" # API密钥(请替换为实际的API密钥) + client_type = "openai" # 请求客户端(可选,默认值为"openai",使用gimini等Google系模型时请配置为"gemini") + max_retry = 2 # 最大重试次数(单个模型API调用失败,最多重试的次数) + timeout = 30 # API请求超时时间(单位:秒) + retry_interval = 10 # 重试间隔时间(单位:秒) + + [[api_providers]] # SiliconFlow的API服务商配置 + name = "SiliconFlow" + base_url = "https://api.siliconflow.cn/v1" + api_key = "your-siliconflow-api-key" + client_type = "openai" + max_retry = 2 + timeout = 30 + retry_interval = 10 + + [[api_providers]] # 特殊:Google的Gimini使用特殊API,与OpenAI格式不兼容,需要配置client为"gemini" + name = "Google" + base_url = "https://api.google.com/v1" + api_key = "your-google-api-key-1" + client_type = "gemini" + max_retry = 2 + timeout = 30 + retry_interval = 10 + + + [[models]] # 模型(可以配置多个) + model_identifier = "deepseek-chat" # 模型标识符(API服务商提供的模型标识符) + name = "deepseek-v3" # 模型名称(可随意命名,在后面中需使用这个命名) + api_provider = "DeepSeek" # API服务商名称(对应在api_providers中配置的服务商名称) + price_in = 2.0 # 输入价格(用于API调用统计,单位:元/ M token)(可选,若无该字段,默认值为0) + price_out = 8.0 # 输出价格(用于API调用统计,单位:元/ M token)(可选,若无该字段,默认值为0) + #force_stream_mode = true # 强制流式输出模式(若模型不支持非流式输出,请取消该注释,启用强制流式输出,若无该字段,默认值为false) + + [[models]] + model_identifier = "Pro/deepseek-ai/DeepSeek-V3" + name = "siliconflow-deepseek-v3" + api_provider = "SiliconFlow" + price_in = 2.0 + price_out = 8.0 + + [[models]] + model_identifier = "Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" + name = "deepseek-r1-distill-qwen-32b" + api_provider = "SiliconFlow" + price_in = 4.0 + price_out = 16.0 + + [[models]] + model_identifier = "Qwen/Qwen3-8B" + name = "qwen3-8b" + api_provider = "SiliconFlow" + price_in = 0 + price_out = 0 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = false # 不启用思考 + + [[models]] + model_identifier = "Qwen/Qwen3-14B" + name = "qwen3-14b" + api_provider = "SiliconFlow" + price_in = 0.5 + price_out = 2.0 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = false # 不启用思考 + + [[models]] + model_identifier = "Qwen/Qwen3-30B-A3B" + name = "qwen3-30b" + api_provider = "SiliconFlow" + price_in = 0.7 + price_out = 2.8 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = false # 不启用思考 + + [[models]] + model_identifier = "Qwen/Qwen2.5-VL-72B-Instruct" + name = "qwen2.5-vl-72b" + api_provider = "SiliconFlow" + price_in = 4.13 + price_out = 4.13 + + [[models]] + model_identifier = "FunAudioLLM/SenseVoiceSmall" + name = "sensevoice-small" + api_provider = "SiliconFlow" + price_in = 0 + price_out = 0 + + [[models]] + model_identifier = "BAAI/bge-m3" + name = "bge-m3" + api_provider = "SiliconFlow" + price_in = 0 + price_out = 0 + + + [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,是麦麦必须的模型 + model_list = ["siliconflow-deepseek-v3"] # 使用的模型列表,每个子项对应上面的模型名称(name) + temperature = 0.2 # 模型温度,新V3建议0.1-0.3 + max_tokens = 800 # 最大输出token数 + + [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 + model_list = ["qwen3-8b"] + temperature = 0.7 + max_tokens = 800 + + [model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习 + model_list = ["siliconflow-deepseek-v3"] + temperature = 0.2 # 模型温度,新V3建议0.1-0.3 + max_tokens = 800 + + [model_task_config.planner] #决策:负责决定麦麦该做什么的模型 + model_list = ["siliconflow-deepseek-v3"] + temperature = 0.3 + max_tokens = 800 + + [model_task_config.emotion] #负责麦麦的情绪变化 + model_list = ["siliconflow-deepseek-v3"] + temperature = 0.3 + max_tokens = 800 + + [model_task_config.vlm] # 图像识别模型 + model_list = ["qwen2.5-vl-72b"] + max_tokens = 800 + + [model_task_config.voice] # 语音识别模型 + model_list = ["sensevoice-small"] + + [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 + model_list = ["qwen3-14b"] + temperature = 0.7 + max_tokens = 800 + + #嵌入模型 + [model_task_config.embedding] + model_list = ["bge-m3"] + + #------------LPMM知识库模型------------ + + [model_task_config.lpmm_entity_extract] # 实体提取模型 + model_list = ["siliconflow-deepseek-v3"] + temperature = 0.2 + max_tokens = 800 + + [model_task_config.lpmm_rdf_build] # RDF构建模型 + model_list = ["siliconflow-deepseek-v3"] + temperature = 0.2 + max_tokens = 800 + + [model_task_config.lpmm_qa] # 问答模型 + model_list = ["deepseek-r1-distill-qwen-32b"] + temperature = 0.7 + max_tokens = 800 + + # core的bot_config.toml + core_bot_config: | + [inner] + version = "6.4.6" + + #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- + #如果你想要修改配置文件,请递增version的值 + #如果新增项目,请阅读src/config/official_configs.py中的说明 + # + # 版本格式:主版本号.次版本号.修订号,版本号递增规则如下: + # 主版本号:MMC版本更新 + # 次版本号:配置文件内容大更新 + # 修订号:配置文件内容小更新 + #----以上是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- + + [bot] + platform = "qq" + qq_account = 1145141919810 # 麦麦的QQ账号 + nickname = "麦麦" # 麦麦的昵称 + alias_names = ["麦叠", "牢麦"] # 麦麦的别名 + + [personality] + # 建议50字以内,描述人格的核心特质 + personality_core = "是一个女孩子" + # 人格的细节,描述人格的一些侧面 + personality_side = "有时候说话不过脑子,喜欢开玩笑, 有时候会表现得无语,有时候会喜欢说一些奇怪的话" + #アイデンティティがない 生まれないらららら + # 可以描述外貌,性别,身高,职业,属性等等描述 + identity = "年龄为19岁,是女孩子,身高为160cm,有黑色的短发" + + # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容 + reply_style = "回复可以简短一些。可以参考贴吧,知乎和微博的回复风格,回复不要浮夸,不要用夸张修辞,平淡一些。不要浮夸,不要夸张修辞。" + + compress_personality = false # 是否压缩人格,压缩后会精简人格信息,节省token消耗并提高回复性能,但是会丢失一些信息,如果人设不长,可以关闭 + compress_identity = true # 是否压缩身份,压缩后会精简身份信息,节省token消耗并提高回复性能,但是会丢失一些信息,如果不长,可以关闭 + + [expression] + # 表达学习配置 + learning_list = [ # 表达学习配置列表,支持按聊天流配置 + ["", "enable", "enable", "1.0"], # 全局配置:使用表达,启用学习,学习强度1.0 + ["qq:1919810:group", "enable", "enable", "1.5"], # 特定群聊配置:使用表达,启用学习,学习强度1.5 + ["qq:114514:private", "enable", "disable", "0.5"], # 特定私聊配置:使用表达,禁用学习,学习强度0.5 + # 格式说明: + # 第一位: chat_stream_id,空字符串表示全局配置 + # 第二位: 是否使用学到的表达 ("enable"/"disable") + # 第三位: 是否学习表达 ("enable"/"disable") + # 第四位: 学习强度(浮点数),影响学习频率,最短学习时间间隔 = 300/学习强度(秒) + # 学习强度越高,学习越频繁;学习强度越低,学习越少 + ] + + expression_groups = [ + ["qq:1919810:private","qq:114514:private","qq:1111111:group"], # 在这里设置互通组,相同组的chat_id会共享学习到的表达方式 + # 格式:["qq:123456:private","qq:654321:group"] + # 注意:如果为群聊,则需要设置为group,如果设置为私聊,则需要设置为private + ] + + + [chat] #麦麦的聊天设置 + talk_frequency = 0.5 + # 麦麦活跃度,越高,麦麦回复越多,范围0-1 + focus_value = 0.5 + # 麦麦的专注度,越高越容易持续连续对话,可能消耗更多token, 范围0-1 + + max_context_size = 20 # 上下文长度 + + mentioned_bot_inevitable_reply = true # 提及 bot 大概率回复 + at_bot_inevitable_reply = true # @bot 或 提及bot 大概率回复 + + focus_value_adjust = [ + ["", "8:00,1", "12:00,0.8", "18:00,1", "01:00,0.3"], + ["qq:114514:group", "12:20,0.6", "16:10,0.5", "20:10,0.8", "00:10,0.3"], + ["qq:1919810:private", "8:20,0.5", "12:10,0.8", "20:10,1", "00:10,0.2"] + ] + + talk_frequency_adjust = [ + ["", "8:00,0.5", "12:00,0.6", "18:00,0.8", "01:00,0.3"], + ["qq:114514:group", "12:20,0.3", "16:10,0.5", "20:10,0.4", "00:10,0.1"], + ["qq:1919810:private", "8:20,0.3", "12:10,0.4", "20:10,0.5", "00:10,0.1"] + ] + # 基于聊天流的个性化活跃度和专注度配置 + # 格式:[["platform:chat_id:type", "HH:MM,frequency", "HH:MM,frequency", ...], ...] + + # 全局配置示例: + # [["", "8:00,1", "12:00,2", "18:00,1.5", "00:00,0.5"]] + + # 特定聊天流配置示例: + # [ + # ["", "8:00,1", "12:00,1.2", "18:00,1.5", "01:00,0.6"], # 全局默认配置 + # ["qq:1026294844:group", "12:20,1", "16:10,2", "20:10,1", "00:10,0.3"], # 特定群聊配置 + # ["qq:729957033:private", "8:20,1", "12:10,2", "20:10,1.5", "00:10,0.2"] # 特定私聊配置 + # ] + + # 说明: + # - 当第一个元素为空字符串""时,表示全局默认配置 + # - 当第一个元素为"platform:id:type"格式时,表示特定聊天流配置 + # - 后续元素是"时间,频率"格式,表示从该时间开始使用该活跃度,直到下一个时间点 + # - 优先级:特定聊天流配置 > 全局配置 > 默认 talk_frequency + + + [relationship] + enable_relationship = true # 是否启用关系系统 + relation_frequency = 1 # 关系频率,麦麦构建关系的频率 + + [message_receive] + # 以下是消息过滤,可以根据规则过滤特定消息,将不会读取这些消息 + ban_words = [ + # "403","张三" + ] + + ban_msgs_regex = [ + # 需要过滤的消息(原始消息)匹配的正则表达式,匹配到的消息将被过滤,若不了解正则表达式请勿修改 + #"https?://[^\\s]+", # 匹配https链接 + #"\\d{4}-\\d{2}-\\d{2}", # 匹配日期 + ] + + [tool] + enable_tool = false # 是否在普通聊天中启用工具 + + [mood] + enable_mood = true # 是否启用情绪系统 + mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢 + + [emoji] + emoji_chance = 0.6 # 麦麦激活表情包动作的概率 + + max_reg_num = 60 # 表情包最大注册数量 + do_replace = true # 开启则在达到最大数量时删除(替换)表情包,关闭则达到最大数量时不会继续收集表情包 + check_interval = 10 # 检查表情包(注册,破损,删除)的时间间隔(分钟) + steal_emoji = true # 是否偷取表情包,让麦麦可以将一些表情包据为己有 + content_filtration = false # 是否启用表情包过滤,只有符合该要求的表情包才会被保存 + filtration_prompt = "符合公序良俗" # 表情包过滤要求,只有符合该要求的表情包才会被保存 + + [memory] + enable_memory = true # 是否启用记忆系统 + memory_build_frequency = 1 # 记忆构建频率 越高,麦麦学习越多 + memory_compress_rate = 0.1 # 记忆压缩率 控制记忆精简程度 建议保持默认,调高可以获得更多信息,但是冗余信息也会增多 + + forget_memory_interval = 3000 # 记忆遗忘间隔 单位秒 间隔越低,麦麦遗忘越频繁,记忆更精简,但更难学习 + memory_forget_time = 48 #多长时间后的记忆会被遗忘 单位小时 + memory_forget_percentage = 0.008 # 记忆遗忘比例 控制记忆遗忘程度 越大遗忘越多 建议保持默认 + + enable_instant_memory = false # 是否启用即时记忆,测试功能,可能存在未知问题 + + #不希望记忆的词,已经记忆的不会受到影响,需要手动清理 + memory_ban_words = [ "表情包", "图片", "回复", "聊天记录" ] + + [voice] + enable_asr = false # 是否启用语音识别,启用后麦麦可以识别语音消息,启用该功能需要配置语音识别模型[model.voice]s + + [lpmm_knowledge] # lpmm知识库配置 + enable = false # 是否启用lpmm知识库 + rag_synonym_search_top_k = 10 # 同义词搜索TopK + rag_synonym_threshold = 0.8 # 同义词阈值(相似度高于此阈值的词语会被认为是同义词) + info_extraction_workers = 3 # 实体提取同时执行线程数,非Pro模型不要设置超过5 + qa_relation_search_top_k = 10 # 关系搜索TopK + qa_relation_threshold = 0.5 # 关系阈值(相似度高于此阈值的关系会被认为是相关的关系) + qa_paragraph_search_top_k = 1000 # 段落搜索TopK(不能过小,可能影响搜索结果) + qa_paragraph_node_weight = 0.05 # 段落节点权重(在图搜索&PPR计算中的权重,当搜索仅使用DPR时,此参数不起作用) + qa_ent_filter_top_k = 10 # 实体过滤TopK + qa_ppr_damping = 0.8 # PPR阻尼系数 + qa_res_top_k = 3 # 最终提供的文段TopK + embedding_dimension = 1024 # 嵌入向量维度,应该与模型的输出维度一致 + + # keyword_rules 用于设置关键词触发的额外回复知识 + # 添加新规则方法:在 keyword_rules 数组中增加一项,格式如下: + # { keywords = ["关键词1", "关键词2"], reaction = "触发这些关键词时的回复内容" } + # 例如,添加一个新规则:当检测到“你好”或“hello”时回复“你好,有什么可以帮你?” + # { keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } + [keyword_reaction] + keyword_rules = [ + { keywords = ["人机", "bot", "机器", "入机", "robot", "机器人", "ai", "AI"], reaction = "有人说你是人机或者机器人,否定这一事实,攻击或反问他。注意,只有认为你是机器人才回复,否则不要否认" }, + { keywords = ["测试关键词回复", "test"], reaction = "回答测试成功" }, + #{ keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } + # 在此处添加更多规则,格式同上 + ] + + regex_rules = [ + { regex = ["^(?P\\S{1,20})是这样的$"], reaction = "请按照以下模板造句:[n]是这样的,xx只要xx就可以,可是[n]要考虑的事情就很多了,比如什么时候xx,什么时候xx,什么时候xx。(请自由发挥替换xx部分,只需保持句式结构,同时表达一种将[n]过度重视的反讽意味)" } + ] + + # 可以自定义部分提示词 + [custom_prompt] + image_prompt = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" + + [response_post_process] + enable_response_post_process = true # 是否启用回复后处理,包括错别字生成器,回复分割器 + + [chinese_typo] + enable = true # 是否启用中文错别字生成器 + error_rate=0.01 # 单字替换概率 + min_freq=9 # 最小字频阈值 + tone_error_rate=0.1 # 声调错误概率 + word_replace_rate=0.006 # 整词替换概率 + + [response_splitter] + enable = true # 是否启用回复分割器 + max_length = 512 # 回复允许的最大长度 + max_sentence_num = 8 # 回复允许的最大句子数 + enable_kaomoji_protection = false # 是否启用颜文字保护 + + [log] + date_style = "m-d H:i:s" # 日期格式 + log_level_style = "lite" # 日志级别样式,可选FULL,compact,lite + color_text = "full" # 日志文本颜色,可选none,title,full + log_level = "INFO" # 全局日志级别(向下兼容,优先级低于下面的分别设置) + console_log_level = "INFO" # 控制台日志级别,可选: DEBUG, INFO, WARNING, ERROR, CRITICAL + file_log_level = "DEBUG" # 文件日志级别,可选: DEBUG, INFO, WARNING, ERROR, CRITICAL + + # 第三方库日志控制 + suppress_libraries = ["faiss","httpx", "urllib3", "asyncio", "websockets", "httpcore", "requests", "peewee", "openai","uvicorn","jieba"] # 完全屏蔽的库 + library_log_levels = { "aiohttp" = "WARNING"} # 设置特定库的日志级别 + + [debug] + show_prompt = false # 是否显示prompt + + [maim_message] + auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 + # 以下项目若要使用需要打开use_custom,并单独配置maim_message的服务器 + use_custom = false # 是否启用自定义的maim_message服务器,注意这需要设置新的端口,不能与.env重复 + host="127.0.0.1" + port=8090 + mode="ws" # 支持ws和tcp两种模式 + use_wss = false # 是否使用WSS安全连接,只支持ws模式 + cert_file = "" # SSL证书文件路径,仅在use_wss=true时有效 + key_file = "" # SSL密钥文件路径,仅在use_wss=true时有效 + + [telemetry] #发送统计信息,主要是看全球有多少只麦麦 + enable = true + + [experimental] #实验性功能 + enable_friend_chat = false # 是否启用好友聊天 From ad11f42d3dae493bf949c38c79a35cf090fa4c32 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:24:40 +0800 Subject: [PATCH 003/142] =?UTF-8?q?=E7=BC=96=E5=86=99volume-linker.sh?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=A6=86=E7=9B=96core=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=90=AF=E5=8A=A8=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=20=E7=94=B1=E4=BA=8Ek8s=E4=B8=8Edocker-compose=E7=9A=84?= =?UTF-8?q?=E5=8D=B7=E6=8C=82=E8=BD=BD=E6=96=B9=E5=BC=8F=E6=9C=89=E6=89=80?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=EF=BC=8C=E9=9C=80=E8=A6=81=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E6=AD=A4=E8=84=9A=E6=9C=AC=E4=B8=BA=E4=B8=80=E4=BA=9B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=92=8C=E7=9B=AE=E5=BD=95=E6=8F=90=E5=89=8D=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=A5=BD=E8=BD=AF=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 helm-chart/files/volume-linker.sh diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh new file mode 100644 index 00000000..944a6e1e --- /dev/null +++ b/helm-chart/files/volume-linker.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# 此脚本用于覆盖core容器的默认启动命令 +# 由于k8s与docker-compose的卷挂载方式有所不同,需要利用此脚本为一些文件和目录提前创建好软链接 +# /MaiMBot/data是麦麦数据的实际挂载路径 +# /MaiMBot/statistics是统计数据的实际挂载路径 + +set -e +echo "[VolumeLinker]Preparing volume..." + +# 初次启动,在存储卷中检查并创建关键文件和目录 +if [ -d /MaiMBot/data/plugins ] +then + echo "[VolumeLinker] '/MaiMBot/data/plugins' exists." +else + mkdir /MaiMBot/data/plugins +fi +if [ -d /MaiMBot/data/logs ] +then + echo "[VolumeLinker] '/MaiMBot/data/logs' exists." +else + mkdir /MaiMBot/data/logs +fi +if [ -f /MaiMBot/statistics/index.html ] +then + echo "[VolumeLinker] '/MaiMBot/statistics/index.html' exists." +else + touch /MaiMBot/statistics/index.html +fi + +# 删除空的插件目录,准备创建软链接 +rm -rf /MaiMBot/plugins + +# 创建软链接,从存储卷链接到实际位置 +ln -s /MaiMBot/data/plugins /MaiMBot/plugins +ln -s /MaiMBot/data/logs /MaiMBot/logs +ln -s /MaiMBot/statistics/index.html /MaiMBot/maibot_statistics.html + +# 启动麦麦 +echo "[VolumeLinker]Starting MaiBot..." +python bot.py From dd52b3fff5aebb9bd3353b81eaf5269900d2ed3e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:42:41 +0800 Subject: [PATCH 004/142] =?UTF-8?q?=E7=BC=96=E5=86=99core=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84configmap=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-configmap.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 helm-chart/templates/core-configmap.yaml diff --git a/helm-chart/templates/core-configmap.yaml b/helm-chart/templates/core-configmap.yaml new file mode 100644 index 00000000..8dd24154 --- /dev/null +++ b/helm-chart/templates/core-configmap.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-core + namespace: {{ .Release.Namespace }} +data: + .env: | + HOST=0.0.0.0 + PORT=8000 + model_config: | + {{ .Values.config.core_model_config | indent 4 }} + bot_config.toml: | + {{ .Values.config.core_bot_config | indent 4 }} From 3b3dbf577762b3d3ec7949adef0c19080d5d30e2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:45:27 +0800 Subject: [PATCH 005/142] =?UTF-8?q?=E7=BC=96=E5=86=99core=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=84=9A=E6=9C=AC=E7=9A=84configmap=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-scripts-configmap.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 helm-chart/templates/core-scripts-configmap.yaml diff --git a/helm-chart/templates/core-scripts-configmap.yaml b/helm-chart/templates/core-scripts-configmap.yaml new file mode 100644 index 00000000..57394122 --- /dev/null +++ b/helm-chart/templates/core-scripts-configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-core-scripts + namespace: {{ .Release.Namespace }} +data: + volume-linker.sh: | + {{ .Files.Get "files/volume-linker.sh" | indent 4 }} From c4cc642f7594c1c7b033a32fe45841134008c777 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:47:48 +0800 Subject: [PATCH 006/142] =?UTF-8?q?=E7=BC=96=E5=86=99core=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84pvc=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-pvc.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 helm-chart/templates/core-pvc.yaml diff --git a/helm-chart/templates/core-pvc.yaml b/helm-chart/templates/core-pvc.yaml new file mode 100644 index 00000000..3c7508cd --- /dev/null +++ b/helm-chart/templates/core-pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-core + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.core.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.core.persistence.size }} + storageClassName: {{ .Values.core.persistence.storageClass | default nil }} From 7dea93052ca4d1f4ee65039010a40f54f7a3b5fc Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:50:48 +0800 Subject: [PATCH 007/142] =?UTF-8?q?=E7=BC=96=E5=86=99core=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E4=BA=8Eadapter=E8=BF=9E=E6=8E=A5=E7=9A=84service?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-service.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 helm-chart/templates/core-service.yaml diff --git a/helm-chart/templates/core-service.yaml b/helm-chart/templates/core-service.yaml new file mode 100644 index 00000000..47c32332 --- /dev/null +++ b/helm-chart/templates/core-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-core + namespace: {{ .Release.Namespace }} +spec: + ports: + - name: adapter-ws + port: 8000 + protocol: TCP + targetPort: 8000 + selector: + app: {{ .Release.Name }}-maibot-core + type: ClusterIP From 6a047e02058426e8de531a38e06f2ae86bbb3803 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 22:53:14 +0800 Subject: [PATCH 008/142] =?UTF-8?q?=E7=BC=96=E5=86=99=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=89=8D=E6=A3=80=E6=9F=A5=E9=A1=B9=EF=BC=88EULA=E5=92=8CPOLIC?= =?UTF-8?q?Y=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-check.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 helm-chart/templates/pre-check.yaml diff --git a/helm-chart/templates/pre-check.yaml b/helm-chart/templates/pre-check.yaml new file mode 100644 index 00000000..2455fd54 --- /dev/null +++ b/helm-chart/templates/pre-check.yaml @@ -0,0 +1,8 @@ +# 检查EULA和PRIVACY +{{- if not .Values.core.EULA_AGREE }} +{{- fail "You must accept the EULA by setting 'core.EULA_AGREE: true'. EULA: https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md" }} +{{- end }} + +{{- if not .Values.core.PRIVACY_AGREE }} +{{- fail "You must accept the Privacy Policy by setting 'core.PRIVACY_AGREE: true'. Privacy Policy: https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md" }} +{{- end }} From 39b5d532e152e100e0dac6c78689bc25cefa6137 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:01:07 +0800 Subject: [PATCH 009/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84configmap=E9=94=AE=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/core-configmap.yaml b/helm-chart/templates/core-configmap.yaml index 8dd24154..a37e0425 100644 --- a/helm-chart/templates/core-configmap.yaml +++ b/helm-chart/templates/core-configmap.yaml @@ -7,7 +7,7 @@ data: .env: | HOST=0.0.0.0 PORT=8000 - model_config: | + model_config.toml: | {{ .Values.config.core_model_config | indent 4 }} bot_config.toml: | {{ .Values.config.core_bot_config | indent 4 }} From 1b8e11995c7e11481d20835792489487cd181533 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:02:27 +0800 Subject: [PATCH 010/142] =?UTF-8?q?=E7=BC=96=E5=86=99core=E7=9A=84Stateful?= =?UTF-8?q?Set=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-statefulset.yaml | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 helm-chart/templates/core-statefulset.yaml diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml new file mode 100644 index 00000000..87472361 --- /dev/null +++ b/helm-chart/templates/core-statefulset.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-core + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-core +spec: + serviceName: {{ .Release.Name }}-maibot-core + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-core + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-core + spec: + containers: + - name: core + command: # 为了在k8s中初始化存储卷,这里替换启动命令为指定脚本 + - sh + args: + - /MaiMBot/volume-linker.sh + env: + - name: TZ + value: Asia/Shanghai + - name: EULA_AGREE + value: 99f08e0cab0190de853cb6af7d64d4de + - name: PRIVACY_AGREE + value: 9943b855e72199d0f5016ea39052f1b6 + image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag }} + imagePullPolicy: {{ .Values.core.image.pullPolicy }} + ports: + - containerPort: 8000 + name: adapter-ws + protocol: TCP + resources: {{ .Values.core.resources }} + volumeMounts: + - mountPath: /MaiMBot/data + name: data + - mountPath: /MaiMBot/volume-linker.sh + name: scripts + readOnly: true + subPath: volume-linker.sh + - mountPath: /MaiMBot/.env + name: config + readOnly: true + subPath: .env + - mountPath: /MaiMBot/config/model_config.toml + name: config + readOnly: true + subPath: model_config.toml + - mountPath: /MaiMBot/config/bot_config.toml + name: config + readOnly: true + subPath: bot_config.toml + {{- if .Values.statistics_dashboard.enabled }} + - mountPath: /MaiMBot/statistics + name: statistics + {{- end }} + imagePullSecrets: {{ .Values.core.image.pullSecrets }} + nodeSelector: {{ .Values.core.nodeSelector }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-core + - configMap: + items: + - key: volume-linker.sh + path: volume-linker.sh + name: {{ .Release.Name }}-maibot-core-scripts + name: scripts + - configMap: + items: + - key: .env + path: .env + - key: model_config.toml + path: model_config.toml + - key: bot_config.toml + path: bot_config.toml + name: {{ .Release.Name }}-maibot-core + name: config + {{- if .Values.statistics_dashboard.enabled }} + - name: statistics + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-statistics + {{- end }} From ae7eab0aa87509b46570cfaf15fdb59ff3c87edc Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:04:05 +0800 Subject: [PATCH 011/142] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=AE=8C=E6=AF=95=E7=9A=84=E5=B8=AE=E5=8A=A9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/NOTES.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 helm-chart/templates/NOTES.txt diff --git a/helm-chart/templates/NOTES.txt b/helm-chart/templates/NOTES.txt new file mode 100644 index 00000000..d898adf3 --- /dev/null +++ b/helm-chart/templates/NOTES.txt @@ -0,0 +1,3 @@ +MaiBot has been successfully deployed. + +MaiBot on GitHub: https://github.com/MaiM-with-u/MaiBot From 8b315fcfa2753130006e093354a4cdc04e0e66b9 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:06:20 +0800 Subject: [PATCH 012/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9EULA=E5=92=8CPrivacy?= =?UTF-8?q?=20Policy=E7=9A=84=E5=90=AF=E7=94=A8=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-check.yaml | 8 ++++---- helm-chart/values.yaml | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/helm-chart/templates/pre-check.yaml b/helm-chart/templates/pre-check.yaml index 2455fd54..18b0cca2 100644 --- a/helm-chart/templates/pre-check.yaml +++ b/helm-chart/templates/pre-check.yaml @@ -1,8 +1,8 @@ # 检查EULA和PRIVACY -{{- if not .Values.core.EULA_AGREE }} -{{- fail "You must accept the EULA by setting 'core.EULA_AGREE: true'. EULA: https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md" }} +{{- if not .Values.EULA_AGREE }} +{{- fail "You must accept the EULA by setting 'EULA_AGREE: true'. EULA: https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md" }} {{- end }} -{{- if not .Values.core.PRIVACY_AGREE }} -{{- fail "You must accept the Privacy Policy by setting 'core.PRIVACY_AGREE: true'. Privacy Policy: https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md" }} +{{- if not .Values.PRIVACY_AGREE }} +{{- fail "You must accept the Privacy Policy by setting 'PRIVACY_AGREE: true'. Privacy Policy: https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md" }} {{- end }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 689b27c1..304329e2 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -1,3 +1,10 @@ +# 只有同意了EULA和PRIVACY协议才可以部署麦麦 +# 配置以下的选项为true表示你同意了EULA和PRIVACY条款 +# https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md +# https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md +EULA_AGREE: false +PRIVACY_AGREE: false + # 麦麦Adapter的部署配置 adapter: @@ -36,13 +43,6 @@ adapter: # 麦麦本体的部署配置 core: - # 只有同意了EULA和PRIVACY协议才可以部署麦麦 - # 配置以下的选项为true表示你同意了EULA和PRIVACY条款 - # https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md - # https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md - EULA_AGREE: false - PRIVACY_AGREE: false - image: repository: sengokucola/maibot tag: main-d919c34 From 65110d597ab5e6fc6c895568809173dcc0640735 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:16:57 +0800 Subject: [PATCH 013/142] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E9=81=97?= =?UTF-8?q?=E6=BC=8F=E7=9A=84=E5=AE=B9=E5=BF=8D=E5=BA=A6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-statefulset.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 87472361..d6717a5b 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -61,6 +61,7 @@ spec: {{- end }} imagePullSecrets: {{ .Values.core.image.pullSecrets }} nodeSelector: {{ .Values.core.nodeSelector }} + tolerations: {{ .Values.core.tolerations }} volumes: - name: data persistentVolumeClaim: From 1d795b4006da7cb65333bdba9810b15131f68172 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:25:01 +0800 Subject: [PATCH 014/142] =?UTF-8?q?=E7=BC=96=E5=86=99adapter=E7=9A=84?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-configmap.yaml | 8 +++ helm-chart/templates/adapter-pvc-yaml | 11 ++++ helm-chart/templates/adapter-service.yaml | 17 +++++++ helm-chart/templates/adapter-statefulset.yaml | 50 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 helm-chart/templates/adapter-configmap.yaml create mode 100644 helm-chart/templates/adapter-pvc-yaml create mode 100644 helm-chart/templates/adapter-service.yaml create mode 100644 helm-chart/templates/adapter-statefulset.yaml diff --git a/helm-chart/templates/adapter-configmap.yaml b/helm-chart/templates/adapter-configmap.yaml new file mode 100644 index 00000000..6b4c80cc --- /dev/null +++ b/helm-chart/templates/adapter-configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} +data: + config.toml: | + {{ .Values.config.adapter_config | indent 4 }} diff --git a/helm-chart/templates/adapter-pvc-yaml b/helm-chart/templates/adapter-pvc-yaml new file mode 100644 index 00000000..288ca9b3 --- /dev/null +++ b/helm-chart/templates/adapter-pvc-yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.adapter.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.adapter.persistence.size }} + storageClassName: {{ .Values.adapter.persistence.storageClass | default nil }} diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml new file mode 100644 index 00000000..1b019912 --- /dev/null +++ b/helm-chart/templates/adapter-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-adapter +spec: + ports: + - name: napcat-ws + port: {{ .Values.adapter.service.port }} + protocol: TCP + targetPort: {{ .Values.adapter.service.port }} + nodePort: {{ .Values.adapter.service.nodePort }} + selector: + app: {{ .Release.Name }}-maibot-adapter + type: {{ .Values.adapter.service.type }} diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml new file mode 100644 index 00000000..836c3f5a --- /dev/null +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -0,0 +1,50 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-adapter +spec: + serviceName: {{ .Release.Name }}-maibot-adapter + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-adapter + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-adapter + spec: + containers: + - name: adapter + env: + - name: TZ + value: Asia/Shanghai + image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag }} + imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} + ports: + - containerPort: {{ .Values.adapter.service.port }} + name: napcat-ws + protocol: TCP + resources: {{ .Values.adapter.resources }} + volumeMounts: + - mountPath: /adapters/data + name: data + - mountPath: /adapters/config.toml + name: config + readOnly: true + subPath: config.toml + imagePullSecrets: {{ .Values.adapter.image.pullSecrets }} + nodeSelector: {{ .Values.adapter.nodeSelector }} + tolerations: {{ .Values.adapter.tolerations }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-adapter + - configMap: + items: + - key: config.toml + path: config.toml + name: {{ .Release.Name }}-maibot-adapter + name: config From 8e12b7ca010fcde9ee5e20bce397f58448c4c319 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:31:23 +0800 Subject: [PATCH 015/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3core=E7=9A=84s?= =?UTF-8?q?ervice=E6=9C=AA=E8=AE=BE=E7=BD=AE=E6=A0=87=E7=AD=BE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-service.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/templates/core-service.yaml b/helm-chart/templates/core-service.yaml index 47c32332..c236e746 100644 --- a/helm-chart/templates/core-service.yaml +++ b/helm-chart/templates/core-service.yaml @@ -3,6 +3,8 @@ kind: Service metadata: name: {{ .Release.Name }}-maibot-core namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-core spec: ports: - name: adapter-ws From 6297b6bffb56b69d915be19b6bb7f88076b77341 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:39:20 +0800 Subject: [PATCH 016/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9values=E4=B8=AD?= =?UTF-8?q?=E7=9A=84ingress=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 304329e2..bbb3e467 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -101,11 +101,9 @@ statistics_dashboard: enabled: false className: nginx annotations: { } - hosts: - - host: maim-statistics.example.com # 访问运行统计看板的域名 - paths: - - path: / - pathType: Prefix + host: maim-statistics.example.com # 访问运行统计看板的域名 + path: / + pathType: Prefix persistence: storageClass: @@ -157,11 +155,9 @@ napcat: enabled: false # 是否启用 className: nginx annotations: { } - hosts: - - host: napcat.example.com # 暴露napcat web面板使用的域名 - paths: - - path: / - pathType: Prefix + host: napcat.example.com # 暴露napcat web面板使用的域名 + path: / + pathType: Prefix persistence: storageClass: @@ -205,11 +201,9 @@ sqlite-web: enabled: false # 是否启用 className: nginx annotations: { } - hosts: - - host: maim-sqlite.example.com # 暴露websocket使用的域名 - paths: - - path: / - pathType: Prefix + host: maim-sqlite.example.com # 暴露websocket使用的域名 + path: / + pathType: Prefix # 麦麦各部分组件的运行配置文件 config: From 5fd0277b6f62631b3f78ff5a2baec5ed0a14816d Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:47:06 +0800 Subject: [PATCH 017/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/{adapter-pvc-yaml => adapter-pvc.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename helm-chart/templates/{adapter-pvc-yaml => adapter-pvc.yaml} (100%) diff --git a/helm-chart/templates/adapter-pvc-yaml b/helm-chart/templates/adapter-pvc.yaml similarity index 100% rename from helm-chart/templates/adapter-pvc-yaml rename to helm-chart/templates/adapter-pvc.yaml From 2540388df5467d035addc4eb697422e8a50b8456 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:55:29 +0800 Subject: [PATCH 018/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3adapter?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=9A=84=E7=AB=AF=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-service.yaml | 2 +- helm-chart/templates/adapter-statefulset.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml index 1b019912..5db4a3b2 100644 --- a/helm-chart/templates/adapter-service.yaml +++ b/helm-chart/templates/adapter-service.yaml @@ -10,7 +10,7 @@ spec: - name: napcat-ws port: {{ .Values.adapter.service.port }} protocol: TCP - targetPort: {{ .Values.adapter.service.port }} + targetPort: 8095 nodePort: {{ .Values.adapter.service.nodePort }} selector: app: {{ .Release.Name }}-maibot-adapter diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index 836c3f5a..7d6df8b4 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -24,7 +24,7 @@ spec: image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag }} imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} ports: - - containerPort: {{ .Values.adapter.service.port }} + - containerPort: 8095 name: napcat-ws protocol: TCP resources: {{ .Values.adapter.resources }} From 15e6bac7e41747be2dd9d4e546b25a3bf3ba9603 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:00:03 +0800 Subject: [PATCH 019/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3adapter?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=9A=84=E7=AB=AF=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-service.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml index 5db4a3b2..af306103 100644 --- a/helm-chart/templates/adapter-service.yaml +++ b/helm-chart/templates/adapter-service.yaml @@ -11,7 +11,9 @@ spec: port: {{ .Values.adapter.service.port }} protocol: TCP targetPort: 8095 + {{- if eq .Values.adapter.service.type "nodePort" }} nodePort: {{ .Values.adapter.service.nodePort }} + {{- end }} selector: app: {{ .Release.Name }}-maibot-adapter type: {{ .Values.adapter.service.type }} From 65f0515e80ccd139f392cf8fb4e11a4ec8dbfcd9 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:00:56 +0800 Subject: [PATCH 020/142] =?UTF-8?q?=E7=BC=96=E5=86=99statistics-dashboard?= =?UTF-8?q?=E7=9A=84=E6=B8=85=E5=8D=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/statistics-deployment.yaml | 49 +++++++++++++++++++ helm-chart/templates/statistics-ingress.yaml | 23 +++++++++ helm-chart/templates/statistics-pvc.yaml | 13 +++++ helm-chart/templates/statistics-service.yaml | 21 ++++++++ 4 files changed, 106 insertions(+) create mode 100644 helm-chart/templates/statistics-deployment.yaml create mode 100644 helm-chart/templates/statistics-ingress.yaml create mode 100644 helm-chart/templates/statistics-pvc.yaml create mode 100644 helm-chart/templates/statistics-service.yaml diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml new file mode 100644 index 00000000..808257b6 --- /dev/null +++ b/helm-chart/templates/statistics-deployment.yaml @@ -0,0 +1,49 @@ +{{- if .Values.statistics_dashboard.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-maibot-statistics-dashboard + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-statistics-dashboard +spec: + replicas: {{ .Values.statistics_dashboard.replicaCount }} + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-statistics-dashboard + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-statistics-dashboard + spec: + containers: + - name: nginx + image: {{ .Values.statistics_dashboard.image.repository }}:{{ .Values.statistics_dashboard.image.tag }} + imagePullPolicy: {{ .Values.statistics_dashboard.image.pullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 80 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + ports: + - containerPort: 80 + name: dashboard + protocol: TCP + resources: {{ .Values.statistics_dashboard.resources }} + volumeMounts: + - mountPath: /usr/share/nginx/html + name: statistics + readOnly: true + imagePullSecrets: {{ .Values.statistics_dashboard.image.pullSecrets }} + nodeSelector: {{ .Values.statistics_dashboard.nodeSelector }} + tolerations: {{ .Values.core.tolerations }} + volumes: + - name: statistics + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-statistics-dashboard +{{- end }} diff --git a/helm-chart/templates/statistics-ingress.yaml b/helm-chart/templates/statistics-ingress.yaml new file mode 100644 index 00000000..9c7c2a51 --- /dev/null +++ b/helm-chart/templates/statistics-ingress.yaml @@ -0,0 +1,23 @@ +{{- if .Values.statistics_dashboard.enabled and .Values.statistics_dashboard.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-maibot-statistics-dashboard + namespace: {{ .Release.Namespace }} + annotations: {{ .Values.statistics_dashboard.ingress.annotations }} + labels: + app: {{ .Release.Name }}-maibot-statistics-dashboard +spec: + ingressClassName: {{ .Values.statistics_dashboard.ingress.className }} + rules: + - host: {{ .Values.statistics_dashboard.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-maibot-statistics-dashboard + port: + number: {{ .Values.statistics_dashboard.service.port }} + path: {{ .Values.statistics_dashboard.ingress.path }} + pathType: {{ .Values.statistics_dashboard.ingress.pathType }} +{{- end }} diff --git a/helm-chart/templates/statistics-pvc.yaml b/helm-chart/templates/statistics-pvc.yaml new file mode 100644 index 00000000..783614ab --- /dev/null +++ b/helm-chart/templates/statistics-pvc.yaml @@ -0,0 +1,13 @@ +{{- if .Values.statistics_dashboard.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-statistics-dashboard + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.statistics_dashboard.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.statistics_dashboard.persistence.size }} + storageClassName: {{ .Values.statistics_dashboard.persistence.storageClass | default nil }} +{{- end }} diff --git a/helm-chart/templates/statistics-service.yaml b/helm-chart/templates/statistics-service.yaml new file mode 100644 index 00000000..86d0d628 --- /dev/null +++ b/helm-chart/templates/statistics-service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.statistics_dashboard.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-statistics-dashboard + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-statistics-dashboard +spec: + ports: + - name: dashboard + port: {{ .Values.statistics_dashboard.service.port }} + protocol: TCP + targetPort: 80 + {{- if eq .Values.statistics_dashboard.service.type "nodePort" }} + nodePort: {{ .Values.statistics_dashboard.service.nodePort }} + {{- end }} + selector: + app: {{ .Release.Name }}-maibot-statistics-dashboard + type: {{ .Values.statistics_dashboard.service.type }} +{{- end }} From a72fc3b9f465093361ee0f4abdbe7c6961e4590f Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:04:24 +0800 Subject: [PATCH 021/142] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index bbb3e467..2f9f1be0 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -2,8 +2,8 @@ # 配置以下的选项为true表示你同意了EULA和PRIVACY条款 # https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md # https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md -EULA_AGREE: false -PRIVACY_AGREE: false +EULA_AGREE: false +PRIVACY_AGREE: false # 麦麦Adapter的部署配置 adapter: From 7f719fd3b7e6f42166ad7906fa657dbe925b9509 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:29:06 +0800 Subject: [PATCH 022/142] =?UTF-8?q?=E7=BC=96=E5=86=99napcat=E7=9A=84?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/napcat-ingress.yaml | 23 ++++++++ helm-chart/templates/napcat-pvc.yaml | 13 +++++ helm-chart/templates/napcat-service.yaml | 21 +++++++ helm-chart/templates/napcat-statefulset.yaml | 60 ++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 helm-chart/templates/napcat-ingress.yaml create mode 100644 helm-chart/templates/napcat-pvc.yaml create mode 100644 helm-chart/templates/napcat-service.yaml create mode 100644 helm-chart/templates/napcat-statefulset.yaml diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat-ingress.yaml new file mode 100644 index 00000000..bd28cd3c --- /dev/null +++ b/helm-chart/templates/napcat-ingress.yaml @@ -0,0 +1,23 @@ +{{- if .Values.napcat.enabled and .Values.napcat.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + annotations: {{ .Values.napcat.ingress.annotations }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + ingressClassName: {{ .Values.napcat.ingress.className }} + rules: + - host: {{ .Values.napcat.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-maibot-napcat + port: + number: {{ .Values.napcat.service.port }} + path: {{ .Values.napcat.ingress.path }} + pathType: {{ .Values.napcat.ingress.pathType }} +{{- end }} diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat-pvc.yaml new file mode 100644 index 00000000..b1a008b3 --- /dev/null +++ b/helm-chart/templates/napcat-pvc.yaml @@ -0,0 +1,13 @@ +{{- if .Values.napcat.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.napcat.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.napcat.persistence.size }} + storageClassName: {{ .Values.napcat.persistence.storageClass | default nil }} +{{- end }} diff --git a/helm-chart/templates/napcat-service.yaml b/helm-chart/templates/napcat-service.yaml new file mode 100644 index 00000000..a3dc0c8d --- /dev/null +++ b/helm-chart/templates/napcat-service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.napcat.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + ports: + - name: webui + port: {{ .Values.napcat.service.port }} + protocol: TCP + targetPort: 6099 + {{- if eq .Values.napcat.service.type "nodePort" }} + nodePort: {{ .Values.napcat.service.nodePort }} + {{- end }} + selector: + app: {{ .Release.Name }}-maibot-napcat + type: {{ .Values.napcat.service.type }} +{{- end }} diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml new file mode 100644 index 00000000..c7f78f63 --- /dev/null +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -0,0 +1,60 @@ +{{- if .Values.napcat.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + serviceName: {{ .Release.Name }}-maibot-napcat + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-napcat + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-napcat + spec: + containers: + - name: napcat + env: + - name: NAPCAT_GID + value: {{ .Values.napcat.permission.gid }} + - name: NAPCAT_UID + value: {{ .Values.napcat.permission.uid }} + - name: TZ + value: Asia/Shanghai + image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag }} + imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 6099 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 60 + successThreshold: 1 + timeoutSeconds: 10 + ports: + - containerPort: 6099 + name: webui + protocol: TCP + resources: {{ .Values.napcat.resources }} + volumeMounts: + - mountPath: /app/napcat/config + name: napcat + subPath: config + - mountPath: /app/.config/QQ + name: napcat + subPath: data + imagePullSecrets: {{ .Values.napcat.image.pullSecrets }} + nodeSelector: {{ .Values.napcat.nodeSelector }} + tolerations: {{ .Values.napcat.tolerations }} + volumes: + - name: napcat + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-napcat +{{- end }} From 37c73072777d00ddf3e322b5969e35b8cb9b4c7e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:33:42 +0800 Subject: [PATCH 023/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9values?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=A8=AA=E6=9D=A0=E4=B8=BA=E4=B8=8B=E5=88=92?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 2f9f1be0..149d30d1 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -166,7 +166,7 @@ napcat: size: 5Gi # sqlite-web的部署配置 -sqlite-web: +sqlite_web: # 通过sqlite-web可以在网页上操作麦麦的数据库,方便调试。不部署对麦麦的运行无影响 # 默认不会捆绑部署sqlite-web,如果你需要部署,请修改下面的enabled为true From c2c08887fa3bb1ac3f347d78d0898df671931efc Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:38:39 +0800 Subject: [PATCH 024/142] =?UTF-8?q?fix:=20=E4=B8=BAsqlite-web=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=81=97=E6=BC=8F=E7=9A=84nodeSelector=E5=92=8Ctolera?= =?UTF-8?q?tions=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 149d30d1..a160af63 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -188,6 +188,9 @@ sqlite_web: cpu: memory: + nodeSelector: {} + tolerations: [] + # 配置sqlite-web面板的service # !!!默认不使用NodePort。如果使用NodePort暴露到公网,请自行使用中间件鉴权!!! service: From c65424f0760a9913b2942585bbe1bcffa9047db3 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:44:54 +0800 Subject: [PATCH 025/142] =?UTF-8?q?=E7=BC=96=E5=86=99sqlite-web=E7=9A=84?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/sqlite-web-ingress.yaml | 23 ++++++++ helm-chart/templates/sqlite-web-service.yaml | 21 ++++++++ .../templates/sqlite-web-statefulset.yaml | 52 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 helm-chart/templates/sqlite-web-ingress.yaml create mode 100644 helm-chart/templates/sqlite-web-service.yaml create mode 100644 helm-chart/templates/sqlite-web-statefulset.yaml diff --git a/helm-chart/templates/sqlite-web-ingress.yaml b/helm-chart/templates/sqlite-web-ingress.yaml new file mode 100644 index 00000000..e5426d39 --- /dev/null +++ b/helm-chart/templates/sqlite-web-ingress.yaml @@ -0,0 +1,23 @@ +{{- if .Values.sqlite_web.enabled and .Values.sqlite_web.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-maibot-sqlite-web + namespace: {{ .Release.Namespace }} + annotations: {{ .Values.sqlite_web.ingress.annotations }} + labels: + app: {{ .Release.Name }}-maibot-sqlite-web +spec: + ingressClassName: {{ .Values.sqlite_web.ingress.className }} + rules: + - host: {{ .Values.sqlite_web.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-maibot-sqlite-web + port: + number: {{ .Values.sqlite_web.service.port }} + path: {{ .Values.sqlite_web.ingress.path }} + pathType: {{ .Values.sqlite_web.ingress.pathType }} +{{- end }} diff --git a/helm-chart/templates/sqlite-web-service.yaml b/helm-chart/templates/sqlite-web-service.yaml new file mode 100644 index 00000000..4212a5a8 --- /dev/null +++ b/helm-chart/templates/sqlite-web-service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.sqlite_web.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-sqlite-web + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-sqlite-web +spec: + ports: + - name: webui + port: {{ .Values.sqlite_web.service.port }} + protocol: TCP + targetPort: 8080 + {{- if eq .Values.sqlite_web.service.type "nodePort" }} + nodePort: {{ .Values.sqlite_web.service.nodePort }} + {{- end }} + selector: + app: {{ .Release.Name }}-maibot-sqlite-web + type: {{ .Values.sqlite_web.service.type }} +{{- end }} diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml new file mode 100644 index 00000000..121d11cf --- /dev/null +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -0,0 +1,52 @@ +{{- if .Values.sqlite_web.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-sqlite-web + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-sqlite-web +spec: + serviceName: {{ .Release.Name }}-maibot-sqlite-web + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-sqlite-web + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-sqlite-web + spec: + containers: + - name: sqlite-web + env: + - name: SQLITE_DATABASE + value: /data/MaiMBot/MaiBot.db + image: {{ .Values.sqlite_web.image.repository }}:{{ .Values.sqlite_web.image.tag }} + imagePullPolicy: {{ .Values.sqlite_web.image.pullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 8080 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 60 + successThreshold: 1 + timeoutSeconds: 10 + ports: + - containerPort: 8080 + name: webui + protocol: TCP + resources: {{ .Values.sqlite_web.resources }} + volumeMounts: + - mountPath: /data/MaiMBot + name: data + imagePullSecrets: {{ .Values.sqlite_web.image.pullSecrets }} + nodeSelector: {{ .Values.sqlite_web.nodeSelector }} + tolerations: {{ .Values.sqlite_web.tolerations }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-core +{{- end }} From f891fdd0c45ff51d8810aad90e5557efec540c0b Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:52:27 +0800 Subject: [PATCH 026/142] =?UTF-8?q?fix:=20=E6=9D=A1=E4=BB=B6=E4=B8=8E?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/napcat-ingress.yaml | 2 +- helm-chart/templates/sqlite-web-ingress.yaml | 2 +- helm-chart/templates/statistics-ingress.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat-ingress.yaml index bd28cd3c..9c590895 100644 --- a/helm-chart/templates/napcat-ingress.yaml +++ b/helm-chart/templates/napcat-ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.napcat.enabled and .Values.napcat.ingress.enabled }} +{{- if and .Values.napcat.enabled .Values.napcat.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/helm-chart/templates/sqlite-web-ingress.yaml b/helm-chart/templates/sqlite-web-ingress.yaml index e5426d39..967c9999 100644 --- a/helm-chart/templates/sqlite-web-ingress.yaml +++ b/helm-chart/templates/sqlite-web-ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.sqlite_web.enabled and .Values.sqlite_web.ingress.enabled }} +{{- if and .Values.sqlite_web.enabled .Values.sqlite_web.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/helm-chart/templates/statistics-ingress.yaml b/helm-chart/templates/statistics-ingress.yaml index 9c7c2a51..c7756647 100644 --- a/helm-chart/templates/statistics-ingress.yaml +++ b/helm-chart/templates/statistics-ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.statistics_dashboard.enabled and .Values.statistics_dashboard.ingress.enabled }} +{{- if and .Values.statistics_dashboard.enabled .Values.statistics_dashboard.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: From df3ebc07ee7c7fc6286aecf9c588be455dace0a1 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 01:01:07 +0800 Subject: [PATCH 027/142] =?UTF-8?q?fix:=20helm=E6=A8=A1=E6=9D=BF=E7=BC=A9?= =?UTF-8?q?=E8=BF=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-configmap.yaml | 2 +- helm-chart/templates/core-configmap.yaml | 4 ++-- helm-chart/templates/core-scripts-configmap.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helm-chart/templates/adapter-configmap.yaml b/helm-chart/templates/adapter-configmap.yaml index 6b4c80cc..ebc9e568 100644 --- a/helm-chart/templates/adapter-configmap.yaml +++ b/helm-chart/templates/adapter-configmap.yaml @@ -5,4 +5,4 @@ metadata: namespace: {{ .Release.Namespace }} data: config.toml: | - {{ .Values.config.adapter_config | indent 4 }} + {{ .Values.config.adapter_config | nindent 4 }} diff --git a/helm-chart/templates/core-configmap.yaml b/helm-chart/templates/core-configmap.yaml index a37e0425..25f0ef2d 100644 --- a/helm-chart/templates/core-configmap.yaml +++ b/helm-chart/templates/core-configmap.yaml @@ -8,6 +8,6 @@ data: HOST=0.0.0.0 PORT=8000 model_config.toml: | - {{ .Values.config.core_model_config | indent 4 }} + {{ .Values.config.core_model_config | nindent 4 }} bot_config.toml: | - {{ .Values.config.core_bot_config | indent 4 }} + {{ .Values.config.core_bot_config | nindent 4 }} diff --git a/helm-chart/templates/core-scripts-configmap.yaml b/helm-chart/templates/core-scripts-configmap.yaml index 57394122..79c05d96 100644 --- a/helm-chart/templates/core-scripts-configmap.yaml +++ b/helm-chart/templates/core-scripts-configmap.yaml @@ -5,4 +5,4 @@ metadata: namespace: {{ .Release.Namespace }} data: volume-linker.sh: | - {{ .Files.Get "files/volume-linker.sh" | indent 4 }} + {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} From 50140354cfc2cce13ffa0321137525ae2589d95a Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:32:03 +0800 Subject: [PATCH 028/142] =?UTF-8?q?core=E6=9C=8D=E5=8A=A1=E7=9A=84DNS?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=98=AF=E5=8A=A8=E6=80=81=E7=9A=84=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9C=A8adapter=E6=9C=8D=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=EF=BC=8C=E5=9B=A0=E6=AD=A4=E5=9C=A8=E9=83=A8?= =?UTF-8?q?=E7=BD=B2helm=20chart=E6=97=B6=E5=8A=A8=E6=80=81=E7=94=9F?= =?UTF-8?q?=E6=88=90adapter=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/adapter-cm-generator.py | 41 +++++++++++++++ helm-chart/files/adapter-pip-installer.sh | 5 ++ helm-chart/templates/adapter-configmap.yaml | 8 --- .../templates/core-scripts-configmap.yaml | 8 --- helm-chart/templates/core-statefulset.yaml | 2 +- .../templates/pre-adapter-cm-gen-job.yaml | 50 +++++++++++++++++++ .../templates/pre-adapter-cm-gen-rbac.yaml | 39 +++++++++++++++ helm-chart/templates/scripts-configmap.yaml | 15 ++++++ helm-chart/values.yaml | 6 --- 9 files changed, 151 insertions(+), 23 deletions(-) create mode 100644 helm-chart/files/adapter-cm-generator.py create mode 100644 helm-chart/files/adapter-pip-installer.sh delete mode 100644 helm-chart/templates/adapter-configmap.yaml delete mode 100644 helm-chart/templates/core-scripts-configmap.yaml create mode 100644 helm-chart/templates/pre-adapter-cm-gen-job.yaml create mode 100644 helm-chart/templates/pre-adapter-cm-gen-rbac.yaml create mode 100644 helm-chart/templates/scripts-configmap.yaml diff --git a/helm-chart/files/adapter-cm-generator.py b/helm-chart/files/adapter-cm-generator.py new file mode 100644 index 00000000..8a3637b0 --- /dev/null +++ b/helm-chart/files/adapter-cm-generator.py @@ -0,0 +1,41 @@ +#!/bin/python3 +# 这个脚本的作用是在部署helm chart时动态生成adapter的配置文件,保存在configmap中 +# 需要动态生成的原因是core服务的DNS名称是动态的,无法在adapter服务的配置文件中提前确定 +# 一些与k8s现有资源冲突的配置也会在这里重置 + +import os +import toml +import base64 +from kubernetes import client, config + +config.load_incluster_config() +v1 = client.CoreV1Api() + +# 读取部署的关键信息 +namespace = os.getenv("NAMESPACE") +release_name = os.getenv("RELEASE_NAME") +data_b64 = os.getenv("DATA_B64") + +# 解析并覆盖关键配置 +# 这里被覆盖的配置应当在helm chart中针对对应的k8s资源来灵活修改 +data = toml.loads(base64.b64decode(data_b64).decode("utf-8")) +data['napcat_server']['host'] = '0.0.0.0' +data['napcat_server']['port'] = 8095 +data['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release名称动态拼接core服务的DNS名称 +data['maibot_server']['port'] = 8000 + +# 创建/修改configmap +cm_name = f'{release_name}-maibot-adapter' +cm = client.V1ConfigMap( + metadata=client.V1ObjectMeta(name=cm_name), + data={'config.toml': toml.dumps(data)} +) +try: + v1.create_namespaced_config_map(namespace, cm) + print(f"ConfigMap `{cm_name}` created successfully") +except client.exceptions.ApiException as e: + if e.status == 409: # 已存在,更新 + v1.replace_namespaced_config_map(cm_name, namespace, cm) + print(f"ConfigMap `{cm_name}` replaced successfully") + else: + raise diff --git a/helm-chart/files/adapter-pip-installer.sh b/helm-chart/files/adapter-pip-installer.sh new file mode 100644 index 00000000..47564820 --- /dev/null +++ b/helm-chart/files/adapter-pip-installer.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# 这个脚本的作用是安装必要的python包,为adapter-cm-generator.py脚本做准备 + +pip3 install -i https://mirrors.ustc.edu.cn/pypi/simple kubernetes toml +python3 adapter-cm-generator.py diff --git a/helm-chart/templates/adapter-configmap.yaml b/helm-chart/templates/adapter-configmap.yaml deleted file mode 100644 index ebc9e568..00000000 --- a/helm-chart/templates/adapter-configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-maibot-adapter - namespace: {{ .Release.Namespace }} -data: - config.toml: | - {{ .Values.config.adapter_config | nindent 4 }} diff --git a/helm-chart/templates/core-scripts-configmap.yaml b/helm-chart/templates/core-scripts-configmap.yaml deleted file mode 100644 index 79c05d96..00000000 --- a/helm-chart/templates/core-scripts-configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-maibot-core-scripts - namespace: {{ .Release.Namespace }} -data: - volume-linker.sh: | - {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index d6717a5b..42668d7b 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -70,7 +70,7 @@ spec: items: - key: volume-linker.sh path: volume-linker.sh - name: {{ .Release.Name }}-maibot-core-scripts + name: {{ .Release.Name }}-maibot-scripts name: scripts - configMap: items: diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml new file mode 100644 index 00000000..a062735d --- /dev/null +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -0,0 +1,50 @@ +# 动态生成adapter配置文件的configmap的job,仅会在部署时运行一次 +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Release.Name }}-adapter-cm-generator + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + backoffLimit: 0 + template: + spec: + serviceAccountName: {{ .Release.Name }}-adapter-cm-generator + restartPolicy: Never + containers: + - name: python + image: python:slim + workingDir: /app + command: + - sh + args: + - adapter-pip-installer.sh + env: + - name: NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: RELEASE_NAME + value: {{ .Release.Name }} + - name: DATA_B64 + value: {{ .Values.config.adapter_config | b64enc }} # 将配置文件编码为base64,从环境变量注入 + volumeMounts: + - mountPath: /app/adapter-pip-installer.sh + name: scripts + readOnly: true + subPath: adapter-pip-installer.sh + - mountPath: /app/adapter-cm-generator.py + name: scripts + readOnly: true + subPath: adapter-cm-generator.py + volumes: + - name: scripts + configMap: + name: {{ .Release.Name }}-maibot-scripts + items: + - key: adapter-pip-installer.sh + path: adapter-pip-installer.sh + - key: adapter-cm-generator.py + path: adapter-cm-generator.py diff --git a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml new file mode 100644 index 00000000..786f2de9 --- /dev/null +++ b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml @@ -0,0 +1,39 @@ +# 动态生成adapter配置文件的configmap所需要的rbac授权 +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Release.Name }}-adapter-cm-generator + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Release.Name }}-adapter-cm-gen-role + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +rules: + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "create", "update", "patch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Release.Name }}-adapter-cm-gen-role-binding + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": pre-install + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +subjects: + - kind: ServiceAccount + name: {{ .Release.Name }}-adapter-cm-generator + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Release.Name }}-adapter-cm-gen-role + apiGroup: rbac.authorization.k8s.io diff --git a/helm-chart/templates/scripts-configmap.yaml b/helm-chart/templates/scripts-configmap.yaml new file mode 100644 index 00000000..6eb0c4db --- /dev/null +++ b/helm-chart/templates/scripts-configmap.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-scripts + namespace: {{ .Release.Namespace }} +data: + # pre-install hook + adapter-pip-installer.sh: | + {{ .Files.Get "files/adapter-pip-installer.sh" | nindent 4 }} + adapter-cm-generator.py: | + {{ .Files.Get "files/adapter-cm-generator.py" | nindent 4 }} + + # core + volume-linker.sh: | + {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index a160af63..b9ac3277 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -221,14 +221,8 @@ config: nickname = "" [napcat_server] # Napcat连接的ws服务设置 - host = "0.0.0.0" # Napcat设定的主机地址 - port = 8095 # Napcat设定的端口 heartbeat_interval = 30 # 与Napcat设置的心跳相同(按秒计) - [maibot_server] # 连接麦麦的ws服务设置 - host = "localhost" # 麦麦在.env文件中设置的主机地址,即HOST字段 - port = 8000 # 麦麦在.env文件中设置的端口,即PORT字段 - [chat] # 黑白名单功能 group_list_type = "whitelist" # 群组名单类型,可选为:whitelist, blacklist group_list = [] # 群组名单 From f2ef353cc088851c8fd4b5e02e00bb7209b5b0bf Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:35:11 +0800 Subject: [PATCH 029/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 4 ++-- helm-chart/templates/pre-adapter-cm-gen-rbac.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index a062735d..e714ce76 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: {{ .Release.Name }}-adapter-cm-generator + name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} annotations: "helm.sh/hook": pre-install @@ -11,7 +11,7 @@ spec: backoffLimit: 0 template: spec: - serviceAccountName: {{ .Release.Name }}-adapter-cm-generator + serviceAccountName: {{ .Release.Name }}-maibot-adapter-cm-generator restartPolicy: Never containers: - name: python diff --git a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml index 786f2de9..cad56079 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ .Release.Name }}-adapter-cm-generator + name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} annotations: "helm.sh/hook": pre-install @@ -11,7 +11,7 @@ metadata: apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ .Release.Name }}-adapter-cm-gen-role + name: {{ .Release.Name }}-maibot-adapter-cm-gen-role namespace: {{ .Release.Namespace }} annotations: "helm.sh/hook": pre-install @@ -24,7 +24,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ .Release.Name }}-adapter-cm-gen-role-binding + name: {{ .Release.Name }}-maibot-adapter-cm-gen-role-binding namespace: {{ .Release.Namespace }} annotations: "helm.sh/hook": pre-install From 37d3427698128a59aa7115f04bd8d2adcd72b550 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:36:29 +0800 Subject: [PATCH 030/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-rbac.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml index cad56079..53c8e8b5 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml @@ -31,9 +31,9 @@ metadata: "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded subjects: - kind: ServiceAccount - name: {{ .Release.Name }}-adapter-cm-generator + name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} roleRef: kind: Role - name: {{ .Release.Name }}-adapter-cm-gen-role + name: {{ .Release.Name }}-maibot-adapter-cm-gen-role apiGroup: rbac.authorization.k8s.io From 1eb5c4c56b0e518d8b4ba776c6b9494f41c81073 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:41:39 +0800 Subject: [PATCH 031/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9A=84=E8=BF=90=E8=A1=8C=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 +- helm-chart/templates/pre-adapter-cm-gen-rbac.yaml | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index e714ce76..2337f859 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -5,7 +5,7 @@ metadata: name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} annotations: - "helm.sh/hook": pre-install + "helm.sh/hook": post-install "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: backoffLimit: 0 diff --git a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml index 53c8e8b5..69fefbef 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml @@ -4,18 +4,12 @@ kind: ServiceAccount metadata: name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-install - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ .Release.Name }}-maibot-adapter-cm-gen-role namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-install - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded rules: - apiGroups: [""] resources: ["configmaps"] @@ -26,9 +20,6 @@ kind: RoleBinding metadata: name: {{ .Release.Name }}-maibot-adapter-cm-gen-role-binding namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": pre-install - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded subjects: - kind: ServiceAccount name: {{ .Release.Name }}-maibot-adapter-cm-generator From 3624e5e63d2110476669bda5ea4f4ad7859dcb47 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:45:21 +0800 Subject: [PATCH 032/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3values?= =?UTF-8?q?=E5=86=85=E7=9A=84=E8=B5=84=E6=BA=90=E9=99=90=E5=88=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 60 +++++++++++------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index b9ac3277..0acdfb35 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -14,16 +14,10 @@ adapter: pullPolicy: IfNotPresent pullSecrets: [ ] - resources: - limits: - cpu: - memory: - requests: - cpu: - memory: + resources: { } - nodeSelector: {} - tolerations: [] + nodeSelector: { } + tolerations: [ ] # 配置adapter的napcat websocket service # adapter会启动一个websocket服务端,用于与napcat通信 @@ -49,16 +43,10 @@ core: pullPolicy: IfNotPresent pullSecrets: [ ] - resources: - limits: - cpu: - memory: - requests: - cpu: - memory: + resources: { } - nodeSelector: {} - tolerations: [] + nodeSelector: { } + tolerations: [ ] persistence: storageClass: @@ -82,16 +70,10 @@ statistics_dashboard: pullPolicy: IfNotPresent pullSecrets: [ ] - resources: - limits: - cpu: - memory: - requests: - cpu: - memory: + resources: { } - nodeSelector: {} - tolerations: [] + nodeSelector: { } + tolerations: [ ] service: type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 @@ -128,16 +110,10 @@ napcat: pullPolicy: IfNotPresent pullSecrets: [ ] - resources: - limits: - cpu: - memory: - requests: - cpu: - memory: + resources: { } - nodeSelector: {} - tolerations: [] + nodeSelector: { } + tolerations: [ ] # napcat进程的权限,默认不是特权用户 permission: @@ -180,16 +156,10 @@ sqlite_web: pullPolicy: IfNotPresent pullSecrets: [ ] - resources: - limits: - cpu: - memory: - requests: - cpu: - memory: + resources: { } - nodeSelector: {} - tolerations: [] + nodeSelector: { } + tolerations: [ ] # 配置sqlite-web面板的service # !!!默认不使用NodePort。如果使用NodePort暴露到公网,请自行使用中间件鉴权!!! From 0f82ebf53e430d46c042cafc9bc59105d8d512ea Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:48:36 +0800 Subject: [PATCH 033/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/napcat-statefulset.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index c7f78f63..0c9b6296 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -21,9 +21,9 @@ spec: - name: napcat env: - name: NAPCAT_GID - value: {{ .Values.napcat.permission.gid }} + value: "{{ .Values.napcat.permission.gid }}" - name: NAPCAT_UID - value: {{ .Values.napcat.permission.uid }} + value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag }} From 93778370bfa6992f512bbc585bf6006da88a3cf3 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:52:18 +0800 Subject: [PATCH 034/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E9=99=90=E5=88=B6=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-statefulset.yaml | 2 +- helm-chart/templates/core-statefulset.yaml | 2 +- helm-chart/templates/napcat-statefulset.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index 7d6df8b4..311c6d1e 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -27,7 +27,7 @@ spec: - containerPort: 8095 name: napcat-ws protocol: TCP - resources: {{ .Values.adapter.resources }} + resources: {{ .Values.adapter.resources | default nil }} volumeMounts: - mountPath: /adapters/data name: data diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 42668d7b..7a1b55d4 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -35,7 +35,7 @@ spec: - containerPort: 8000 name: adapter-ws protocol: TCP - resources: {{ .Values.core.resources }} + resources: {{ .Values.core.resources | default nil }} volumeMounts: - mountPath: /MaiMBot/data name: data diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index 0c9b6296..51be029f 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -42,7 +42,7 @@ spec: - containerPort: 6099 name: webui protocol: TCP - resources: {{ .Values.napcat.resources }} + resources: {{ .Values.napcat.resources | default nil }} volumeMounts: - mountPath: /app/napcat/config name: napcat From 4c5c7137e78c44c5a869b5326a67059b213e314b Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 02:58:21 +0800 Subject: [PATCH 035/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-service.yaml | 2 +- helm-chart/templates/adapter-statefulset.yaml | 6 +++--- helm-chart/templates/core-statefulset.yaml | 6 +++--- helm-chart/templates/napcat-ingress.yaml | 2 +- helm-chart/templates/napcat-service.yaml | 2 +- helm-chart/templates/napcat-statefulset.yaml | 6 +++--- helm-chart/templates/sqlite-web-ingress.yaml | 2 +- helm-chart/templates/sqlite-web-service.yaml | 2 +- helm-chart/templates/sqlite-web-statefulset.yaml | 6 +++--- helm-chart/templates/statistics-deployment.yaml | 6 +++--- helm-chart/templates/statistics-ingress.yaml | 2 +- helm-chart/templates/statistics-service.yaml | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml index af306103..4df2d31d 100644 --- a/helm-chart/templates/adapter-service.yaml +++ b/helm-chart/templates/adapter-service.yaml @@ -12,7 +12,7 @@ spec: protocol: TCP targetPort: 8095 {{- if eq .Values.adapter.service.type "nodePort" }} - nodePort: {{ .Values.adapter.service.nodePort }} + nodePort: {{ .Values.adapter.service.nodePort | default nil }} {{- end }} selector: app: {{ .Release.Name }}-maibot-adapter diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index 311c6d1e..998819ae 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -35,9 +35,9 @@ spec: name: config readOnly: true subPath: config.toml - imagePullSecrets: {{ .Values.adapter.image.pullSecrets }} - nodeSelector: {{ .Values.adapter.nodeSelector }} - tolerations: {{ .Values.adapter.tolerations }} + imagePullSecrets: {{ .Values.adapter.image.pullSecrets | default nil }} + nodeSelector: {{ .Values.adapter.nodeSelector | default nil }} + tolerations: {{ .Values.adapter.tolerations | default nil }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 7a1b55d4..56f73581 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -59,9 +59,9 @@ spec: - mountPath: /MaiMBot/statistics name: statistics {{- end }} - imagePullSecrets: {{ .Values.core.image.pullSecrets }} - nodeSelector: {{ .Values.core.nodeSelector }} - tolerations: {{ .Values.core.tolerations }} + imagePullSecrets: {{ .Values.core.image.pullSecrets | default nil }} + nodeSelector: {{ .Values.core.nodeSelector | default nil }} + tolerations: {{ .Values.core.tolerations | default nil }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat-ingress.yaml index 9c590895..2343ca9c 100644 --- a/helm-chart/templates/napcat-ingress.yaml +++ b/helm-chart/templates/napcat-ingress.yaml @@ -4,7 +4,7 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-napcat namespace: {{ .Release.Namespace }} - annotations: {{ .Values.napcat.ingress.annotations }} + annotations: {{ .Values.napcat.ingress.annotations | default nil }} labels: app: {{ .Release.Name }}-maibot-napcat spec: diff --git a/helm-chart/templates/napcat-service.yaml b/helm-chart/templates/napcat-service.yaml index a3dc0c8d..245513d6 100644 --- a/helm-chart/templates/napcat-service.yaml +++ b/helm-chart/templates/napcat-service.yaml @@ -13,7 +13,7 @@ spec: protocol: TCP targetPort: 6099 {{- if eq .Values.napcat.service.type "nodePort" }} - nodePort: {{ .Values.napcat.service.nodePort }} + nodePort: {{ .Values.napcat.service.nodePort | default nil }} {{- end }} selector: app: {{ .Release.Name }}-maibot-napcat diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index 51be029f..7969d388 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -50,9 +50,9 @@ spec: - mountPath: /app/.config/QQ name: napcat subPath: data - imagePullSecrets: {{ .Values.napcat.image.pullSecrets }} - nodeSelector: {{ .Values.napcat.nodeSelector }} - tolerations: {{ .Values.napcat.tolerations }} + imagePullSecrets: {{ .Values.napcat.image.pullSecrets | default nil }} + nodeSelector: {{ .Values.napcat.nodeSelector | default nil }} + tolerations: {{ .Values.napcat.tolerations | default nil }} volumes: - name: napcat persistentVolumeClaim: diff --git a/helm-chart/templates/sqlite-web-ingress.yaml b/helm-chart/templates/sqlite-web-ingress.yaml index 967c9999..0bd6a3c4 100644 --- a/helm-chart/templates/sqlite-web-ingress.yaml +++ b/helm-chart/templates/sqlite-web-ingress.yaml @@ -4,7 +4,7 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-sqlite-web namespace: {{ .Release.Namespace }} - annotations: {{ .Values.sqlite_web.ingress.annotations }} + annotations: {{ .Values.sqlite_web.ingress.annotations | default nil }} labels: app: {{ .Release.Name }}-maibot-sqlite-web spec: diff --git a/helm-chart/templates/sqlite-web-service.yaml b/helm-chart/templates/sqlite-web-service.yaml index 4212a5a8..f07c8184 100644 --- a/helm-chart/templates/sqlite-web-service.yaml +++ b/helm-chart/templates/sqlite-web-service.yaml @@ -13,7 +13,7 @@ spec: protocol: TCP targetPort: 8080 {{- if eq .Values.sqlite_web.service.type "nodePort" }} - nodePort: {{ .Values.sqlite_web.service.nodePort }} + nodePort: {{ .Values.sqlite_web.service.nodePort | default nil }} {{- end }} selector: app: {{ .Release.Name }}-maibot-sqlite-web diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml index 121d11cf..f4bd762a 100644 --- a/helm-chart/templates/sqlite-web-statefulset.yaml +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -42,9 +42,9 @@ spec: volumeMounts: - mountPath: /data/MaiMBot name: data - imagePullSecrets: {{ .Values.sqlite_web.image.pullSecrets }} - nodeSelector: {{ .Values.sqlite_web.nodeSelector }} - tolerations: {{ .Values.sqlite_web.tolerations }} + imagePullSecrets: {{ .Values.sqlite_web.image.pullSecrets | default nil }} + nodeSelector: {{ .Values.sqlite_web.nodeSelector | default nil }} + tolerations: {{ .Values.sqlite_web.tolerations | default nil }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml index 808257b6..9fed86ab 100644 --- a/helm-chart/templates/statistics-deployment.yaml +++ b/helm-chart/templates/statistics-deployment.yaml @@ -39,9 +39,9 @@ spec: - mountPath: /usr/share/nginx/html name: statistics readOnly: true - imagePullSecrets: {{ .Values.statistics_dashboard.image.pullSecrets }} - nodeSelector: {{ .Values.statistics_dashboard.nodeSelector }} - tolerations: {{ .Values.core.tolerations }} + imagePullSecrets: {{ .Values.statistics_dashboard.image.pullSecrets | default nil }} + nodeSelector: {{ .Values.statistics_dashboard.nodeSelector | default nil }} + tolerations: {{ .Values.core.tolerations | default nil }} volumes: - name: statistics persistentVolumeClaim: diff --git a/helm-chart/templates/statistics-ingress.yaml b/helm-chart/templates/statistics-ingress.yaml index c7756647..67c8e037 100644 --- a/helm-chart/templates/statistics-ingress.yaml +++ b/helm-chart/templates/statistics-ingress.yaml @@ -4,7 +4,7 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-statistics-dashboard namespace: {{ .Release.Namespace }} - annotations: {{ .Values.statistics_dashboard.ingress.annotations }} + annotations: {{ .Values.statistics_dashboard.ingress.annotations | default nil }} labels: app: {{ .Release.Name }}-maibot-statistics-dashboard spec: diff --git a/helm-chart/templates/statistics-service.yaml b/helm-chart/templates/statistics-service.yaml index 86d0d628..811d3516 100644 --- a/helm-chart/templates/statistics-service.yaml +++ b/helm-chart/templates/statistics-service.yaml @@ -13,7 +13,7 @@ spec: protocol: TCP targetPort: 80 {{- if eq .Values.statistics_dashboard.service.type "nodePort" }} - nodePort: {{ .Values.statistics_dashboard.service.nodePort }} + nodePort: {{ .Values.statistics_dashboard.service.nodePort | default nil }} {{- end }} selector: app: {{ .Release.Name }}-maibot-statistics-dashboard From 59a6b8a623fcf4cf41019cbfc3997bca0060794c Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:02:05 +0800 Subject: [PATCH 036/142] =?UTF-8?q?=E5=8F=96=E6=B6=88python=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E7=BC=93=E5=86=B2=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index 2337f859..9b109f16 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -22,6 +22,8 @@ spec: args: - adapter-pip-installer.sh env: + - name: PYTHONUNBUFFERED + value: "1" - name: NAMESPACE valueFrom: fieldRef: From 9f34a25076867315f009d0d54beff0ef5b7b3f08 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:07:47 +0800 Subject: [PATCH 037/142] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=AE=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/adapter-cm-generator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helm-chart/files/adapter-cm-generator.py b/helm-chart/files/adapter-cm-generator.py index 8a3637b0..468d4226 100644 --- a/helm-chart/files/adapter-cm-generator.py +++ b/helm-chart/files/adapter-cm-generator.py @@ -19,8 +19,12 @@ data_b64 = os.getenv("DATA_B64") # 解析并覆盖关键配置 # 这里被覆盖的配置应当在helm chart中针对对应的k8s资源来灵活修改 data = toml.loads(base64.b64decode(data_b64).decode("utf-8")) +if data.get('napcat_server', None) is None: + data['napcat_server'] = {} data['napcat_server']['host'] = '0.0.0.0' data['napcat_server']['port'] = 8095 +if data.get('maibot_server', None) is None: + data['maibot_server'] = {} data['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release名称动态拼接core服务的DNS名称 data['maibot_server']['port'] = 8000 From 58930f63d232ea06e9d05b1052c1541e91c2a7b5 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:15:59 +0800 Subject: [PATCH 038/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E7=BB=9F=E8=AE=A1=E7=9C=8B=E6=9D=BF=E6=97=B6=E6=8C=82?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh index 944a6e1e..414b9889 100644 --- a/helm-chart/files/volume-linker.sh +++ b/helm-chart/files/volume-linker.sh @@ -24,7 +24,12 @@ if [ -f /MaiMBot/statistics/index.html ] then echo "[VolumeLinker] '/MaiMBot/statistics/index.html' exists." else - touch /MaiMBot/statistics/index.html + if [ -d /MaiMBot/statistics ] + then + touch /MaiMBot/statistics/index.html + else + echo "[VolumeLinker] Statistics volume disabled." + fi fi # 删除空的插件目录,准备创建软链接 From e28b9f9a4704fc87bd6cbeadf0d45d0ec05e7ee3 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:20:23 +0800 Subject: [PATCH 039/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-service.yaml | 2 +- helm-chart/templates/napcat-service.yaml | 2 +- helm-chart/templates/sqlite-web-service.yaml | 2 +- helm-chart/templates/statistics-service.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml index 4df2d31d..86c39246 100644 --- a/helm-chart/templates/adapter-service.yaml +++ b/helm-chart/templates/adapter-service.yaml @@ -11,7 +11,7 @@ spec: port: {{ .Values.adapter.service.port }} protocol: TCP targetPort: 8095 - {{- if eq .Values.adapter.service.type "nodePort" }} + {{- if eq .Values.adapter.service.type "NodePort" }} nodePort: {{ .Values.adapter.service.nodePort | default nil }} {{- end }} selector: diff --git a/helm-chart/templates/napcat-service.yaml b/helm-chart/templates/napcat-service.yaml index 245513d6..ec06b231 100644 --- a/helm-chart/templates/napcat-service.yaml +++ b/helm-chart/templates/napcat-service.yaml @@ -12,7 +12,7 @@ spec: port: {{ .Values.napcat.service.port }} protocol: TCP targetPort: 6099 - {{- if eq .Values.napcat.service.type "nodePort" }} + {{- if eq .Values.napcat.service.type "NodePort" }} nodePort: {{ .Values.napcat.service.nodePort | default nil }} {{- end }} selector: diff --git a/helm-chart/templates/sqlite-web-service.yaml b/helm-chart/templates/sqlite-web-service.yaml index f07c8184..9c9559a9 100644 --- a/helm-chart/templates/sqlite-web-service.yaml +++ b/helm-chart/templates/sqlite-web-service.yaml @@ -12,7 +12,7 @@ spec: port: {{ .Values.sqlite_web.service.port }} protocol: TCP targetPort: 8080 - {{- if eq .Values.sqlite_web.service.type "nodePort" }} + {{- if eq .Values.sqlite_web.service.type "NodePort" }} nodePort: {{ .Values.sqlite_web.service.nodePort | default nil }} {{- end }} selector: diff --git a/helm-chart/templates/statistics-service.yaml b/helm-chart/templates/statistics-service.yaml index 811d3516..c1750894 100644 --- a/helm-chart/templates/statistics-service.yaml +++ b/helm-chart/templates/statistics-service.yaml @@ -12,7 +12,7 @@ spec: port: {{ .Values.statistics_dashboard.service.port }} protocol: TCP targetPort: 80 - {{- if eq .Values.statistics_dashboard.service.type "nodePort" }} + {{- if eq .Values.statistics_dashboard.service.type "NodePort" }} nodePort: {{ .Values.statistics_dashboard.service.nodePort | default nil }} {{- end }} selector: From e63a024fb1dfeeb9cb6ec8f2e2369ab786194742 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:29:39 +0800 Subject: [PATCH 040/142] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E9=99=90=E5=88=B6=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/sqlite-web-statefulset.yaml | 2 +- helm-chart/templates/statistics-deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml index f4bd762a..80ef7c53 100644 --- a/helm-chart/templates/sqlite-web-statefulset.yaml +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -38,7 +38,7 @@ spec: - containerPort: 8080 name: webui protocol: TCP - resources: {{ .Values.sqlite_web.resources }} + resources: {{ .Values.sqlite_web.resources | default nil }} volumeMounts: - mountPath: /data/MaiMBot name: data diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml index 9fed86ab..95a3f4e5 100644 --- a/helm-chart/templates/statistics-deployment.yaml +++ b/helm-chart/templates/statistics-deployment.yaml @@ -34,7 +34,7 @@ spec: - containerPort: 80 name: dashboard protocol: TCP - resources: {{ .Values.statistics_dashboard.resources }} + resources: {{ .Values.statistics_dashboard.resources | default nil }} volumeMounts: - mountPath: /usr/share/nginx/html name: statistics From a4a63abe5c30575bead7d69cbecb2368e0d394ba Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:34:14 +0800 Subject: [PATCH 041/142] =?UTF-8?q?fix:=20PVC=E4=BA=8C=E6=AC=A1=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-pvc.yaml | 2 ++ helm-chart/templates/core-pvc.yaml | 2 ++ helm-chart/templates/napcat-pvc.yaml | 2 ++ helm-chart/templates/statistics-pvc.yaml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/helm-chart/templates/adapter-pvc.yaml b/helm-chart/templates/adapter-pvc.yaml index 288ca9b3..a424cdaf 100644 --- a/helm-chart/templates/adapter-pvc.yaml +++ b/helm-chart/templates/adapter-pvc.yaml @@ -8,4 +8,6 @@ spec: resources: requests: storage: {{ .Values.adapter.persistence.size }} + {{- if .Values.adapter.persistence.storageClass }} storageClassName: {{ .Values.adapter.persistence.storageClass | default nil }} + {{- end }} diff --git a/helm-chart/templates/core-pvc.yaml b/helm-chart/templates/core-pvc.yaml index 3c7508cd..38667d38 100644 --- a/helm-chart/templates/core-pvc.yaml +++ b/helm-chart/templates/core-pvc.yaml @@ -8,4 +8,6 @@ spec: resources: requests: storage: {{ .Values.core.persistence.size }} + {{- if .Values.adapter.persistence.storageClass }} storageClassName: {{ .Values.core.persistence.storageClass | default nil }} + {{- end }} diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat-pvc.yaml index b1a008b3..f2fdec4e 100644 --- a/helm-chart/templates/napcat-pvc.yaml +++ b/helm-chart/templates/napcat-pvc.yaml @@ -9,5 +9,7 @@ spec: resources: requests: storage: {{ .Values.napcat.persistence.size }} + {{- if .Values.adapter.persistence.storageClass }} storageClassName: {{ .Values.napcat.persistence.storageClass | default nil }} + {{- end }} {{- end }} diff --git a/helm-chart/templates/statistics-pvc.yaml b/helm-chart/templates/statistics-pvc.yaml index 783614ab..f1a25a5f 100644 --- a/helm-chart/templates/statistics-pvc.yaml +++ b/helm-chart/templates/statistics-pvc.yaml @@ -9,5 +9,7 @@ spec: resources: requests: storage: {{ .Values.statistics_dashboard.persistence.size }} + {{- if .Values.adapter.persistence.storageClass }} storageClassName: {{ .Values.statistics_dashboard.persistence.storageClass | default nil }} + {{- end }} {{- end }} From 9d3404f9323147f2884299b589f5e249740487ff Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:37:44 +0800 Subject: [PATCH 042/142] =?UTF-8?q?fix:=20PVC=E5=90=8D=E7=A7=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 56f73581..29016726 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -85,5 +85,5 @@ spec: {{- if .Values.statistics_dashboard.enabled }} - name: statistics persistentVolumeClaim: - claimName: {{ .Release.Name }}-maibot-statistics + claimName: {{ .Release.Name }}-maibot-statistics-dashboard {{- end }} From 8f158f8a59b010cfbae275bbb82ec2352d8ca341 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 03:39:49 +0800 Subject: [PATCH 043/142] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E5=90=8C=E6=AD=A5=E7=94=9F=E6=88=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index 9b109f16..b6372c22 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -5,7 +5,7 @@ metadata: name: {{ .Release.Name }}-maibot-adapter-cm-generator namespace: {{ .Release.Namespace }} annotations: - "helm.sh/hook": post-install + "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: backoffLimit: 0 From f933b045b8632a38d437a0b2ed3e5b57fb151a19 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 04:00:13 +0800 Subject: [PATCH 044/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3values?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-statefulset.yaml | 20 +++++++++++++++---- helm-chart/templates/core-statefulset.yaml | 20 +++++++++++++++---- helm-chart/templates/napcat-ingress.yaml | 5 ++++- helm-chart/templates/napcat-statefulset.yaml | 20 +++++++++++++++---- helm-chart/templates/sqlite-web-ingress.yaml | 5 ++++- .../templates/sqlite-web-statefulset.yaml | 20 +++++++++++++++---- .../templates/statistics-deployment.yaml | 20 +++++++++++++++---- helm-chart/templates/statistics-ingress.yaml | 5 ++++- 8 files changed, 92 insertions(+), 23 deletions(-) diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index 998819ae..19c7bdac 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -27,7 +27,10 @@ spec: - containerPort: 8095 name: napcat-ws protocol: TCP - resources: {{ .Values.adapter.resources | default nil }} + {{- if .Values.adapter.resources }} + resources: + {{ toYaml .Values.adapter.resources | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /adapters/data name: data @@ -35,9 +38,18 @@ spec: name: config readOnly: true subPath: config.toml - imagePullSecrets: {{ .Values.adapter.image.pullSecrets | default nil }} - nodeSelector: {{ .Values.adapter.nodeSelector | default nil }} - tolerations: {{ .Values.adapter.tolerations | default nil }} + {{- if .Values.adapter.image.pullSecrets }} + imagePullSecrets: + {{ toYaml .Values.adapter.image.pullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.adapter.nodeSelector }} + nodeSelector: + {{ toYaml .Values.adapter.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.adapter.tolerations }} + tolerations: + {{ toYaml .Values.adapter.tolerations | nindent 8 }} + {{- end }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 29016726..9b360c68 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -35,7 +35,10 @@ spec: - containerPort: 8000 name: adapter-ws protocol: TCP - resources: {{ .Values.core.resources | default nil }} + {{- if .Values.core.resources }} + resources: + {{ toYaml .Values.core.resources | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /MaiMBot/data name: data @@ -59,9 +62,18 @@ spec: - mountPath: /MaiMBot/statistics name: statistics {{- end }} - imagePullSecrets: {{ .Values.core.image.pullSecrets | default nil }} - nodeSelector: {{ .Values.core.nodeSelector | default nil }} - tolerations: {{ .Values.core.tolerations | default nil }} + {{- if .Values.core.image.pullSecrets }} + imagePullSecrets: + {{ toYaml .Values.core.image.pullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.core.nodeSelector }} + nodeSelector: + {{ toYaml .Values.core.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.core.tolerations }} + tolerations: + {{ toYaml .Values.core.tolerations | nindent 8 }} + {{- end }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat-ingress.yaml index 2343ca9c..e46243a2 100644 --- a/helm-chart/templates/napcat-ingress.yaml +++ b/helm-chart/templates/napcat-ingress.yaml @@ -4,7 +4,10 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-napcat namespace: {{ .Release.Namespace }} - annotations: {{ .Values.napcat.ingress.annotations | default nil }} + {{- if .Values.napcat.ingress.annotations }} + annotations: + {{ toYaml .Values.napcat.ingress.annotations | nindent 4 }} + {{- end }} labels: app: {{ .Release.Name }}-maibot-napcat spec: diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index 7969d388..138845f5 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -42,7 +42,10 @@ spec: - containerPort: 6099 name: webui protocol: TCP - resources: {{ .Values.napcat.resources | default nil }} + {{- if .Values.napcat.resources }} + resources: + {{ toYaml .Values.napcat.resources | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /app/napcat/config name: napcat @@ -50,9 +53,18 @@ spec: - mountPath: /app/.config/QQ name: napcat subPath: data - imagePullSecrets: {{ .Values.napcat.image.pullSecrets | default nil }} - nodeSelector: {{ .Values.napcat.nodeSelector | default nil }} - tolerations: {{ .Values.napcat.tolerations | default nil }} + {{- if .Values.napcat.image.pullSecrets }} + imagePullSecrets: + {{ toYaml .Values.napcat.image.pullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.napcat.nodeSelector }} + nodeSelector: + {{ toYaml .Values.napcat.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.napcat.tolerations }} + tolerations: + {{ toYaml .Values.napcat.tolerations | nindent 8 }} + {{- end }} volumes: - name: napcat persistentVolumeClaim: diff --git a/helm-chart/templates/sqlite-web-ingress.yaml b/helm-chart/templates/sqlite-web-ingress.yaml index 0bd6a3c4..fe14e744 100644 --- a/helm-chart/templates/sqlite-web-ingress.yaml +++ b/helm-chart/templates/sqlite-web-ingress.yaml @@ -4,7 +4,10 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-sqlite-web namespace: {{ .Release.Namespace }} - annotations: {{ .Values.sqlite_web.ingress.annotations | default nil }} + {{- if .Values.sqlite_web.ingress.annotations }} + annotations: + {{ toYaml .Values.sqlite_web.ingress.annotations | nindent 4 }} + {{- end }} labels: app: {{ .Release.Name }}-maibot-sqlite-web spec: diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml index 80ef7c53..b2c9cc47 100644 --- a/helm-chart/templates/sqlite-web-statefulset.yaml +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -38,13 +38,25 @@ spec: - containerPort: 8080 name: webui protocol: TCP - resources: {{ .Values.sqlite_web.resources | default nil }} + {{- if .Values.sqlite_web.resources }} + resources: + {{ toYaml .Values.sqlite_web.resources | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /data/MaiMBot name: data - imagePullSecrets: {{ .Values.sqlite_web.image.pullSecrets | default nil }} - nodeSelector: {{ .Values.sqlite_web.nodeSelector | default nil }} - tolerations: {{ .Values.sqlite_web.tolerations | default nil }} + {{- if .Values.sqlite_web.image.pullSecrets }} + imagePullSecrets: + {{ toYaml .Values.sqlite_web.image.pullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.sqlite_web.nodeSelector }} + nodeSelector: + {{ toYaml .Values.sqlite_web.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.sqlite_web.tolerations }} + tolerations: + {{ toYaml .Values.sqlite_web.tolerations | nindent 8 }} + {{- end }} volumes: - name: data persistentVolumeClaim: diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml index 95a3f4e5..94e7e2c7 100644 --- a/helm-chart/templates/statistics-deployment.yaml +++ b/helm-chart/templates/statistics-deployment.yaml @@ -34,14 +34,26 @@ spec: - containerPort: 80 name: dashboard protocol: TCP - resources: {{ .Values.statistics_dashboard.resources | default nil }} + {{- if .Values.statistics_dashboard.resources }} + resources: + {{ toYaml .Values.statistics_dashboard.resources | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /usr/share/nginx/html name: statistics readOnly: true - imagePullSecrets: {{ .Values.statistics_dashboard.image.pullSecrets | default nil }} - nodeSelector: {{ .Values.statistics_dashboard.nodeSelector | default nil }} - tolerations: {{ .Values.core.tolerations | default nil }} + {{- if .Values.statistics_dashboard.image.pullSecrets }} + imagePullSecrets: + {{ toYaml .Values.statistics_dashboard.image.pullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.statistics_dashboard.nodeSelector }} + nodeSelector: + {{ toYaml .Values.statistics_dashboard.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.statistics_dashboard.tolerations }} + tolerations: + {{ toYaml .Values.statistics_dashboard.tolerations | nindent 8 }} + {{- end }} volumes: - name: statistics persistentVolumeClaim: diff --git a/helm-chart/templates/statistics-ingress.yaml b/helm-chart/templates/statistics-ingress.yaml index 67c8e037..70c18353 100644 --- a/helm-chart/templates/statistics-ingress.yaml +++ b/helm-chart/templates/statistics-ingress.yaml @@ -4,7 +4,10 @@ kind: Ingress metadata: name: {{ .Release.Name }}-maibot-statistics-dashboard namespace: {{ .Release.Namespace }} - annotations: {{ .Values.statistics_dashboard.ingress.annotations | default nil }} + {{- if .Values.statistics_dashboard.ingress.annotations }} + annotations: + {{ toYaml .Values.statistics_dashboard.ingress.annotations | nindent 4 }} + {{- end }} labels: app: {{ .Release.Name }}-maibot-statistics-dashboard spec: From e2c3a2683a66973db2c43bacfb3f80435afacedc Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 04:37:02 +0800 Subject: [PATCH 045/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3values?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-pvc.yaml | 5 ++++- helm-chart/templates/core-pvc.yaml | 5 ++++- helm-chart/templates/napcat-pvc.yaml | 5 ++++- helm-chart/templates/statistics-pvc.yaml | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/helm-chart/templates/adapter-pvc.yaml b/helm-chart/templates/adapter-pvc.yaml index a424cdaf..61778630 100644 --- a/helm-chart/templates/adapter-pvc.yaml +++ b/helm-chart/templates/adapter-pvc.yaml @@ -4,7 +4,10 @@ metadata: name: {{ .Release.Name }}-maibot-adapter namespace: {{ .Release.Namespace }} spec: - accessModes: {{ .Values.adapter.persistence.accessModes }} + {{- if .Values.adapter.persistence.accessModes }} + accessModes: + {{ toYaml .Values.adapter.persistence.accessModes | nindent 4 }} + {{- end }} resources: requests: storage: {{ .Values.adapter.persistence.size }} diff --git a/helm-chart/templates/core-pvc.yaml b/helm-chart/templates/core-pvc.yaml index 38667d38..cf2a1146 100644 --- a/helm-chart/templates/core-pvc.yaml +++ b/helm-chart/templates/core-pvc.yaml @@ -4,7 +4,10 @@ metadata: name: {{ .Release.Name }}-maibot-core namespace: {{ .Release.Namespace }} spec: - accessModes: {{ .Values.core.persistence.accessModes }} + {{- if .Values.core.persistence.accessModes }} + accessModes: + {{ toYaml .Values.core.persistence.accessModes | nindent 4 }} + {{- end }} resources: requests: storage: {{ .Values.core.persistence.size }} diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat-pvc.yaml index f2fdec4e..7a5bd9b9 100644 --- a/helm-chart/templates/napcat-pvc.yaml +++ b/helm-chart/templates/napcat-pvc.yaml @@ -5,7 +5,10 @@ metadata: name: {{ .Release.Name }}-maibot-napcat namespace: {{ .Release.Namespace }} spec: - accessModes: {{ .Values.napcat.persistence.accessModes }} + {{- if .Values.napcat.persistence.accessModes }} + accessModes: + {{ toYaml .Values.napcat.persistence.accessModes | nindent 4 }} + {{- end }} resources: requests: storage: {{ .Values.napcat.persistence.size }} diff --git a/helm-chart/templates/statistics-pvc.yaml b/helm-chart/templates/statistics-pvc.yaml index f1a25a5f..9e5a86fd 100644 --- a/helm-chart/templates/statistics-pvc.yaml +++ b/helm-chart/templates/statistics-pvc.yaml @@ -5,7 +5,10 @@ metadata: name: {{ .Release.Name }}-maibot-statistics-dashboard namespace: {{ .Release.Namespace }} spec: - accessModes: {{ .Values.statistics_dashboard.persistence.accessModes }} + {{- if .Values.statistics_dashboard.persistence.accessModes }} + accessModes: + {{ toYaml .Values.statistics_dashboard.persistence.accessModes | nindent 4 }} + {{- end }} resources: requests: storage: {{ .Values.statistics_dashboard.persistence.size }} From 7084f403777895b7cd55a3b2a1350b979cfd6fc4 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 12:16:47 +0800 Subject: [PATCH 046/142] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Helm=20Chart=E7=9A=84?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 helm-chart/README.md diff --git a/helm-chart/README.md b/helm-chart/README.md new file mode 100644 index 00000000..cc2898ac --- /dev/null +++ b/helm-chart/README.md @@ -0,0 +1,78 @@ +# MaiBot Helm Chart + +这是麦麦的Helm Chart,可以方便地将麦麦部署在Kubernetes集群中。 + +当前Helm Chart对应的麦麦版本可以在`Chart.yaml`中查看`appVersion`项。 + +## Values项说明 + +`values.yaml`分为几个大部分。 + +1. EULA & PRIVACY: 用户必须同意这里的协议才能成功部署麦麦。 + +2. `adapter`: 麦麦的Adapter的部署配置。 + +3. `core`: 麦麦本体的部署配置。 + +4. `statistics_dashboard`: 麦麦的运行统计看板部署配置。 + + 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以部署为看板。 + + 出于隐私考虑,默认禁用。 + +5. `napcat`: Napcat的部署配置。 + + 考虑到复用外部Napcat实例的情况,Napcat部署已被解耦。用户可选是否要部署Napcat。 + + 默认会捆绑部署Napcat。 + +6. `sqlite_web`: sqlite-web的部署配置。 + + 通过sqlite-web可以在网页上操作麦麦的数据库,方便调试。不部署对麦麦的运行无影响。 + + 此服务如果暴露在公网会十分危险,默认不会部署。 + +7. `config`: 这里填写麦麦各部分组件的运行配置文件。 + + 这里填写的配置文件需要严格遵守yaml文件的缩进格式。 + + - `adapter_config`: 对应adapter的`config.toml`。 + + 此配置文件中对于`host`和`port`的配置会被上面`adapter.service`中的配置覆盖,因此不需要改动。 + + - `core_model_config`: 对应core的`model_config.toml`。 + + - `core_bot_config`: 对应core的`bot_config.toml`。 + +## 部署说明 + +使用此Helm Chart的一些注意事项。 + +### 修改麦麦配置 + +麦麦的配置文件会通过ConfigMap资源注入各个组件内。 + +对于通过Helm Chart部署的麦麦,如果需要修改配置,不应该直接修改这些ConfigMap,否则下次Helm更新可能会覆盖掉所有配置。 + +最佳实践是重新配置Helm Chart的values,然后通过`helm upgrade`更新实例。 + +### 动态生成的ConfigMap + +adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 + +动态生成的原因: + +- core服务的DNS名称是动态的,无法在adapter服务的配置文件中提前确定。 +- 一些与k8s现有资源冲突的配置需要被重置。 + +因此,首次部署时,ConfigMap的生成会需要一些时间,部分Pod会无法启动,等待几分钟即可。 + +### 运行统计看板与core的挂载冲突 + +如果启用了运行统计看板,那么statistics_dashboard会与core共同挂载statistics_dashboard存储卷,用于同步html文件。 + +如果k8s集群有多个节点,且statistics_dashboard与core未调度到同一节点,那么就需要statistics_dashboard的PVC访问模式具备`ReadWriteMany`访问模式。 + +不是所有存储卷的底层存储都支持`ReadWriteMany`访问模式。 + +如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 From bc7e04f6e3787391992ba9bd3aa99b932e77e24b Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 12:23:34 +0800 Subject: [PATCH 047/142] =?UTF-8?q?core=E9=95=9C=E5=83=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 0acdfb35..37294391 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -39,7 +39,7 @@ core: image: repository: sengokucola/maibot - tag: main-d919c34 + tag: main-a8ff08e pullPolicy: IfNotPresent pullSecrets: [ ] From 2f2fe3cbab01e2d53911b18ba143b6a9b4c61943 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 12:41:55 +0800 Subject: [PATCH 048/142] =?UTF-8?q?fix:=20=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E5=80=BC=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core-pvc.yaml | 2 +- helm-chart/templates/napcat-pvc.yaml | 2 +- helm-chart/templates/statistics-pvc.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/templates/core-pvc.yaml b/helm-chart/templates/core-pvc.yaml index cf2a1146..e7fe15c7 100644 --- a/helm-chart/templates/core-pvc.yaml +++ b/helm-chart/templates/core-pvc.yaml @@ -11,6 +11,6 @@ spec: resources: requests: storage: {{ .Values.core.persistence.size }} - {{- if .Values.adapter.persistence.storageClass }} + {{- if .Values.core.persistence.storageClass }} storageClassName: {{ .Values.core.persistence.storageClass | default nil }} {{- end }} diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat-pvc.yaml index 7a5bd9b9..530eca72 100644 --- a/helm-chart/templates/napcat-pvc.yaml +++ b/helm-chart/templates/napcat-pvc.yaml @@ -12,7 +12,7 @@ spec: resources: requests: storage: {{ .Values.napcat.persistence.size }} - {{- if .Values.adapter.persistence.storageClass }} + {{- if .Values.napcat.persistence.storageClass }} storageClassName: {{ .Values.napcat.persistence.storageClass | default nil }} {{- end }} {{- end }} diff --git a/helm-chart/templates/statistics-pvc.yaml b/helm-chart/templates/statistics-pvc.yaml index 9e5a86fd..74b698ce 100644 --- a/helm-chart/templates/statistics-pvc.yaml +++ b/helm-chart/templates/statistics-pvc.yaml @@ -12,7 +12,7 @@ spec: resources: requests: storage: {{ .Values.statistics_dashboard.persistence.size }} - {{- if .Values.adapter.persistence.storageClass }} + {{- if .Values.statistics_dashboard.persistence.storageClass }} storageClassName: {{ .Values.statistics_dashboard.persistence.storageClass | default nil }} {{- end }} {{- end }} From f5162564df39fcbf3a83c42003c0a185135e62af Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 12:42:12 +0800 Subject: [PATCH 049/142] =?UTF-8?q?=E4=BC=98=E5=8C=96shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh index 414b9889..86882968 100644 --- a/helm-chart/files/volume-linker.sh +++ b/helm-chart/files/volume-linker.sh @@ -8,28 +8,13 @@ set -e echo "[VolumeLinker]Preparing volume..." # 初次启动,在存储卷中检查并创建关键文件和目录 -if [ -d /MaiMBot/data/plugins ] +mkdir -p /MaiMBot/data/plugins +mkdir -p /MaiMBot/data/logs +if [ ! -d "/MaiMBot/statistics" ] then - echo "[VolumeLinker] '/MaiMBot/data/plugins' exists." + echo "[VolumeLinker] Statistics volume disabled." else - mkdir /MaiMBot/data/plugins -fi -if [ -d /MaiMBot/data/logs ] -then - echo "[VolumeLinker] '/MaiMBot/data/logs' exists." -else - mkdir /MaiMBot/data/logs -fi -if [ -f /MaiMBot/statistics/index.html ] -then - echo "[VolumeLinker] '/MaiMBot/statistics/index.html' exists." -else - if [ -d /MaiMBot/statistics ] - then - touch /MaiMBot/statistics/index.html - else - echo "[VolumeLinker] Statistics volume disabled." - fi + touch /MaiMBot/statistics/index.html fi # 删除空的插件目录,准备创建软链接 From a58919d906fa3f08671d37592c08ea097bf51554 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 12:51:43 +0800 Subject: [PATCH 050/142] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E7=9C=8B=E6=9D=BF=E9=80=A0=E6=88=90=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh index 86882968..bd897537 100644 --- a/helm-chart/files/volume-linker.sh +++ b/helm-chart/files/volume-linker.sh @@ -23,7 +23,10 @@ rm -rf /MaiMBot/plugins # 创建软链接,从存储卷链接到实际位置 ln -s /MaiMBot/data/plugins /MaiMBot/plugins ln -s /MaiMBot/data/logs /MaiMBot/logs -ln -s /MaiMBot/statistics/index.html /MaiMBot/maibot_statistics.html +if [ -f "/MaiMBot/statistics/index.html" ] +then + ln -s /MaiMBot/statistics/index.html /MaiMBot/maibot_statistics.html +fi # 启动麦麦 echo "[VolumeLinker]Starting MaiBot..." From c8890ea8e4122c5f593df8d89f90399e1fbccf26 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 12:00:22 +0800 Subject: [PATCH 051/142] =?UTF-8?q?=E6=9E=84=E5=BB=BAadapter-cm-generator?= =?UTF-8?q?=E7=9A=84=E9=95=9C=E5=83=8F=EF=BC=8C=E6=8F=90=E5=8D=87=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.helmignore | 1 + helm-chart/adapter-cm-generator/Dockerfile | 10 +++++++ .../adapter-cm-generator.py | 0 .../adapter-cm-generator/requirements.txt | 2 ++ helm-chart/files/adapter-pip-installer.sh | 5 ---- .../templates/pre-adapter-cm-gen-job.yaml | 26 ++----------------- helm-chart/templates/scripts-configmap.yaml | 6 ----- helm-chart/values.yaml | 9 +++++++ 8 files changed, 24 insertions(+), 35 deletions(-) create mode 100644 helm-chart/.helmignore create mode 100644 helm-chart/adapter-cm-generator/Dockerfile rename helm-chart/{files => adapter-cm-generator}/adapter-cm-generator.py (100%) create mode 100644 helm-chart/adapter-cm-generator/requirements.txt delete mode 100644 helm-chart/files/adapter-pip-installer.sh diff --git a/helm-chart/.helmignore b/helm-chart/.helmignore new file mode 100644 index 00000000..015ae876 --- /dev/null +++ b/helm-chart/.helmignore @@ -0,0 +1 @@ +adapter-cm-generator \ No newline at end of file diff --git a/helm-chart/adapter-cm-generator/Dockerfile b/helm-chart/adapter-cm-generator/Dockerfile new file mode 100644 index 00000000..7c6c802f --- /dev/null +++ b/helm-chart/adapter-cm-generator/Dockerfile @@ -0,0 +1,10 @@ +# 此镜像用于在部署helm chart时动态生成adapter的配置文件 +FROM python:slim + +WORKDIR /app + +COPY . /app + +RUN pip3 install --no-cache-dir -i https://mirrors.ustc.edu.cn/pypi/simple -r requirements.txt + +ENTRYPOINT ["python3", "adapter-cm-generator.py"] diff --git a/helm-chart/files/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py similarity index 100% rename from helm-chart/files/adapter-cm-generator.py rename to helm-chart/adapter-cm-generator/adapter-cm-generator.py diff --git a/helm-chart/adapter-cm-generator/requirements.txt b/helm-chart/adapter-cm-generator/requirements.txt new file mode 100644 index 00000000..50e16366 --- /dev/null +++ b/helm-chart/adapter-cm-generator/requirements.txt @@ -0,0 +1,2 @@ +toml +kubernetes \ No newline at end of file diff --git a/helm-chart/files/adapter-pip-installer.sh b/helm-chart/files/adapter-pip-installer.sh deleted file mode 100644 index 47564820..00000000 --- a/helm-chart/files/adapter-pip-installer.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# 这个脚本的作用是安装必要的python包,为adapter-cm-generator.py脚本做准备 - -pip3 install -i https://mirrors.ustc.edu.cn/pypi/simple kubernetes toml -python3 adapter-cm-generator.py diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index b6372c22..14bc6154 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -14,13 +14,9 @@ spec: serviceAccountName: {{ .Release.Name }}-maibot-adapter-cm-generator restartPolicy: Never containers: - - name: python - image: python:slim + - name: adapter-cm-generator + image: {{ .Values.adapter.cm_generator.image.repository }}:{{ .Values.adapter.cm_generator.image.tag }} workingDir: /app - command: - - sh - args: - - adapter-pip-installer.sh env: - name: PYTHONUNBUFFERED value: "1" @@ -32,21 +28,3 @@ spec: value: {{ .Release.Name }} - name: DATA_B64 value: {{ .Values.config.adapter_config | b64enc }} # 将配置文件编码为base64,从环境变量注入 - volumeMounts: - - mountPath: /app/adapter-pip-installer.sh - name: scripts - readOnly: true - subPath: adapter-pip-installer.sh - - mountPath: /app/adapter-cm-generator.py - name: scripts - readOnly: true - subPath: adapter-cm-generator.py - volumes: - - name: scripts - configMap: - name: {{ .Release.Name }}-maibot-scripts - items: - - key: adapter-pip-installer.sh - path: adapter-pip-installer.sh - - key: adapter-cm-generator.py - path: adapter-cm-generator.py diff --git a/helm-chart/templates/scripts-configmap.yaml b/helm-chart/templates/scripts-configmap.yaml index 6eb0c4db..aa6fa11f 100644 --- a/helm-chart/templates/scripts-configmap.yaml +++ b/helm-chart/templates/scripts-configmap.yaml @@ -4,12 +4,6 @@ metadata: name: {{ .Release.Name }}-maibot-scripts namespace: {{ .Release.Namespace }} data: - # pre-install hook - adapter-pip-installer.sh: | - {{ .Files.Get "files/adapter-pip-installer.sh" | nindent 4 }} - adapter-cm-generator.py: | - {{ .Files.Get "files/adapter-cm-generator.py" | nindent 4 }} - # core volume-linker.sh: | {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 37294391..5f127089 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -34,6 +34,15 @@ adapter: - ReadWriteOnce size: 1Gi + # adapter的动态生成configmap的Job的配置 + cm_generator: + image: + repository: reg.mikumikumi.xyz/maibot/adapter-cm-generator + tag: 0.10.0-alpha.0 + pullPolicy: IfNotPresent + pullSecrets: [ ] + + # 麦麦本体的部署配置 core: From be189707715ef0dfc6e9d6e632311a976276af76 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 13:13:12 +0800 Subject: [PATCH 052/142] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96Helm=20Chart?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=92=8C=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++ helm-chart/.helmignore | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 helm-chart/.gitlab-ci.yml diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml new file mode 100644 index 00000000..fec489e9 --- /dev/null +++ b/helm-chart/.gitlab-ci.yml @@ -0,0 +1,36 @@ +stages: + - build + - package + +# 将Helm Chart版本作为tag,构建并推送镜像 +build-adapter-cm-generator: + stage: build + image: reg.mikumikumi.xyz/base/kaniko-builder:latest + rules: + - changes: + - helm-chart/files/** + - helm-chart/templates/** + - helm-chart/Chart.yaml + - helm-chart/values.yaml + variables: + BUILD_CONTEXT: helm-chart/adapter-cm-generator + BUILD_DESTINATION: reg.mikumikumi.xyz/maibot/adapter-cm-generator + script: + - export BUILD_CONTEXT=helm-chart/adapter-cm-generator + - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - export BUILD_ARGS="--destination ${TMP_DST}:${CHART_VERSION} --destination ${TMP_DST}:latest" + - build + +# 打包并推送helm chart +package-helm-chart: + stage: package + image: reg.mikumikumi.xyz/mirror/helm:latest + rules: + - changes: + - helm-chart/adapter-cm-generator/** + script: + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - helm registry login reg.mikumikumi.xyz --username ${HARBOR_USERNAME} --password ${HARBOR_PASSWORD} + - helm package helm-chart + - helm push maibot-${CHART_VERSION}.tgz oci://reg.mikumikumi.xyz/maibot diff --git a/helm-chart/.helmignore b/helm-chart/.helmignore index 015ae876..8cb2bba7 100644 --- a/helm-chart/.helmignore +++ b/helm-chart/.helmignore @@ -1 +1,2 @@ -adapter-cm-generator \ No newline at end of file +adapter-cm-generator +.gitlab-ci.yml \ No newline at end of file From bce8a82f2a28ed09745b65bebe03fa9508d44d92 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 13:15:01 +0800 Subject: [PATCH 053/142] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A9=BA=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E7=AC=A6=E5=90=88POSIX=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index aaa8a215..9c908f64 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -3,4 +3,4 @@ name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application version: 0.10.0-alpha.0 -appVersion: 0.10.0-alpha \ No newline at end of file +appVersion: 0.10.0-alpha From 11113512103abe06428691002b2dc967adf785e3 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 14:25:24 +0800 Subject: [PATCH 054/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9CI=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index fec489e9..e63c14fb 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -31,6 +31,6 @@ package-helm-chart: - helm-chart/adapter-cm-generator/** script: - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) - - helm registry login reg.mikumikumi.xyz --username ${HARBOR_USERNAME} --password ${HARBOR_PASSWORD} + - helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD} - helm package helm-chart - helm push maibot-${CHART_VERSION}.tgz oci://reg.mikumikumi.xyz/maibot From bc513dc88c3942c4140bc2b4f279aec1501e26f4 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 15:33:59 +0800 Subject: [PATCH 055/142] =?UTF-8?q?fix:=20CI=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index e63c14fb..346f9250 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -8,10 +8,7 @@ build-adapter-cm-generator: image: reg.mikumikumi.xyz/base/kaniko-builder:latest rules: - changes: - - helm-chart/files/** - - helm-chart/templates/** - - helm-chart/Chart.yaml - - helm-chart/values.yaml + - helm-chart/adapter-cm-generator/** variables: BUILD_CONTEXT: helm-chart/adapter-cm-generator BUILD_DESTINATION: reg.mikumikumi.xyz/maibot/adapter-cm-generator @@ -28,7 +25,10 @@ package-helm-chart: image: reg.mikumikumi.xyz/mirror/helm:latest rules: - changes: - - helm-chart/adapter-cm-generator/** + - helm-chart/files/** + - helm-chart/templates/** + - helm-chart/Chart.yaml + - helm-chart/values.yaml script: - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) - helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD} From a065da1613170159ed5758cd3584703b28d56839 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 15:38:36 +0800 Subject: [PATCH 056/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9job=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E4=B8=BA2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index 14bc6154..f9a6efdc 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -8,7 +8,7 @@ metadata: "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: - backoffLimit: 0 + backoffLimit: 2 template: spec: serviceAccountName: {{ .Release.Name }}-maibot-adapter-cm-generator From cb188f62e158aebfe909453306f79a7350446eb1 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 15:42:08 +0800 Subject: [PATCH 057/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9CI=E4=B8=AD=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E8=BF=87=E6=BB=A4=E6=AD=A7?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 346f9250..5a5a2f73 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -9,13 +9,10 @@ build-adapter-cm-generator: rules: - changes: - helm-chart/adapter-cm-generator/** - variables: - BUILD_CONTEXT: helm-chart/adapter-cm-generator - BUILD_DESTINATION: reg.mikumikumi.xyz/maibot/adapter-cm-generator script: - export BUILD_CONTEXT=helm-chart/adapter-cm-generator - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator - - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - export BUILD_ARGS="--destination ${TMP_DST}:${CHART_VERSION} --destination ${TMP_DST}:latest" - build @@ -30,7 +27,7 @@ package-helm-chart: - helm-chart/Chart.yaml - helm-chart/values.yaml script: - - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep version | cut -d' ' -f2) + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD} - helm package helm-chart - helm push maibot-${CHART_VERSION}.tgz oci://reg.mikumikumi.xyz/maibot From 4efebed10aad977155d3d9e0c24bc6e14e1260ab Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 21 Aug 2025 15:44:36 +0800 Subject: [PATCH 058/142] =?UTF-8?q?=E4=BC=98=E5=8C=96Python=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/adapter-cm-generator.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py index 468d4226..d2370daf 100644 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ b/helm-chart/adapter-cm-generator/adapter-cm-generator.py @@ -19,12 +19,10 @@ data_b64 = os.getenv("DATA_B64") # 解析并覆盖关键配置 # 这里被覆盖的配置应当在helm chart中针对对应的k8s资源来灵活修改 data = toml.loads(base64.b64decode(data_b64).decode("utf-8")) -if data.get('napcat_server', None) is None: - data['napcat_server'] = {} +data.setdefault('napcat_server', {}) data['napcat_server']['host'] = '0.0.0.0' data['napcat_server']['port'] = 8095 -if data.get('maibot_server', None) is None: - data['maibot_server'] = {} +data.setdefault('maibot_server', {}) data['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release名称动态拼接core服务的DNS名称 data['maibot_server']['port'] = 8000 From 361a91ebf155d2a6bf600c4941b8ec0b83342a18 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 22 Sep 2025 23:52:59 +0800 Subject: [PATCH 059/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA0.10.3-beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 9c908f64..89a60f34 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.10.0-alpha.0 -appVersion: 0.10.0-alpha +version: 0.10.3-beta +appVersion: 0.10.3-beta From 6bc31e0c04d0fd74172ad971e6bcc2e0343475a4 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 22 Sep 2025 23:54:10 +0800 Subject: [PATCH 060/142] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=95=9C=E5=83=8Ftag?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E5=B0=86=E9=95=9C=E5=83=8Ftag=E4=BB=8Evalues?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E8=A7=A3=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-statefulset.yaml | 2 +- helm-chart/templates/core-statefulset.yaml | 2 +- helm-chart/templates/napcat-statefulset.yaml | 2 +- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 +- helm-chart/templates/sqlite-web-statefulset.yaml | 2 +- helm-chart/templates/statistics-deployment.yaml | 2 +- helm-chart/values.yaml | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index 19c7bdac..bd6f7b2f 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -21,7 +21,7 @@ spec: env: - name: TZ value: Asia/Shanghai - image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag }} + image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag | default "main-20250922131146" }} imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} ports: - containerPort: 8095 diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 9b360c68..84ac6721 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag }} + image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "main-0e0179f" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index 138845f5..4b7830a0 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag }} + image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag | default "v4.8.116" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index f9a6efdc..c87d1b61 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository }}:{{ .Values.adapter.cm_generator.image.tag }} + image: {{ .Values.adapter.cm_generator.image.repository }}:{{ .Values.adapter.cm_generator.image.tag | default "0.10.3-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml index b2c9cc47..4b8e0fad 100644 --- a/helm-chart/templates/sqlite-web-statefulset.yaml +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -22,7 +22,7 @@ spec: env: - name: SQLITE_DATABASE value: /data/MaiMBot/MaiBot.db - image: {{ .Values.sqlite_web.image.repository }}:{{ .Values.sqlite_web.image.tag }} + image: {{ .Values.sqlite_web.image.repository }}:{{ .Values.sqlite_web.image.tag | default "latest" }} imagePullPolicy: {{ .Values.sqlite_web.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml index 94e7e2c7..4a902e5b 100644 --- a/helm-chart/templates/statistics-deployment.yaml +++ b/helm-chart/templates/statistics-deployment.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: nginx - image: {{ .Values.statistics_dashboard.image.repository }}:{{ .Values.statistics_dashboard.image.tag }} + image: {{ .Values.statistics_dashboard.image.repository }}:{{ .Values.statistics_dashboard.image.tag | default "latest" }} imagePullPolicy: {{ .Values.statistics_dashboard.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 5f127089..463c6f02 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -10,7 +10,7 @@ adapter: image: repository: unclas/maimbot-adapter - tag: main-20250807151247 + tag: # 默认 main-20250922131146 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -38,7 +38,7 @@ adapter: cm_generator: image: repository: reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: 0.10.0-alpha.0 + tag: # 默认 0.10.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -48,7 +48,7 @@ core: image: repository: sengokucola/maibot - tag: main-a8ff08e + tag: # 默认 main-0e0179f pullPolicy: IfNotPresent pullSecrets: [ ] @@ -75,7 +75,7 @@ statistics_dashboard: image: repository: nginx - tag: latest + tag: # 默认 latest pullPolicy: IfNotPresent pullSecrets: [ ] @@ -115,7 +115,7 @@ napcat: image: repository: mlikiowa/napcat-docker - tag: v4.8.98 + tag: # 默认 v4.8.116 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -161,7 +161,7 @@ sqlite_web: image: repository: coleifer/sqlite-web - tag: latest + tag: # 默认 latest pullPolicy: IfNotPresent pullSecrets: [ ] From 2cbb1cf9e324320fdc47c1151d5b557b722a2454 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:08:23 +0800 Subject: [PATCH 061/142] =?UTF-8?q?=E4=B8=BAadapter-cm-generator=E7=9A=84?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=9F=BA=E7=A1=80=E9=95=9C=E5=83=8F=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/adapter-cm-generator/Dockerfile b/helm-chart/adapter-cm-generator/Dockerfile index 7c6c802f..cd1f7747 100644 --- a/helm-chart/adapter-cm-generator/Dockerfile +++ b/helm-chart/adapter-cm-generator/Dockerfile @@ -1,5 +1,5 @@ # 此镜像用于在部署helm chart时动态生成adapter的配置文件 -FROM python:slim +FROM python:3.11-slim WORKDIR /app From 40ce8ff85a2ead6d6cecb6478abb1aeb2dbcc786 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:08:43 +0800 Subject: [PATCH 062/142] =?UTF-8?q?=E4=B8=BAadapter-cm-generator=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=BA=93=E6=8C=87=E5=AE=9A=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/adapter-cm-generator/requirements.txt b/helm-chart/adapter-cm-generator/requirements.txt index 50e16366..382e4e6a 100644 --- a/helm-chart/adapter-cm-generator/requirements.txt +++ b/helm-chart/adapter-cm-generator/requirements.txt @@ -1,2 +1,2 @@ -toml -kubernetes \ No newline at end of file +toml~=0.10.2 +kubernetes~=33.1.0 \ No newline at end of file From 99b8d4519ff1a9c844c4c1eb61337bf86fa5d9df Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:09:43 +0800 Subject: [PATCH 063/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9volume-linker.sh?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=BA=A6=E9=BA=A6=E7=9A=84=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E4=B8=BAexec=EF=BC=8C=E7=A1=AE=E4=BF=9D=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh index bd897537..1c356e17 100644 --- a/helm-chart/files/volume-linker.sh +++ b/helm-chart/files/volume-linker.sh @@ -30,4 +30,4 @@ fi # 启动麦麦 echo "[VolumeLinker]Starting MaiBot..." -python bot.py +exec python bot.py From 7a43b7ec9aad6c5e9090b0c891521df503c76cde Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:10:07 +0800 Subject: [PATCH 064/142] =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=B7=BB=E5=8A=A0sql?= =?UTF-8?q?ite-web=E7=9A=84=E6=8C=82=E8=BD=BD=E5=86=B2=E7=AA=81=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/README.md b/helm-chart/README.md index cc2898ac..ad37d51b 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -76,3 +76,5 @@ adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 不是所有存储卷的底层存储都支持`ReadWriteMany`访问模式。 如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 + +*如果启用了`sqlite-web`,那么上述问题也同样适用于`sqlite-web`与`core`,需要注意。* From d0db96798d2842622f48b1170ac701acc113a703 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:19:51 +0800 Subject: [PATCH 065/142] =?UTF-8?q?=E6=9B=B4=E6=96=B0values=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 228 ++++++++++++++++------------------------- 1 file changed, 88 insertions(+), 140 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 463c6f02..617e8ada 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -193,13 +193,14 @@ config: # adapter的config.toml adapter_config: | [inner] - version = "0.1.1" # 版本号 + version = "0.1.2" # 版本号 # 请勿修改版本号,除非你知道自己在做什么 [nickname] # 现在没用 nickname = "" [napcat_server] # Napcat连接的ws服务设置 + token = "" # Napcat设定的访问令牌,若无则留空 heartbeat_interval = 30 # 与Napcat设置的心跳相同(按秒计) [chat] # 黑白名单功能 @@ -224,27 +225,27 @@ config: # core的model_config.toml core_model_config: | [inner] - version = "1.3.0" + version = "1.7.0" # 配置文件版本号迭代规则同bot_config.toml [[api_providers]] # API服务提供商(可以配置多个) name = "DeepSeek" # API服务商名称(可随意命名,在models的api-provider中需使用这个命名) - base_url = "https://api.deepseek.cn/v1" # API服务商的BaseURL + base_url = "https://api.deepseek.com/v1" # API服务商的BaseURL api_key = "your-api-key-here" # API密钥(请替换为实际的API密钥) client_type = "openai" # 请求客户端(可选,默认值为"openai",使用gimini等Google系模型时请配置为"gemini") max_retry = 2 # 最大重试次数(单个模型API调用失败,最多重试的次数) timeout = 30 # API请求超时时间(单位:秒) retry_interval = 10 # 重试间隔时间(单位:秒) - [[api_providers]] # SiliconFlow的API服务商配置 - name = "SiliconFlow" - base_url = "https://api.siliconflow.cn/v1" - api_key = "your-siliconflow-api-key" + [[api_providers]] # 阿里 百炼 API服务商配置 + name = "BaiLian" + base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1" + api_key = "your-bailian-key" client_type = "openai" max_retry = 2 - timeout = 30 - retry_interval = 10 + timeout = 15 + retry_interval = 5 [[api_providers]] # 特殊:Google的Gimini使用特殊API,与OpenAI格式不兼容,需要配置client为"gemini" name = "Google" @@ -255,6 +256,15 @@ config: timeout = 30 retry_interval = 10 + [[api_providers]] # SiliconFlow的API服务商配置 + name = "SiliconFlow" + base_url = "https://api.siliconflow.cn/v1" + api_key = "your-siliconflow-api-key" + client_type = "openai" + max_retry = 2 + timeout = 60 + retry_interval = 10 + [[models]] # 模型(可以配置多个) model_identifier = "deepseek-chat" # 模型标识符(API服务商提供的模型标识符) @@ -265,19 +275,12 @@ config: #force_stream_mode = true # 强制流式输出模式(若模型不支持非流式输出,请取消该注释,启用强制流式输出,若无该字段,默认值为false) [[models]] - model_identifier = "Pro/deepseek-ai/DeepSeek-V3" + model_identifier = "deepseek-ai/DeepSeek-V3" name = "siliconflow-deepseek-v3" api_provider = "SiliconFlow" price_in = 2.0 price_out = 8.0 - [[models]] - model_identifier = "Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" - name = "deepseek-r1-distill-qwen-32b" - api_provider = "SiliconFlow" - price_in = 4.0 - price_out = 16.0 - [[models]] model_identifier = "Qwen/Qwen3-8B" name = "qwen3-8b" @@ -288,22 +291,11 @@ config: enable_thinking = false # 不启用思考 [[models]] - model_identifier = "Qwen/Qwen3-14B" - name = "qwen3-14b" - api_provider = "SiliconFlow" - price_in = 0.5 - price_out = 2.0 - [models.extra_params] # 可选的额外参数配置 - enable_thinking = false # 不启用思考 - - [[models]] - model_identifier = "Qwen/Qwen3-30B-A3B" + model_identifier = "Qwen/Qwen3-30B-A3B-Instruct-2507" name = "qwen3-30b" api_provider = "SiliconFlow" price_in = 0.7 price_out = 2.8 - [models.extra_params] # 可选的额外参数配置 - enable_thinking = false # 不启用思考 [[models]] model_identifier = "Qwen/Qwen2.5-VL-72B-Instruct" @@ -327,27 +319,27 @@ config: price_out = 0 - [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,是麦麦必须的模型 - model_list = ["siliconflow-deepseek-v3"] # 使用的模型列表,每个子项对应上面的模型名称(name) + [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,麦麦的情绪变化等,是麦麦必须的模型 + model_list = ["siliconflow-deepseek-v3","qwen3-30b"] # 使用的模型列表,每个子项对应上面的模型名称(name) temperature = 0.2 # 模型温度,新V3建议0.1-0.3 max_tokens = 800 # 最大输出token数 [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 - model_list = ["qwen3-8b"] + model_list = ["qwen3-8b","qwen3-30b"] + temperature = 0.7 + max_tokens = 800 + + [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 + model_list = ["qwen3-30b"] temperature = 0.7 max_tokens = 800 [model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习 model_list = ["siliconflow-deepseek-v3"] - temperature = 0.2 # 模型温度,新V3建议0.1-0.3 + temperature = 0.3 # 模型温度,新V3建议0.1-0.3 max_tokens = 800 - [model_task_config.planner] #决策:负责决定麦麦该做什么的模型 - model_list = ["siliconflow-deepseek-v3"] - temperature = 0.3 - max_tokens = 800 - - [model_task_config.emotion] #负责麦麦的情绪变化 + [model_task_config.planner] #决策:负责决定麦麦该什么时候回复的模型 model_list = ["siliconflow-deepseek-v3"] temperature = 0.3 max_tokens = 800 @@ -359,11 +351,6 @@ config: [model_task_config.voice] # 语音识别模型 model_list = ["sensevoice-small"] - [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 - model_list = ["qwen3-14b"] - temperature = 0.7 - max_tokens = 800 - #嵌入模型 [model_task_config.embedding] model_list = ["bge-m3"] @@ -381,14 +368,14 @@ config: max_tokens = 800 [model_task_config.lpmm_qa] # 问答模型 - model_list = ["deepseek-r1-distill-qwen-32b"] + model_list = ["qwen3-30b"] temperature = 0.7 max_tokens = 800 # core的bot_config.toml core_bot_config: | [inner] - version = "6.4.6" + version = "6.14.3" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -401,25 +388,39 @@ config: #----以上是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- [bot] - platform = "qq" - qq_account = 1145141919810 # 麦麦的QQ账号 + platform = "qq" + qq_account = "1145141919810" # 麦麦的QQ账号 nickname = "麦麦" # 麦麦的昵称 alias_names = ["麦叠", "牢麦"] # 麦麦的别名 [personality] - # 建议50字以内,描述人格的核心特质 - personality_core = "是一个女孩子" - # 人格的细节,描述人格的一些侧面 - personality_side = "有时候说话不过脑子,喜欢开玩笑, 有时候会表现得无语,有时候会喜欢说一些奇怪的话" + # 建议120字以内,描述人格特质 和 身份特征 + personality = "是一个女大学生,现在在读大二,会刷贴吧。" #アイデンティティがない 生まれないらららら - # 可以描述外貌,性别,身高,职业,属性等等描述 - identity = "年龄为19岁,是女孩子,身高为160cm,有黑色的短发" - # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容 - reply_style = "回复可以简短一些。可以参考贴吧,知乎和微博的回复风格,回复不要浮夸,不要用夸张修辞,平淡一些。不要浮夸,不要夸张修辞。" + reply_style = "请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。" + # 情感特征,影响情绪的变化情况 + emotion_style = "情绪较为稳定,但遭遇特定事件的时候起伏较大" + # 麦麦的兴趣,会影响麦麦对什么话题进行回复 + interest = "对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题" - compress_personality = false # 是否压缩人格,压缩后会精简人格信息,节省token消耗并提高回复性能,但是会丢失一些信息,如果人设不长,可以关闭 - compress_identity = true # 是否压缩身份,压缩后会精简身份信息,节省token消耗并提高回复性能,但是会丢失一些信息,如果不长,可以关闭 + # 麦麦的说话规则,行为风格: + plan_style = """请你根据聊天内容,用户的最新消息和以下标准选择合适的动作: + 1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + 2.如果相同的内容已经被执行,请不要重复执行 + 3.请控制你的发言频率,不要太过频繁的发言 + 4.如果有人对你感到厌烦,请减少回复 + 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对""" + + # 麦麦识图规则,不建议修改 + visual_style = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" + + + # 麦麦私聊的说话规则,行为风格: + private_plan_style = """请你根据聊天内容,用户的最新消息和以下标准选择合适的动作: + 1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + 2.如果相同的内容已经被执行,请不要重复执行 + 3.某句话如果已经被回复过,不要重复回复""" [expression] # 表达学习配置 @@ -430,63 +431,47 @@ config: # 格式说明: # 第一位: chat_stream_id,空字符串表示全局配置 # 第二位: 是否使用学到的表达 ("enable"/"disable") - # 第三位: 是否学习表达 ("enable"/"disable") + # 第三位: 是否学习表达 ("enable"/"disable") # 第四位: 学习强度(浮点数),影响学习频率,最短学习时间间隔 = 300/学习强度(秒) # 学习强度越高,学习越频繁;学习强度越低,学习越少 ] expression_groups = [ - ["qq:1919810:private","qq:114514:private","qq:1111111:group"], # 在这里设置互通组,相同组的chat_id会共享学习到的表达方式 - # 格式:["qq:123456:private","qq:654321:group"] + # ["*"], # 全局共享组:所有chat_id共享学习到的表达方式(取消注释以启用全局共享) + ["qq:1919810:private","qq:114514:private","qq:1111111:group"], # 特定互通组,相同组的chat_id会共享学习到的表达方式 + # 格式说明: + # ["*"] - 启用全局共享,所有聊天流共享表达方式 + # ["qq:123456:private","qq:654321:group"] - 特定互通组,组内chat_id共享表达方式 # 注意:如果为群聊,则需要设置为group,如果设置为私聊,则需要设置为private ] [chat] #麦麦的聊天设置 - talk_frequency = 0.5 - # 麦麦活跃度,越高,麦麦回复越多,范围0-1 - focus_value = 0.5 - # 麦麦的专注度,越高越容易持续连续对话,可能消耗更多token, 范围0-1 - + talk_value = 1 + mentioned_bot_reply = true # 是否启用提及必回复 max_context_size = 20 # 上下文长度 - mentioned_bot_inevitable_reply = true # 提及 bot 大概率回复 - at_bot_inevitable_reply = true # @bot 或 提及bot 大概率回复 - - focus_value_adjust = [ - ["", "8:00,1", "12:00,0.8", "18:00,1", "01:00,0.3"], - ["qq:114514:group", "12:20,0.6", "16:10,0.5", "20:10,0.8", "00:10,0.3"], - ["qq:1919810:private", "8:20,0.5", "12:10,0.8", "20:10,1", "00:10,0.2"] - ] - - talk_frequency_adjust = [ - ["", "8:00,0.5", "12:00,0.6", "18:00,0.8", "01:00,0.3"], - ["qq:114514:group", "12:20,0.3", "16:10,0.5", "20:10,0.4", "00:10,0.1"], - ["qq:1919810:private", "8:20,0.3", "12:10,0.4", "20:10,0.5", "00:10,0.1"] - ] - # 基于聊天流的个性化活跃度和专注度配置 - # 格式:[["platform:chat_id:type", "HH:MM,frequency", "HH:MM,frequency", ...], ...] - - # 全局配置示例: - # [["", "8:00,1", "12:00,2", "18:00,1.5", "00:00,0.5"]] - - # 特定聊天流配置示例: - # [ - # ["", "8:00,1", "12:00,1.2", "18:00,1.5", "01:00,0.6"], # 全局默认配置 - # ["qq:1026294844:group", "12:20,1", "16:10,2", "20:10,1", "00:10,0.3"], # 特定群聊配置 - # ["qq:729957033:private", "8:20,1", "12:10,2", "20:10,1.5", "00:10,0.2"] # 特定私聊配置 - # ] - - # 说明: - # - 当第一个元素为空字符串""时,表示全局默认配置 - # - 当第一个元素为"platform:id:type"格式时,表示特定聊天流配置 - # - 后续元素是"时间,频率"格式,表示从该时间开始使用该活跃度,直到下一个时间点 - # - 优先级:特定聊天流配置 > 全局配置 > 默认 talk_frequency - - [relationship] enable_relationship = true # 是否启用关系系统 - relation_frequency = 1 # 关系频率,麦麦构建关系的频率 + + [tool] + enable_tool = true # 是否启用回复工具 + + [mood] + enable_mood = true # 是否启用情绪系统 + mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢 + + [emoji] + emoji_chance = 0.6 # 麦麦激活表情包动作的概率 + max_reg_num = 100 # 表情包最大注册数量 + do_replace = true # 开启则在达到最大数量时删除(替换)表情包,关闭则达到最大数量时不会继续收集表情包 + check_interval = 10 # 检查表情包(注册,破损,删除)的时间间隔(分钟) + steal_emoji = true # 是否偷取表情包,让麦麦可以将一些表情包据为己有 + content_filtration = false # 是否启用表情包过滤,只有符合该要求的表情包才会被保存 + filtration_prompt = "符合公序良俗" # 表情包过滤要求,只有符合该要求的表情包才会被保存 + + [voice] + enable_asr = false # 是否启用语音识别,启用后麦麦可以识别语音消息,启用该功能需要配置语音识别模型[model_task_config.voice] [message_receive] # 以下是消息过滤,可以根据规则过滤特定消息,将不会读取这些消息 @@ -500,39 +485,6 @@ config: #"\\d{4}-\\d{2}-\\d{2}", # 匹配日期 ] - [tool] - enable_tool = false # 是否在普通聊天中启用工具 - - [mood] - enable_mood = true # 是否启用情绪系统 - mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢 - - [emoji] - emoji_chance = 0.6 # 麦麦激活表情包动作的概率 - - max_reg_num = 60 # 表情包最大注册数量 - do_replace = true # 开启则在达到最大数量时删除(替换)表情包,关闭则达到最大数量时不会继续收集表情包 - check_interval = 10 # 检查表情包(注册,破损,删除)的时间间隔(分钟) - steal_emoji = true # 是否偷取表情包,让麦麦可以将一些表情包据为己有 - content_filtration = false # 是否启用表情包过滤,只有符合该要求的表情包才会被保存 - filtration_prompt = "符合公序良俗" # 表情包过滤要求,只有符合该要求的表情包才会被保存 - - [memory] - enable_memory = true # 是否启用记忆系统 - memory_build_frequency = 1 # 记忆构建频率 越高,麦麦学习越多 - memory_compress_rate = 0.1 # 记忆压缩率 控制记忆精简程度 建议保持默认,调高可以获得更多信息,但是冗余信息也会增多 - - forget_memory_interval = 3000 # 记忆遗忘间隔 单位秒 间隔越低,麦麦遗忘越频繁,记忆更精简,但更难学习 - memory_forget_time = 48 #多长时间后的记忆会被遗忘 单位小时 - memory_forget_percentage = 0.008 # 记忆遗忘比例 控制记忆遗忘程度 越大遗忘越多 建议保持默认 - - enable_instant_memory = false # 是否启用即时记忆,测试功能,可能存在未知问题 - - #不希望记忆的词,已经记忆的不会受到影响,需要手动清理 - memory_ban_words = [ "表情包", "图片", "回复", "聊天记录" ] - - [voice] - enable_asr = false # 是否启用语音识别,启用后麦麦可以识别语音消息,启用该功能需要配置语音识别模型[model.voice]s [lpmm_knowledge] # lpmm知识库配置 enable = false # 是否启用lpmm知识库 @@ -557,7 +509,7 @@ config: keyword_rules = [ { keywords = ["人机", "bot", "机器", "入机", "robot", "机器人", "ai", "AI"], reaction = "有人说你是人机或者机器人,否定这一事实,攻击或反问他。注意,只有认为你是机器人才回复,否则不要否认" }, { keywords = ["测试关键词回复", "test"], reaction = "回答测试成功" }, - #{ keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } + #{ keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } # 在此处添加更多规则,格式同上 ] @@ -565,10 +517,6 @@ config: { regex = ["^(?P\\S{1,20})是这样的$"], reaction = "请按照以下模板造句:[n]是这样的,xx只要xx就可以,可是[n]要考虑的事情就很多了,比如什么时候xx,什么时候xx,什么时候xx。(请自由发挥替换xx部分,只需保持句式结构,同时表达一种将[n]过度重视的反讽意味)" } ] - # 可以自定义部分提示词 - [custom_prompt] - image_prompt = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" - [response_post_process] enable_response_post_process = true # 是否启用回复后处理,包括错别字生成器,回复分割器 @@ -615,4 +563,4 @@ config: enable = true [experimental] #实验性功能 - enable_friend_chat = false # 是否启用好友聊天 + none = false # 暂无 From 87e5a31d349fe04eca4444e45ed3c3ec22d520d7 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 00:27:11 +0800 Subject: [PATCH 066/142] =?UTF-8?q?=E5=9C=A8README=E4=B8=AD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helm-chart/README.md b/helm-chart/README.md index ad37d51b..a8cc6c29 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -4,6 +4,13 @@ 当前Helm Chart对应的麦麦版本可以在`Chart.yaml`中查看`appVersion`项。 +## 可用的Helm Chart版本列表 + +| Helm Chart版本 | 对应的MaiBot版本 | +|----------------|--------------| +| 0.10.3-beta | 0.10.3-beta | +| 0.10.0-alpha.0 | 0.10.0-alpha | + ## Values项说明 `values.yaml`分为几个大部分。 From 99429bbc8cf6f829738a5edca5726af01230f3ea Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 02:11:25 +0800 Subject: [PATCH 067/142] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=95=9C=E5=83=8F=EF=BC=8C=E8=87=AA=E8=A1=8C=E6=9E=84?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 10 ++++++++++ helm-chart/templates/core-statefulset.yaml | 2 +- helm-chart/values.yaml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 5a5a2f73..73e48dce 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -2,6 +2,16 @@ stages: - build - package +# 构建最后一个tag的麦麦本体的镜像 +build-core: + stage: build + image: reg.mikumikumi.xyz/base/kaniko-builder:latest + script: + - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) + - git reset --hard ${MAIBOT_VERSION} + - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:${MAIBOT_VERSION}" + - build + # 将Helm Chart版本作为tag,构建并推送镜像 build-adapter-cm-generator: stage: build diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index 84ac6721..ff4ed8fe 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "main-0e0179f" }} + image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "0.10.3-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 617e8ada..09595638 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -47,7 +47,7 @@ adapter: core: image: - repository: sengokucola/maibot + repository: reg.mikumikumi.xyz/maibot/maibot tag: # 默认 main-0e0179f pullPolicy: IfNotPresent pullSecrets: [ ] From ff549c0db8234593acc0be98e3da1072155c69f2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 02:28:33 +0800 Subject: [PATCH 068/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 73e48dce..5ceedaa0 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -1,16 +1,37 @@ stages: + - initialize-maibot-git-repo - build - package +# 查询并将麦麦仓库的工作区置为最后一个tag的版本 +initialize-maibot-git-repo: + stage: initialize-maibot-git-repo + image: reg.mikumikumi.xyz/base/git:latest + cache: + key: git-repo + policy: push + paths: + - target-repo/ + script: + - rm -r target-repo + - git reset --hard $(git describe --tags --abbrev=0) + - cp -r . /tmp/target-repo + - mv /tmp/target-repo ./target-repo + # 构建最后一个tag的麦麦本体的镜像 build-core: stage: build image: reg.mikumikumi.xyz/base/kaniko-builder:latest + cache: + key: git-repo + policy: pull + paths: + - target-repo/ script: - - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) - - git reset --hard ${MAIBOT_VERSION} - - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:${MAIBOT_VERSION}" + - cd target-repo/ + - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(git describe --tags --abbrev=0)" - build + - rm -rf target-repo/* target-repo/.* # 将Helm Chart版本作为tag,构建并推送镜像 build-adapter-cm-generator: From 76055792af29553d932682cf3a396c8dc65e925e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 02:32:23 +0800 Subject: [PATCH 069/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 5ceedaa0..ecab4924 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -13,7 +13,7 @@ initialize-maibot-git-repo: paths: - target-repo/ script: - - rm -r target-repo + - rm -r target-repo || echo "`target-repo/` not found. Skipped." - git reset --hard $(git describe --tags --abbrev=0) - cp -r . /tmp/target-repo - mv /tmp/target-repo ./target-repo From b82cae06f7446a71a851fb81bcbc6e8f1e1156eb Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 02:42:13 +0800 Subject: [PATCH 070/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index ecab4924..a725c3ef 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -13,10 +13,12 @@ initialize-maibot-git-repo: paths: - target-repo/ script: - - rm -r target-repo || echo "`target-repo/` not found. Skipped." - - git reset --hard $(git describe --tags --abbrev=0) - - cp -r . /tmp/target-repo - - mv /tmp/target-repo ./target-repo + - git clone https://github.com/MaiM-with-u/MaiBot.git target-repo/ + - cd target-repo/ + - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) + - echo "Current version is `${MAIBOT_VERSION}`" + - git reset --hard ${MAIBOT_VERSION} + - echo ${MAIBOT_VERSION} > MAIBOT_VERSION # 构建最后一个tag的麦麦本体的镜像 build-core: @@ -29,7 +31,8 @@ build-core: - target-repo/ script: - cd target-repo/ - - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(git describe --tags --abbrev=0)" + - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)" + - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - build - rm -rf target-repo/* target-repo/.* From 010029088fe1e190e3bbc1bae23b75ab016c386e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 02:57:23 +0800 Subject: [PATCH 071/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index a725c3ef..cb0ceaed 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -16,9 +16,10 @@ initialize-maibot-git-repo: - git clone https://github.com/MaiM-with-u/MaiBot.git target-repo/ - cd target-repo/ - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) - - echo "Current version is `${MAIBOT_VERSION}`" + - echo "Current version is ${MAIBOT_VERSION}" - git reset --hard ${MAIBOT_VERSION} - echo ${MAIBOT_VERSION} > MAIBOT_VERSION + - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM # 构建最后一个tag的麦麦本体的镜像 build-core: @@ -32,7 +33,6 @@ build-core: script: - cd target-repo/ - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)" - - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - build - rm -rf target-repo/* target-repo/.* From 04a7075425beb5508eeb7fb8307bd8b0973bb54e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 03:02:44 +0800 Subject: [PATCH 072/142] =?UTF-8?q?=E8=B0=83=E6=95=B4values=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 09595638..fbbdf4bc 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -48,7 +48,7 @@ core: image: repository: reg.mikumikumi.xyz/maibot/maibot - tag: # 默认 main-0e0179f + tag: # 默认 0.10.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] From fb7468c5ae46737e081e24bdfb48fdf1cc562739 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 03:02:51 +0800 Subject: [PATCH 073/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index cb0ceaed..8f7a30b2 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -20,6 +20,7 @@ initialize-maibot-git-repo: - git reset --hard ${MAIBOT_VERSION} - echo ${MAIBOT_VERSION} > MAIBOT_VERSION - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + - ls -al # 构建最后一个tag的麦麦本体的镜像 build-core: @@ -32,6 +33,7 @@ build-core: - target-repo/ script: - cd target-repo/ + - ls -al - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)" - build - rm -rf target-repo/* target-repo/.* From f3d20db625dd61a95e472f630151955b7d7366f2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 03:10:04 +0800 Subject: [PATCH 074/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 8f7a30b2..2415c8f4 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -33,6 +33,7 @@ build-core: - target-repo/ script: - cd target-repo/ + - export BUILD_CONTEXT=$(pwd) - ls -al - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)" - build From 3149f68e56994d6815455e9db6ac136e52f1969c Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 03:15:31 +0800 Subject: [PATCH 075/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 2415c8f4..9e3fcf01 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -19,6 +19,7 @@ initialize-maibot-git-repo: - echo "Current version is ${MAIBOT_VERSION}" - git reset --hard ${MAIBOT_VERSION} - echo ${MAIBOT_VERSION} > MAIBOT_VERSION + - git clone https://github.com/MaiM-with-u/maim_message maim_message - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - ls -al From 0ee1619d57dcdb87a464e41b42f415d5e8d8bfe7 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 03:39:46 +0800 Subject: [PATCH 076/142] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 2 +- helm-chart/templates/core-statefulset.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 9e3fcf01..1a7a5b06 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -36,7 +36,7 @@ build-core: - cd target-repo/ - export BUILD_CONTEXT=$(pwd) - ls -al - - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:$(cat MAIBOT_VERSION)" + - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:tag-$(cat MAIBOT_VERSION)" - build - rm -rf target-repo/* target-repo/.* diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index ff4ed8fe..ec33c051 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "0.10.3-beta" }} + image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "tag-0.10.3-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 From 06c74e34048c1bc4c9cf116232edebaa778018fd Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 10:45:18 +0800 Subject: [PATCH 077/142] =?UTF-8?q?=E4=BF=AE=E6=94=B9values=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index fbbdf4bc..09e0878c 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -48,7 +48,7 @@ core: image: repository: reg.mikumikumi.xyz/maibot/maibot - tag: # 默认 0.10.3-beta + tag: # 默认 tag-0.10.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] From c9ef7d5b78cf36099898d7389ed3f82b0d33a105 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 13:41:30 +0800 Subject: [PATCH 078/142] =?UTF-8?q?=E5=B0=86=E9=95=9C=E5=83=8F=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=BB=8Evalues=E4=B8=AD=E8=A7=A3=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-statefulset.yaml | 2 +- helm-chart/templates/core-statefulset.yaml | 2 +- helm-chart/templates/napcat-statefulset.yaml | 2 +- helm-chart/templates/pre-adapter-cm-gen-job.yaml | 2 +- helm-chart/templates/sqlite-web-statefulset.yaml | 2 +- helm-chart/templates/statistics-deployment.yaml | 2 +- helm-chart/values.yaml | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml index bd6f7b2f..1a7103f2 100644 --- a/helm-chart/templates/adapter-statefulset.yaml +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -21,7 +21,7 @@ spec: env: - name: TZ value: Asia/Shanghai - image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag | default "main-20250922131146" }} + image: {{ .Values.adapter.image.repository | default "unclas/maimbot-adapter" }}:{{ .Values.adapter.image.tag | default "main-20250922131146" }} imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} ports: - containerPort: 8095 diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core-statefulset.yaml index ec33c051..fa880c3b 100644 --- a/helm-chart/templates/core-statefulset.yaml +++ b/helm-chart/templates/core-statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag | default "tag-0.10.3-beta" }} + image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.10.3-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml index 4b7830a0..11575026 100644 --- a/helm-chart/templates/napcat-statefulset.yaml +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag | default "v4.8.116" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.8.116" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/pre-adapter-cm-gen-job.yaml index c87d1b61..59667a20 100644 --- a/helm-chart/templates/pre-adapter-cm-gen-job.yaml +++ b/helm-chart/templates/pre-adapter-cm-gen-job.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository }}:{{ .Values.adapter.cm_generator.image.tag | default "0.10.3-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.10.3-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web-statefulset.yaml index 4b8e0fad..9fb0010b 100644 --- a/helm-chart/templates/sqlite-web-statefulset.yaml +++ b/helm-chart/templates/sqlite-web-statefulset.yaml @@ -22,7 +22,7 @@ spec: env: - name: SQLITE_DATABASE value: /data/MaiMBot/MaiBot.db - image: {{ .Values.sqlite_web.image.repository }}:{{ .Values.sqlite_web.image.tag | default "latest" }} + image: {{ .Values.sqlite_web.image.repository | default "coleifer/sqlite-web" }}:{{ .Values.sqlite_web.image.tag | default "latest" }} imagePullPolicy: {{ .Values.sqlite_web.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics-deployment.yaml index 4a902e5b..c5e951e1 100644 --- a/helm-chart/templates/statistics-deployment.yaml +++ b/helm-chart/templates/statistics-deployment.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: nginx - image: {{ .Values.statistics_dashboard.image.repository }}:{{ .Values.statistics_dashboard.image.tag | default "latest" }} + image: {{ .Values.statistics_dashboard.image.repository | default "nginx" }}:{{ .Values.statistics_dashboard.image.tag | default "latest" }} imagePullPolicy: {{ .Values.statistics_dashboard.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 09e0878c..3df43c07 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -9,7 +9,7 @@ PRIVACY_AGREE: false adapter: image: - repository: unclas/maimbot-adapter + repository: # 默认 unclas/maimbot-adapter tag: # 默认 main-20250922131146 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -37,7 +37,7 @@ adapter: # adapter的动态生成configmap的Job的配置 cm_generator: image: - repository: reg.mikumikumi.xyz/maibot/adapter-cm-generator + repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator tag: # 默认 0.10.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -47,7 +47,7 @@ adapter: core: image: - repository: reg.mikumikumi.xyz/maibot/maibot + repository: # 默认 reg.mikumikumi.xyz/maibot/maibot tag: # 默认 tag-0.10.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -74,7 +74,7 @@ statistics_dashboard: replicaCount: 1 image: - repository: nginx + repository: # 默认 nginx tag: # 默认 latest pullPolicy: IfNotPresent pullSecrets: [ ] @@ -114,7 +114,7 @@ napcat: enabled: true image: - repository: mlikiowa/napcat-docker + repository: # 默认 mlikiowa/napcat-docker tag: # 默认 v4.8.116 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -160,7 +160,7 @@ sqlite_web: enabled: false image: - repository: coleifer/sqlite-web + repository: # 默认 coleifer/sqlite-web tag: # 默认 latest pullPolicy: IfNotPresent pullSecrets: [ ] From 7618937cd4fd0ab1a7bd8a31ab244a8b0742fced Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Sep 2025 14:21:49 +0800 Subject: [PATCH 079/142] =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=A2=AB=E4=B8=8A=E4=BC=A0=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=B8=85=E7=90=86=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 1a7a5b06..333c36e1 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -38,7 +38,6 @@ build-core: - ls -al - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:tag-$(cat MAIBOT_VERSION)" - build - - rm -rf target-repo/* target-repo/.* # 将Helm Chart版本作为tag,构建并推送镜像 build-adapter-cm-generator: From cf41b36572c7a8263cfd78c59972389a267df13e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 10:26:40 +0800 Subject: [PATCH 080/142] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0helm=20chart?= =?UTF-8?q?=E7=9A=84=E5=85=83=E4=BF=A1=E6=81=AF=E5=92=8C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- helm-chart/README.md | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 89a60f34..2245a77c 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.10.3-beta -appVersion: 0.10.3-beta +version: 0.11.0 +appVersion: 0.11.0 diff --git a/helm-chart/README.md b/helm-chart/README.md index a8cc6c29..329ee1ed 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -4,18 +4,31 @@ 当前Helm Chart对应的麦麦版本可以在`Chart.yaml`中查看`appVersion`项。 +部署文档:[Kubernetes 部署](https://docs.mai-mai.org/manual/deployment/mmc_deploy_kubernetes.html) + ## 可用的Helm Chart版本列表 | Helm Chart版本 | 对应的MaiBot版本 | |----------------|--------------| +| 0.11.0 | 0.11.0 | | 0.10.3-beta | 0.10.3-beta | | 0.10.0-alpha.0 | 0.10.0-alpha | +## TL; DR + +```shell +helm install maimai \ + oci://reg.mikumikumi.xyz/maibot/maibot \ + --namespace bot \ + --version \ + --values maibot.yaml +``` + ## Values项说明 `values.yaml`分为几个大部分。 -1. EULA & PRIVACY: 用户必须同意这里的协议才能成功部署麦麦。 +1. `EULA` & `PRIVACY`: 用户必须同意这里的协议才能成功部署麦麦。 2. `adapter`: 麦麦的Adapter的部署配置。 From e983c938f7aca8691fb2cb61d3e592c49685a986 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 10:42:45 +0800 Subject: [PATCH 081/142] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4helm=20ch?= =?UTF-8?q?art=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitignore | 1 + helm-chart/templates/{adapter-pvc.yaml => adapter/pvc.yaml} | 0 .../templates/{adapter-service.yaml => adapter/service.yaml} | 0 .../{adapter-statefulset.yaml => adapter/statefulset.yaml} | 0 .../templates/{core-configmap.yaml => core/configmap.yaml} | 0 helm-chart/templates/{core-pvc.yaml => core/pvc.yaml} | 0 helm-chart/templates/{core-service.yaml => core/service.yaml} | 0 .../templates/{core-statefulset.yaml => core/statefulset.yaml} | 0 .../job-gen-adapter-cm.yaml} | 0 .../rbac-gen-adapter-cm.yaml} | 0 .../templates/{napcat-ingress.yaml => napcat/ingress.yaml} | 0 helm-chart/templates/{napcat-pvc.yaml => napcat/pvc.yaml} | 0 .../templates/{napcat-service.yaml => napcat/service.yaml} | 0 .../{napcat-statefulset.yaml => napcat/statefulset.yaml} | 0 .../templates/{pre-check.yaml => other/check-eula-privacy.yaml} | 0 .../{scripts-configmap.yaml => other/configmap-scripts.yaml} | 0 .../{sqlite-web-ingress.yaml => sqlite-web/ingress.yaml} | 0 .../{sqlite-web-service.yaml => sqlite-web/service.yaml} | 0 .../{sqlite-web-statefulset.yaml => sqlite-web/statefulset.yaml} | 0 .../{statistics-deployment.yaml => statistics/deployment.yaml} | 0 .../{statistics-ingress.yaml => statistics/ingress.yaml} | 0 .../templates/{statistics-pvc.yaml => statistics/pvc.yaml} | 0 .../{statistics-service.yaml => statistics/service.yaml} | 0 23 files changed, 1 insertion(+) create mode 100644 helm-chart/.gitignore rename helm-chart/templates/{adapter-pvc.yaml => adapter/pvc.yaml} (100%) rename helm-chart/templates/{adapter-service.yaml => adapter/service.yaml} (100%) rename helm-chart/templates/{adapter-statefulset.yaml => adapter/statefulset.yaml} (100%) rename helm-chart/templates/{core-configmap.yaml => core/configmap.yaml} (100%) rename helm-chart/templates/{core-pvc.yaml => core/pvc.yaml} (100%) rename helm-chart/templates/{core-service.yaml => core/service.yaml} (100%) rename helm-chart/templates/{core-statefulset.yaml => core/statefulset.yaml} (100%) rename helm-chart/templates/{pre-adapter-cm-gen-job.yaml => job-post-install/job-gen-adapter-cm.yaml} (100%) rename helm-chart/templates/{pre-adapter-cm-gen-rbac.yaml => job-post-install/rbac-gen-adapter-cm.yaml} (100%) rename helm-chart/templates/{napcat-ingress.yaml => napcat/ingress.yaml} (100%) rename helm-chart/templates/{napcat-pvc.yaml => napcat/pvc.yaml} (100%) rename helm-chart/templates/{napcat-service.yaml => napcat/service.yaml} (100%) rename helm-chart/templates/{napcat-statefulset.yaml => napcat/statefulset.yaml} (100%) rename helm-chart/templates/{pre-check.yaml => other/check-eula-privacy.yaml} (100%) rename helm-chart/templates/{scripts-configmap.yaml => other/configmap-scripts.yaml} (100%) rename helm-chart/templates/{sqlite-web-ingress.yaml => sqlite-web/ingress.yaml} (100%) rename helm-chart/templates/{sqlite-web-service.yaml => sqlite-web/service.yaml} (100%) rename helm-chart/templates/{sqlite-web-statefulset.yaml => sqlite-web/statefulset.yaml} (100%) rename helm-chart/templates/{statistics-deployment.yaml => statistics/deployment.yaml} (100%) rename helm-chart/templates/{statistics-ingress.yaml => statistics/ingress.yaml} (100%) rename helm-chart/templates/{statistics-pvc.yaml => statistics/pvc.yaml} (100%) rename helm-chart/templates/{statistics-service.yaml => statistics/service.yaml} (100%) diff --git a/helm-chart/.gitignore b/helm-chart/.gitignore new file mode 100644 index 00000000..b5ec6e00 --- /dev/null +++ b/helm-chart/.gitignore @@ -0,0 +1 @@ +!napcat diff --git a/helm-chart/templates/adapter-pvc.yaml b/helm-chart/templates/adapter/pvc.yaml similarity index 100% rename from helm-chart/templates/adapter-pvc.yaml rename to helm-chart/templates/adapter/pvc.yaml diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter/service.yaml similarity index 100% rename from helm-chart/templates/adapter-service.yaml rename to helm-chart/templates/adapter/service.yaml diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter/statefulset.yaml similarity index 100% rename from helm-chart/templates/adapter-statefulset.yaml rename to helm-chart/templates/adapter/statefulset.yaml diff --git a/helm-chart/templates/core-configmap.yaml b/helm-chart/templates/core/configmap.yaml similarity index 100% rename from helm-chart/templates/core-configmap.yaml rename to helm-chart/templates/core/configmap.yaml diff --git a/helm-chart/templates/core-pvc.yaml b/helm-chart/templates/core/pvc.yaml similarity index 100% rename from helm-chart/templates/core-pvc.yaml rename to helm-chart/templates/core/pvc.yaml diff --git a/helm-chart/templates/core-service.yaml b/helm-chart/templates/core/service.yaml similarity index 100% rename from helm-chart/templates/core-service.yaml rename to helm-chart/templates/core/service.yaml diff --git a/helm-chart/templates/core-statefulset.yaml b/helm-chart/templates/core/statefulset.yaml similarity index 100% rename from helm-chart/templates/core-statefulset.yaml rename to helm-chart/templates/core/statefulset.yaml diff --git a/helm-chart/templates/pre-adapter-cm-gen-job.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml similarity index 100% rename from helm-chart/templates/pre-adapter-cm-gen-job.yaml rename to helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml diff --git a/helm-chart/templates/pre-adapter-cm-gen-rbac.yaml b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml similarity index 100% rename from helm-chart/templates/pre-adapter-cm-gen-rbac.yaml rename to helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat/ingress.yaml similarity index 100% rename from helm-chart/templates/napcat-ingress.yaml rename to helm-chart/templates/napcat/ingress.yaml diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat/pvc.yaml similarity index 100% rename from helm-chart/templates/napcat-pvc.yaml rename to helm-chart/templates/napcat/pvc.yaml diff --git a/helm-chart/templates/napcat-service.yaml b/helm-chart/templates/napcat/service.yaml similarity index 100% rename from helm-chart/templates/napcat-service.yaml rename to helm-chart/templates/napcat/service.yaml diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml similarity index 100% rename from helm-chart/templates/napcat-statefulset.yaml rename to helm-chart/templates/napcat/statefulset.yaml diff --git a/helm-chart/templates/pre-check.yaml b/helm-chart/templates/other/check-eula-privacy.yaml similarity index 100% rename from helm-chart/templates/pre-check.yaml rename to helm-chart/templates/other/check-eula-privacy.yaml diff --git a/helm-chart/templates/scripts-configmap.yaml b/helm-chart/templates/other/configmap-scripts.yaml similarity index 100% rename from helm-chart/templates/scripts-configmap.yaml rename to helm-chart/templates/other/configmap-scripts.yaml diff --git a/helm-chart/templates/sqlite-web-ingress.yaml b/helm-chart/templates/sqlite-web/ingress.yaml similarity index 100% rename from helm-chart/templates/sqlite-web-ingress.yaml rename to helm-chart/templates/sqlite-web/ingress.yaml diff --git a/helm-chart/templates/sqlite-web-service.yaml b/helm-chart/templates/sqlite-web/service.yaml similarity index 100% rename from helm-chart/templates/sqlite-web-service.yaml rename to helm-chart/templates/sqlite-web/service.yaml diff --git a/helm-chart/templates/sqlite-web-statefulset.yaml b/helm-chart/templates/sqlite-web/statefulset.yaml similarity index 100% rename from helm-chart/templates/sqlite-web-statefulset.yaml rename to helm-chart/templates/sqlite-web/statefulset.yaml diff --git a/helm-chart/templates/statistics-deployment.yaml b/helm-chart/templates/statistics/deployment.yaml similarity index 100% rename from helm-chart/templates/statistics-deployment.yaml rename to helm-chart/templates/statistics/deployment.yaml diff --git a/helm-chart/templates/statistics-ingress.yaml b/helm-chart/templates/statistics/ingress.yaml similarity index 100% rename from helm-chart/templates/statistics-ingress.yaml rename to helm-chart/templates/statistics/ingress.yaml diff --git a/helm-chart/templates/statistics-pvc.yaml b/helm-chart/templates/statistics/pvc.yaml similarity index 100% rename from helm-chart/templates/statistics-pvc.yaml rename to helm-chart/templates/statistics/pvc.yaml diff --git a/helm-chart/templates/statistics-service.yaml b/helm-chart/templates/statistics/service.yaml similarity index 100% rename from helm-chart/templates/statistics-service.yaml rename to helm-chart/templates/statistics/service.yaml From 7e24a8739a4a955707e3e2823ca5e04061647572 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 10:57:48 +0800 Subject: [PATCH 082/142] =?UTF-8?q?feat:=20=E5=9C=A8helm=20chart=E7=9A=84?= =?UTF-8?q?=20job-gen-adapter-cm=E6=9B=B4=E6=96=B0=E5=AE=8C=E6=AF=95config?= =?UTF-8?q?map=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E9=87=8D=E5=90=AFadapte?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter-cm-generator.py | 30 +++++++++++++++++-- .../job-post-install/rbac-gen-adapter-cm.yaml | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py index d2370daf..a1ed293a 100644 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ b/helm-chart/adapter-cm-generator/adapter-cm-generator.py @@ -7,9 +7,11 @@ import os import toml import base64 from kubernetes import client, config +from datetime import datetime, timezone config.load_incluster_config() -v1 = client.CoreV1Api() +core_api = client.CoreV1Api() +apps_api = client.AppsV1Api() # 读取部署的关键信息 namespace = os.getenv("NAMESPACE") @@ -33,11 +35,33 @@ cm = client.V1ConfigMap( data={'config.toml': toml.dumps(data)} ) try: - v1.create_namespaced_config_map(namespace, cm) + core_api.create_namespaced_config_map(namespace, cm) print(f"ConfigMap `{cm_name}` created successfully") except client.exceptions.ApiException as e: if e.status == 409: # 已存在,更新 - v1.replace_namespaced_config_map(cm_name, namespace, cm) + core_api.replace_namespaced_config_map(cm_name, namespace, cm) print(f"ConfigMap `{cm_name}` replaced successfully") else: raise + +# 重启adapter的statefulset +now = datetime.now(timezone.utc).isoformat() +body = { + "spec": { + "template": { + "metadata": { + "annotations": { + "kubectl.kubernetes.io/restartedAt": now + } + } + } + } +} +resp = apps_api.patch_namespaced_stateful_set( + name=f'{release_name}-maibot-adapter', + namespace=namespace, + body=body, +) +print(f"StatefulSet `{release_name}-maibot-adapter` restarted successfully") + +print('Job succeed.') diff --git a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml index 69fefbef..be299f3f 100644 --- a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml @@ -12,7 +12,7 @@ metadata: namespace: {{ .Release.Namespace }} rules: - apiGroups: [""] - resources: ["configmaps"] + resources: ["configmaps", "statefulsets"] verbs: ["get", "list", "create", "update", "patch"] --- apiVersion: rbac.authorization.k8s.io/v1 From e74157ba36b899a72b2131332e6a7ce565eea859 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:00:48 +0800 Subject: [PATCH 083/142] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4volume-li?= =?UTF-8?q?nker.sh=E7=9A=84=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/volume-linker.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh index 1c356e17..4a371e3c 100644 --- a/helm-chart/files/volume-linker.sh +++ b/helm-chart/files/volume-linker.sh @@ -5,14 +5,14 @@ # /MaiMBot/statistics是统计数据的实际挂载路径 set -e -echo "[VolumeLinker]Preparing volume..." +echo "[VolumeLinker] Preparing volume..." # 初次启动,在存储卷中检查并创建关键文件和目录 mkdir -p /MaiMBot/data/plugins mkdir -p /MaiMBot/data/logs if [ ! -d "/MaiMBot/statistics" ] then - echo "[VolumeLinker] Statistics volume disabled." + echo "[VolumeLinker] Statistics volume disabled." else touch /MaiMBot/statistics/index.html fi @@ -29,5 +29,5 @@ then fi # 启动麦麦 -echo "[VolumeLinker]Starting MaiBot..." +echo "[VolumeLinker] Starting MaiBot..." exec python bot.py From d51b4d6d07a64a7e06848b0be6feae0f3b9a2846 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:03:59 +0800 Subject: [PATCH 084/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=20adapter-cm-generator.py=E7=9A=84=E4=BE=9D=E8=B5=96=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/adapter-cm-generator/requirements.txt b/helm-chart/adapter-cm-generator/requirements.txt index 382e4e6a..83e030ca 100644 --- a/helm-chart/adapter-cm-generator/requirements.txt +++ b/helm-chart/adapter-cm-generator/requirements.txt @@ -1,2 +1,2 @@ toml~=0.10.2 -kubernetes~=33.1.0 \ No newline at end of file +kubernetes~=34.1.0 \ No newline at end of file From b7590be33dc20cf319d1b480b0b8e850da234eb7 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:05:42 +0800 Subject: [PATCH 085/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3helm=20chart?= =?UTF-8?q?=E7=9A=84=E7=89=88=E6=9C=AC=E5=8F=B7=E4=B8=BAbeta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- helm-chart/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 2245a77c..f218a58b 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.0 -appVersion: 0.11.0 +version: 0.11.0-beta +appVersion: 0.11.0-beta diff --git a/helm-chart/README.md b/helm-chart/README.md index 329ee1ed..a2457860 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,7 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | |----------------|--------------| -| 0.11.0 | 0.11.0 | +| 0.11.0-beta | 0.11.0-beta | | 0.10.3-beta | 0.10.3-beta | | 0.10.0-alpha.0 | 0.10.0-alpha | From fefeb10d4ccfe30d60d0d9cf3a612e4f9246c720 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:16:36 +0800 Subject: [PATCH 086/142] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9helm=20chart?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=EF=BC=8C=E4=BB=85=E5=9C=A8helm-char?= =?UTF-8?q?t=E5=88=86=E6=94=AF=E4=B8=8A=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 333c36e1..ff0cd886 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -3,6 +3,12 @@ stages: - build - package +# 仅在helm-chart分支运行 +workflow: + rules: + - if: '$CI_COMMIT_BRANCH == "helm-chart"' + - when: never + # 查询并将麦麦仓库的工作区置为最后一个tag的版本 initialize-maibot-git-repo: stage: initialize-maibot-git-repo From bc5cc5b38656ab92f644517d18105078bd54384a Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:21:24 +0800 Subject: [PATCH 087/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E6=89=80=E6=9C=89=E9=95=9C=E5=83=8F=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter/statefulset.yaml | 2 +- helm-chart/templates/core/statefulset.yaml | 2 +- .../templates/job-post-install/job-gen-adapter-cm.yaml | 2 +- helm-chart/templates/napcat/statefulset.yaml | 2 +- helm-chart/values.yaml | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm-chart/templates/adapter/statefulset.yaml b/helm-chart/templates/adapter/statefulset.yaml index 1a7103f2..262891b4 100644 --- a/helm-chart/templates/adapter/statefulset.yaml +++ b/helm-chart/templates/adapter/statefulset.yaml @@ -21,7 +21,7 @@ spec: env: - name: TZ value: Asia/Shanghai - image: {{ .Values.adapter.image.repository | default "unclas/maimbot-adapter" }}:{{ .Values.adapter.image.tag | default "main-20250922131146" }} + image: {{ .Values.adapter.image.repository | default "unclas/maimbot-adapter" }}:{{ .Values.adapter.image.tag | default "main-20250924053857" }} imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} ports: - containerPort: 8095 diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index fa880c3b..25761aff 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.10.3-beta" }} + image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.0-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml index 59667a20..5678fd63 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.10.3-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.0-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index 11575026..fe1efe3c 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.8.116" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.8" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 3df43c07..c957737d 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -10,7 +10,7 @@ adapter: image: repository: # 默认 unclas/maimbot-adapter - tag: # 默认 main-20250922131146 + tag: # 默认 main-20250924053857 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -48,7 +48,7 @@ core: image: repository: # 默认 reg.mikumikumi.xyz/maibot/maibot - tag: # 默认 tag-0.10.3-beta + tag: # 默认 tag-0.11.0-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -115,7 +115,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.8.116 + tag: # 默认 v4.9.8 pullPolicy: IfNotPresent pullSecrets: [ ] From cb4e2938c5c63d305fb738eda66c9b5227220dba Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 11:26:20 +0800 Subject: [PATCH 088/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E7=9A=84values.yaml=E7=9A=84=E9=85=8D=E7=BD=AE=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 159 +++++++++++++++++++++++++++++------------ 1 file changed, 112 insertions(+), 47 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index c957737d..401a08af 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -225,7 +225,7 @@ config: # core的model_config.toml core_model_config: | [inner] - version = "1.7.0" + version = "1.7.7" # 配置文件版本号迭代规则同bot_config.toml @@ -235,7 +235,7 @@ config: api_key = "your-api-key-here" # API密钥(请替换为实际的API密钥) client_type = "openai" # 请求客户端(可选,默认值为"openai",使用gimini等Google系模型时请配置为"gemini") max_retry = 2 # 最大重试次数(单个模型API调用失败,最多重试的次数) - timeout = 30 # API请求超时时间(单位:秒) + timeout = 120 # API请求超时时间(单位:秒) retry_interval = 10 # 重试间隔时间(单位:秒) [[api_providers]] # 阿里 百炼 API服务商配置 @@ -244,16 +244,16 @@ config: api_key = "your-bailian-key" client_type = "openai" max_retry = 2 - timeout = 15 + timeout = 120 retry_interval = 5 [[api_providers]] # 特殊:Google的Gimini使用特殊API,与OpenAI格式不兼容,需要配置client为"gemini" name = "Google" - base_url = "https://api.google.com/v1" + base_url = "https://generativelanguage.googleapis.com/v1beta" api_key = "your-google-api-key-1" client_type = "gemini" max_retry = 2 - timeout = 30 + timeout = 120 retry_interval = 10 [[api_providers]] # SiliconFlow的API服务商配置 @@ -261,9 +261,9 @@ config: base_url = "https://api.siliconflow.cn/v1" api_key = "your-siliconflow-api-key" client_type = "openai" - max_retry = 2 - timeout = 60 - retry_interval = 10 + max_retry = 3 + timeout = 120 + retry_interval = 5 [[models]] # 模型(可以配置多个) @@ -275,21 +275,31 @@ config: #force_stream_mode = true # 强制流式输出模式(若模型不支持非流式输出,请取消该注释,启用强制流式输出,若无该字段,默认值为false) [[models]] - model_identifier = "deepseek-ai/DeepSeek-V3" - name = "siliconflow-deepseek-v3" + model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp" + name = "siliconflow-deepseek-v3.2" api_provider = "SiliconFlow" price_in = 2.0 - price_out = 8.0 - - [[models]] - model_identifier = "Qwen/Qwen3-8B" - name = "qwen3-8b" - api_provider = "SiliconFlow" - price_in = 0 - price_out = 0 + price_out = 3.0 [models.extra_params] # 可选的额外参数配置 enable_thinking = false # 不启用思考 + [[models]] + model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp" + name = "siliconflow-deepseek-v3.2-think" + api_provider = "SiliconFlow" + price_in = 2.0 + price_out = 3.0 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = true # 不启用思考 + + [[models]] + model_identifier = "deepseek-ai/DeepSeek-R1" + name = "siliconflow-deepseek-r1" + api_provider = "SiliconFlow" + price_in = 4.0 + price_out = 16.0 + + [[models]] model_identifier = "Qwen/Qwen3-30B-A3B-Instruct-2507" name = "qwen3-30b" @@ -298,8 +308,8 @@ config: price_out = 2.8 [[models]] - model_identifier = "Qwen/Qwen2.5-VL-72B-Instruct" - name = "qwen2.5-vl-72b" + model_identifier = "Qwen/Qwen3-VL-30B-A3B-Instruct" + name = "qwen3-vl-30" api_provider = "SiliconFlow" price_in = 4.13 price_out = 4.13 @@ -320,14 +330,14 @@ config: [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,麦麦的情绪变化等,是麦麦必须的模型 - model_list = ["siliconflow-deepseek-v3","qwen3-30b"] # 使用的模型列表,每个子项对应上面的模型名称(name) + model_list = ["siliconflow-deepseek-v3.2"] # 使用的模型列表,每个子项对应上面的模型名称(name) temperature = 0.2 # 模型温度,新V3建议0.1-0.3 - max_tokens = 800 # 最大输出token数 + max_tokens = 2048 # 最大输出token数 [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 - model_list = ["qwen3-8b","qwen3-30b"] + model_list = ["qwen3-30b"] temperature = 0.7 - max_tokens = 800 + max_tokens = 2048 [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 model_list = ["qwen3-30b"] @@ -335,18 +345,18 @@ config: max_tokens = 800 [model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习 - model_list = ["siliconflow-deepseek-v3"] + model_list = ["siliconflow-deepseek-v3.2-think","siliconflow-deepseek-r1","siliconflow-deepseek-v3.2"] temperature = 0.3 # 模型温度,新V3建议0.1-0.3 - max_tokens = 800 + max_tokens = 2048 [model_task_config.planner] #决策:负责决定麦麦该什么时候回复的模型 - model_list = ["siliconflow-deepseek-v3"] + model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.3 max_tokens = 800 [model_task_config.vlm] # 图像识别模型 - model_list = ["qwen2.5-vl-72b"] - max_tokens = 800 + model_list = ["qwen3-vl-30"] + max_tokens = 256 [model_task_config.voice] # 语音识别模型 model_list = ["sensevoice-small"] @@ -358,24 +368,24 @@ config: #------------LPMM知识库模型------------ [model_task_config.lpmm_entity_extract] # 实体提取模型 - model_list = ["siliconflow-deepseek-v3"] + model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.2 max_tokens = 800 [model_task_config.lpmm_rdf_build] # RDF构建模型 - model_list = ["siliconflow-deepseek-v3"] + model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.2 max_tokens = 800 [model_task_config.lpmm_qa] # 问答模型 - model_list = ["qwen3-30b"] + model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.7 max_tokens = 800 # core的bot_config.toml core_bot_config: | [inner] - version = "6.14.3" + version = "6.19.1" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -390,6 +400,9 @@ config: [bot] platform = "qq" qq_account = "1145141919810" # 麦麦的QQ账号 + + platforms = ["wx:114514","xx:1919810"] # 麦麦的其他平台账号 + nickname = "麦麦" # 麦麦的昵称 alias_names = ["麦叠", "牢麦"] # 麦麦的别名 @@ -399,13 +412,12 @@ config: #アイデンティティがない 生まれないらららら # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容 reply_style = "请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。" - # 情感特征,影响情绪的变化情况 - emotion_style = "情绪较为稳定,但遭遇特定事件的时候起伏较大" + # 麦麦的兴趣,会影响麦麦对什么话题进行回复 interest = "对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题" # 麦麦的说话规则,行为风格: - plan_style = """请你根据聊天内容,用户的最新消息和以下标准选择合适的动作: + plan_style = """ 1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 @@ -415,14 +427,27 @@ config: # 麦麦识图规则,不建议修改 visual_style = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" - # 麦麦私聊的说话规则,行为风格: - private_plan_style = """请你根据聊天内容,用户的最新消息和以下标准选择合适的动作: + private_plan_style = """ 1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.某句话如果已经被回复过,不要重复回复""" + # 状态,可以理解为人格多样性,会随机替换人格 + states = [ + "是一个女大学生,喜欢上网聊天,会刷小红书。" , + "是一个大二心理学生,会刷贴吧和中国知网。" , + "是一个赛博网友,最近很想吐槽人。" + ] + + # 替换概率,每次构建人格时替换personality的概率(0.0-1.0) + state_probability = 0.3 + [expression] + # 表达方式模式 + mode = "classic" + # 可选:classic经典模式,exp_model 表达模型模式,这个模式需要一定时间学习才会有比较好的效果 + # 表达学习配置 learning_list = [ # 表达学习配置列表,支持按聊天流配置 ["", "enable", "enable", "1.0"], # 全局配置:使用表达,启用学习,学习强度1.0 @@ -447,22 +472,56 @@ config: [chat] #麦麦的聊天设置 - talk_value = 1 + talk_value = 1 #聊天频率,越小越沉默,范围0-1 mentioned_bot_reply = true # 是否启用提及必回复 - max_context_size = 20 # 上下文长度 + max_context_size = 30 # 上下文长度 + auto_chat_value = 1 # 自动聊天,越小,麦麦主动聊天的概率越低 + planner_smooth = 5 #规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐2-8,0为关闭,必须大于等于0 + + enable_talk_value_rules = true # 是否启用动态发言频率规则 + enable_auto_chat_value_rules = false # 是否启用动态自动聊天频率规则 + + # 动态发言频率规则:按时段/按chat_id调整 talk_value(优先匹配具体chat,再匹配全局) + # 推荐格式(对象数组):{ target="platform:id:type" 或 "", time="HH:MM-HH:MM", value=0.5 } + # 说明: + # - target 为空字符串表示全局;type 为 group/private,例如:"qq:1919810:group" 或 "qq:114514:private"; + # - 支持跨夜区间,例如 "23:00-02:00";数值范围建议 0-1。 + talk_value_rules = [ + { target = "", time = "00:00-08:59", value = 0.8 }, + { target = "", time = "09:00-22:59", value = 1.0 }, + { target = "qq:1919810:group", time = "20:00-23:59", value = 0.6 }, + { target = "qq:114514:private", time = "00:00-23:59", value = 0.3 }, + ] + + # 动态自动聊天频率规则:按时段/按chat_id调整 auto_chat_value(优先匹配具体chat,再匹配全局) + # 推荐格式(对象数组):{ target="platform:id:type" 或 "", time="HH:MM-HH:MM", value=0.5 } + # 说明: + # - target 为空字符串表示全局;type 为 group/private,例如:"qq:1919810:group" 或 "qq:114514:private"; + # - 支持跨夜区间,例如 "23:00-02:00";数值范围建议 0-1。 + auto_chat_value_rules = [ + { target = "", time = "00:00-08:59", value = 0.3 }, + { target = "", time = "09:00-22:59", value = 1.0 }, + { target = "qq:1919810:group", time = "20:00-23:59", value = 0.8 }, + { target = "qq:114514:private", time = "00:00-23:59", value = 0.5 }, + ] + + [memory] + max_memory_number = 100 # 记忆最大数量 + max_memory_size = 2048 # 记忆最大大小 + memory_build_frequency = 1 # 记忆构建频率 - [relationship] - enable_relationship = true # 是否启用关系系统 [tool] - enable_tool = true # 是否启用回复工具 + enable_tool = true # 是否启用工具 [mood] - enable_mood = true # 是否启用情绪系统 + enable_mood = false # 是否启用情绪系统 mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢 + # 情感特征,影响情绪的变化情况 + emotion_style = "情绪较为稳定,但遭遇特定事件的时候起伏较大" [emoji] - emoji_chance = 0.6 # 麦麦激活表情包动作的概率 + emoji_chance = 0.4 # 麦麦激活表情包动作的概率 max_reg_num = 100 # 表情包最大注册数量 do_replace = true # 开启则在达到最大数量时删除(替换)表情包,关闭则达到最大数量时不会继续收集表情包 check_interval = 10 # 检查表情包(注册,破损,删除)的时间间隔(分钟) @@ -514,7 +573,8 @@ config: ] regex_rules = [ - { regex = ["^(?P\\S{1,20})是这样的$"], reaction = "请按照以下模板造句:[n]是这样的,xx只要xx就可以,可是[n]要考虑的事情就很多了,比如什么时候xx,什么时候xx,什么时候xx。(请自由发挥替换xx部分,只需保持句式结构,同时表达一种将[n]过度重视的反讽意味)" } + { regex = ["^(?P\\S{1,20})是这样的$"], reaction = "请按照以下模板造句:[n]是这样的,xx只要xx就可以,可是[n]要考虑的事情就很多了,比如什么时候xx,什么时候xx,什么时候xx。(请自由发挥替换xx部分,只需保持句式结构,同时表达一种将[n]过度重视的反讽意味)" }, + { regex = ["(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"],reaction = "进行一次“八岐大蛇定型文”补完。暂时忽略回复风格,进入“粉絲吐槽”模式。请严格按照以下“填空模板”,围绕“[action]”进行创作,使其充满滑稽的夸张感和天马行空的联想:我没要求你[action],我不是(与action关联的、宽容的角色)。可是,(与action相关的具体负面行为)是什么意思?你的(与action相关的某种观念)怎么了?你才(与action相关的某个状态或时间点)吧?再这样下去,你(一个中期的、等比级数式的滑稽推演),(一个后期的、等比级数式的滑稽推演),最后就变成(一个与主题相关的、夸张的最终形态)了。作为(与最终形态相关的、克星或权威身份),我可能得(对你执行一个天罚般的行动)。真的。"} ] [response_post_process] @@ -543,7 +603,7 @@ config: # 第三方库日志控制 suppress_libraries = ["faiss","httpx", "urllib3", "asyncio", "websockets", "httpcore", "requests", "peewee", "openai","uvicorn","jieba"] # 完全屏蔽的库 - library_log_levels = { "aiohttp" = "WARNING"} # 设置特定库的日志级别 + library_log_levels = { aiohttp = "WARNING"} # 设置特定库的日志级别 [debug] show_prompt = false # 是否显示prompt @@ -564,3 +624,8 @@ config: [experimental] #实验性功能 none = false # 暂无 + + + #此系统暂时移除,无效配置 + [relationship] + enable_relationship = true # 是否启用关系系统 From 433c4044b2c796c0707fa9a5d7eab43728559387 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 12:01:09 +0800 Subject: [PATCH 089/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhelm=20chart?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E7=9A=84=E9=94=99=E8=AF=AF=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=9B=AE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index ff0cd886..0b9f6c22 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -56,7 +56,8 @@ build-adapter-cm-generator: - export BUILD_CONTEXT=helm-chart/adapter-cm-generator - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - - export BUILD_ARGS="--destination ${TMP_DST}:${CHART_VERSION} --destination ${TMP_DST}:latest" + - export BUILD_DESTINATION="${TMP_DST}:${CHART_VERSION}" + - export BUILD_ARGS="--destination ${TMP_DST}:latest" - build # 打包并推送helm chart From f460046608247533b2a0cd429831f82d19ae1c27 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 12:05:40 +0800 Subject: [PATCH 090/142] =?UTF-8?q?change:=20=E5=8F=96=E6=B6=88helm=20char?= =?UTF-8?q?t=E6=B5=81=E6=B0=B4=E7=BA=BF=E7=9A=84=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 0b9f6c22..f0e2c63c 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -49,9 +49,9 @@ build-core: build-adapter-cm-generator: stage: build image: reg.mikumikumi.xyz/base/kaniko-builder:latest - rules: - - changes: - - helm-chart/adapter-cm-generator/** +# rules: +# - changes: +# - helm-chart/adapter-cm-generator/** script: - export BUILD_CONTEXT=helm-chart/adapter-cm-generator - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator @@ -64,12 +64,12 @@ build-adapter-cm-generator: package-helm-chart: stage: package image: reg.mikumikumi.xyz/mirror/helm:latest - rules: - - changes: - - helm-chart/files/** - - helm-chart/templates/** - - helm-chart/Chart.yaml - - helm-chart/values.yaml +# rules: +# - changes: +# - helm-chart/files/** +# - helm-chart/templates/** +# - helm-chart/Chart.yaml +# - helm-chart/values.yaml script: - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD} From 9502204aeef25febb647f31443c755b3206815e5 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 12:23:18 +0800 Subject: [PATCH 091/142] =?UTF-8?q?docs:=20=E4=B8=BAhelm=20chart=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=9E=84=E5=BB=BA=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3values.yaml=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 4 ++++ helm-chart/values.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index a2457860..2291df16 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -98,3 +98,7 @@ adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 *如果启用了`sqlite-web`,那么上述问题也同样适用于`sqlite-web`与`core`,需要注意。* + +## 其他信息 + +查看helm chart和core镜像的构建CI:https://gitlab.mikumikumi.xyz/maibot/maibot/-/pipelines diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 401a08af..24ef7ed1 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -37,8 +37,8 @@ adapter: # adapter的动态生成configmap的Job的配置 cm_generator: image: - repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.10.3-beta + repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator 构建CI:https://gitlab.mikumikumi.xyz/maibot/maibot/-/pipelines + tag: # 默认 0.11.0-beta pullPolicy: IfNotPresent pullSecrets: [ ] From eedd0fd7d45be180b0c37f4d12af374ef149d5f6 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 14:35:16 +0800 Subject: [PATCH 092/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E4=B8=BB?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index f0e2c63c..ad7af61d 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -19,7 +19,7 @@ initialize-maibot-git-repo: paths: - target-repo/ script: - - git clone https://github.com/MaiM-with-u/MaiBot.git target-repo/ + - git clone https://github.com/Mai-with-u/MaiBot.git target-repo/ - cd target-repo/ - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) - echo "Current version is ${MAIBOT_VERSION}" From e01a6401e48e9fca229cd92bc0b4c4d222bf881f Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 17:35:07 +0800 Subject: [PATCH 093/142] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=A8helm=20chart?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=9A=84apiGroups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml index be299f3f..bfc9e081 100644 --- a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml @@ -11,7 +11,7 @@ metadata: name: {{ .Release.Name }}-maibot-adapter-cm-gen-role namespace: {{ .Release.Namespace }} rules: - - apiGroups: [""] + - apiGroups: ["apps"] resources: ["configmaps", "statefulsets"] verbs: ["get", "list", "create", "update", "patch"] --- From 327cd6be9ca0267d7c4a6c4285f45c8ddddf80d7 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 17:48:28 +0800 Subject: [PATCH 094/142] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3helm=20chart?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84role=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/job-post-install/rbac-gen-adapter-cm.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml index bfc9e081..1df08343 100644 --- a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml @@ -11,8 +11,11 @@ metadata: name: {{ .Release.Name }}-maibot-adapter-cm-gen-role namespace: {{ .Release.Namespace }} rules: + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "create", "update", "patch"] - apiGroups: ["apps"] - resources: ["configmaps", "statefulsets"] + resources: ["statefulsets"] verbs: ["get", "list", "create", "update", "patch"] --- apiVersion: rbac.authorization.k8s.io/v1 From ecbf06b8a65da38f5d484e2b2580dc98fc02e557 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 31 Oct 2025 17:57:11 +0800 Subject: [PATCH 095/142] =?UTF-8?q?feat:=20=E9=83=A8=E7=BD=B2=E5=90=8E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=87=8D=E5=90=AFcore=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E9=87=8D=E8=BD=BD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/adapter-cm-generator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py index a1ed293a..2f3e06b0 100644 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ b/helm-chart/adapter-cm-generator/adapter-cm-generator.py @@ -44,7 +44,7 @@ except client.exceptions.ApiException as e: else: raise -# 重启adapter的statefulset +# 重启adapter和core的statefulset now = datetime.now(timezone.utc).isoformat() body = { "spec": { @@ -57,11 +57,16 @@ body = { } } } -resp = apps_api.patch_namespaced_stateful_set( +apps_api.patch_namespaced_stateful_set( name=f'{release_name}-maibot-adapter', namespace=namespace, body=body, ) +apps_api.patch_namespaced_stateful_set( + name=f'{release_name}-maibot-core', + namespace=namespace, + body=body, +) print(f"StatefulSet `{release_name}-maibot-adapter` restarted successfully") print('Job succeed.') From 60df8e9a3f43414f43be7348737defd11ae50413 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Sat, 1 Nov 2025 00:54:59 +0800 Subject: [PATCH 096/142] =?UTF-8?q?feat:=20=E4=B8=BAhelm=20chart=E7=BC=96?= =?UTF-8?q?=E5=86=99=E8=84=9A=E6=9C=AC=EF=BC=8C=E7=94=A8=E4=BA=8E=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=8F=92=E4=BB=B6=E6=9B=B4=E6=96=B0=E5=90=8E=E6=88=96?= =?UTF-8?q?=E9=BA=A6=E9=BA=A6=E9=A6=96=E6=AC=A1=E5=90=AF=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E4=B8=BA=E7=94=A8=E6=88=B7=E8=87=AA=E5=8A=A8=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8F=92=E4=BB=B6=E5=88=B0=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E5=8D=B7=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/files/setup-plugins.py | 95 +++++++++++++++++++ helm-chart/templates/core/statefulset.yaml | 19 ++++ .../templates/other/configmap-scripts.yaml | 3 + 3 files changed, 117 insertions(+) create mode 100644 helm-chart/files/setup-plugins.py diff --git a/helm-chart/files/setup-plugins.py b/helm-chart/files/setup-plugins.py new file mode 100644 index 00000000..9fde6804 --- /dev/null +++ b/helm-chart/files/setup-plugins.py @@ -0,0 +1,95 @@ +#!/usr/local/bin/python3 +# 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此脚本用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 +# 如果用户主动删除插件且插件无更新,则不会再次安装。插件状态保存在/MaiMBot/data/plugins/.installed-setup-plugins文件中 +# 此脚本应当挂载进初始化容器中,从/MaiMBot工作路径开始运行。初始化容器的镜像同core容器,初始化容器中应挂载core存储卷的数据到/MaiMBot/data +import os +import shutil +import hashlib +from datetime import datetime + +SRC_DIR = '/MaiMBot/plugins' +DST_DIR = '/MaiMBot/data/plugins' +STATUS_FILE = f'{DST_DIR}/.installed-setup-plugins' +BAK_DIR = '/MaiMBot/data/plugins-backup' +CURRENT_TIME = datetime.now().strftime('%Y%m%d%H%M%S') + +def hash_dir_file(path: str): + """计算目录/文件的SHA256,用于判断是否发生变化""" + def hash_file(_file_path: str): + _h = hashlib.sha256() + with open(_file_path, 'rb') as _f: + for _chunk in iter(lambda: _f.read(8192), b''): + _h.update(_chunk) + return _h.hexdigest() + + if os.path.isfile(path): + return hash_file(path) + + h = hashlib.sha256() + for root, dirs, files in os.walk(path): + for filename in sorted(files): + filepath = os.path.join(root, filename) + relpath = os.path.relpath(filepath, path) + file_hash = hash_file(filepath) + h.update(relpath.encode('utf-8')) + h.update(file_hash.encode('utf-8')) + return h.hexdigest() + +def copy_plugin(plugin: str): + """复制插件,如果插件已存在则备份旧的插件然后用新的插件覆盖""" + src = os.path.join(SRC_DIR, plugin) + if not os.path.exists(src): + raise FileNotFoundError(f"File not found: {src}") + + dst = os.path.join(DST_DIR, plugin) + if os.path.exists(dst): + print(f"\t\tWarning: Old version of plugin '{plugin}' already exists. " + f"Old plugin will be moved to '{BAK_DIR}/{CURRENT_TIME}/{plugin}'. " + f"Remember to re-edit config of this plugin.") + if not os.path.exists(os.path.join(BAK_DIR, CURRENT_TIME)): + os.makedirs(os.path.join(BAK_DIR, CURRENT_TIME)) + if os.path.isdir(dst): + shutil.copytree(dst, os.path.join(BAK_DIR, CURRENT_TIME, plugin)) + shutil.rmtree(dst) + else: + shutil.copy2(dst, os.path.join(BAK_DIR, CURRENT_TIME)) + os.remove(dst) + + if os.path.isdir(src): + shutil.copytree(src, dst) + else: + shutil.copy2(src, DST_DIR) + +setup_plugins = {plugin: hash_dir_file(plugin) for plugin in os.listdir(SRC_DIR)} +installed_plugins = {} +to_install_plugins = {} + +print(f"[SetupPlugins] Default plugin, which has been updated or never been installed, " + f"will be installed in this init container.") +if os.path.exists(STATUS_FILE) and os.path.isfile(STATUS_FILE): + print(f"[SetupPlugins] Reading status file: '{STATUS_FILE}'...") + with open(STATUS_FILE, 'r', encoding='utf-8') as f: + lines = f.readlines() + for line in lines: + if line == '': + continue + plugin = line.strip().split(':') + installed_plugins[plugin[0]] = plugin[1] + print(f"[SetupPlugins] Found {len(installed_plugins)} default plugins which used to be installed:") + for plugin in installed_plugins.keys(): + print(f'\t{plugin}') +else: + print(f"[SetupPlugins] No status file found. Status file '{STATUS_FILE}' will be created. " + f"All default plugins will be installed now.") + +print(f"[SetupPlugins] Checking plugins...") +for plugin, sha256 in setup_plugins.items(): + if (plugin not in installed_plugins) or (sha256 != installed_plugins[plugin]): + print(f"\tFound default plugin to install: '{plugin}'. Installing...") + copy_plugin(plugin) + installed_plugins[plugin] = sha256 + +with open(STATUS_FILE, 'w', encoding='utf-8') as f: + f.write('\n'.join(sorted([f'{plugin}:{sha256}' for plugin, sha256 in installed_plugins.items()]))) + +print(f"[SetupPlugins] Default plugin checking done. Status saved to '{STATUS_FILE}'.") diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 25761aff..bd6ab702 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -62,6 +62,23 @@ spec: - mountPath: /MaiMBot/statistics name: statistics {{- end }} + initContainers: # 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此初始化容器用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 + - args: + - setup-plugins.py + command: + - python3 + workingDir: /MaiMBot + image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.0-beta" }} + imagePullPolicy: {{ .Values.core.image.pullPolicy }} + name: setup-plugins + resources: { } + volumeMounts: + - mountPath: /MaiMBot/data + name: data + - mountPath: /MaiMBot/setup-plugins.py + name: scripts + readOnly: true + subPath: setup-plugins.py {{- if .Values.core.image.pullSecrets }} imagePullSecrets: {{ toYaml .Values.core.image.pullSecrets | nindent 8 }} @@ -82,6 +99,8 @@ spec: items: - key: volume-linker.sh path: volume-linker.sh + - key: setup-plugins.py + path: setup-plugins.py name: {{ .Release.Name }}-maibot-scripts name: scripts - configMap: diff --git a/helm-chart/templates/other/configmap-scripts.yaml b/helm-chart/templates/other/configmap-scripts.yaml index aa6fa11f..145f090a 100644 --- a/helm-chart/templates/other/configmap-scripts.yaml +++ b/helm-chart/templates/other/configmap-scripts.yaml @@ -7,3 +7,6 @@ data: # core volume-linker.sh: | {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} + # core的初始化容器 + setup-plugins.py: | + {{ .Files.Get "files/setup-plugins.py" | nindent 4 }} From c52af3535c9677467c5ab8499b4590e83949f2dd Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Sat, 1 Nov 2025 00:57:11 +0800 Subject: [PATCH 097/142] =?UTF-8?q?docs:=20=E7=A7=BB=E9=99=A4helm=20chart?= =?UTF-8?q?=E4=B8=AD=E6=97=A0=E7=94=A8=E7=9A=84=E6=9E=84=E5=BB=BACI?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 4 ---- helm-chart/values.yaml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index 2291df16..a2457860 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -98,7 +98,3 @@ adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 *如果启用了`sqlite-web`,那么上述问题也同样适用于`sqlite-web`与`core`,需要注意。* - -## 其他信息 - -查看helm chart和core镜像的构建CI:https://gitlab.mikumikumi.xyz/maibot/maibot/-/pipelines diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 24ef7ed1..a7dd3d5c 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -37,7 +37,7 @@ adapter: # adapter的动态生成configmap的Job的配置 cm_generator: image: - repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator 构建CI:https://gitlab.mikumikumi.xyz/maibot/maibot/-/pipelines + repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator tag: # 默认 0.11.0-beta pullPolicy: IfNotPresent pullSecrets: [ ] From 56fd6f8ae881dc3df50358c8bc45d1c0190e0650 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Sat, 1 Nov 2025 01:36:38 +0800 Subject: [PATCH 098/142] =?UTF-8?q?docs:=20=E4=B8=BAhelm=20chart=E7=9A=84?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8F=92=E4=BB=B6=E8=87=AA=E5=8A=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E7=B3=BB=E7=BB=9F=E6=92=B0=E5=86=99=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index a2457860..d07aacf1 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -4,7 +4,7 @@ 当前Helm Chart对应的麦麦版本可以在`Chart.yaml`中查看`appVersion`项。 -部署文档:[Kubernetes 部署](https://docs.mai-mai.org/manual/deployment/mmc_deploy_kubernetes.html) +详细部署文档:[Kubernetes 部署](https://docs.mai-mai.org/manual/deployment/mmc_deploy_kubernetes.html) ## 可用的Helm Chart版本列表 @@ -98,3 +98,30 @@ adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 *如果启用了`sqlite-web`,那么上述问题也同样适用于`sqlite-web`与`core`,需要注意。* + +### 麦麦的默认插件 + +麦麦的`core`容器提供了一些默认插件,以提升使用体验。但是插件目录存储在存储卷中,容器启动时挂载的存储卷会完全覆盖掉容器的默认插件目录,导致默认插件无法加载,也难以被用户感知。 + +为了解决这一问题,此Helm Chart中为`core`容器引入了初始化容器。此初始化容器用于为用户自动安装默认插件到存储卷中。可以选择启用(默认启用)。 + +*初始化容器使用与`core`主容器相同的镜像,且用后即销毁,因此不会消耗额外的带宽和存储成本。* + +#### 触发插件安装的条件 + +- 首次部署时(此时没有任何插件处于安装状态) +- 默认插件更新(即默认插件内容发生变化) + +#### 安装状态识别能力 + +初始化容器会记录安装过的默认插件,不会重复安装。为了实现这一点,初始化容器会将安装状态写入`/MaiMBot/data/plugins/.installed-setup-plugins`文件中。 + +基于上述状态识别能力,如果用户不需要某个插件,可以将其删除。由于此插件已自动安装过(记录在状态文件中),即使插件本体不存在也不会再次安装(除非插件更新)。 + +#### 插件更新 + +一旦在镜像中检测到新版本插件(即插件内容不同),初始化容器即会用新插件覆盖旧插件。 + +考虑到旧插件中可能存在用户自定义配置,因此旧插件在被覆盖前会备份到`/MaiMBot/data/plugins-backup`目录中,并以时间归档。 + +因此在升级麦麦后,请注意观察初始容器的日志并重新配置插件。 From 16059532d8ef87ac28e2be0838ff8b3a34a91d0f Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Sat, 1 Nov 2025 01:37:39 +0800 Subject: [PATCH 099/142] =?UTF-8?q?feat:=20helm=20chart=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=8F=AF=E9=80=89=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=B9=E5=99=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E9=BB=98=E8=AE=A4=E6=8F=92=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 4 ++++ helm-chart/templates/other/configmap-scripts.yaml | 2 ++ helm-chart/values.yaml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index bd6ab702..8bdc2077 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -62,6 +62,7 @@ spec: - mountPath: /MaiMBot/statistics name: statistics {{- end }} + {{- if .Values.core.setup_default_plugins }} initContainers: # 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此初始化容器用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 - args: - setup-plugins.py @@ -79,6 +80,7 @@ spec: name: scripts readOnly: true subPath: setup-plugins.py + {{- end }} {{- if .Values.core.image.pullSecrets }} imagePullSecrets: {{ toYaml .Values.core.image.pullSecrets | nindent 8 }} @@ -99,8 +101,10 @@ spec: items: - key: volume-linker.sh path: volume-linker.sh + {{- if .Values.core.setup_default_plugins }} - key: setup-plugins.py path: setup-plugins.py + {{- end }} name: {{ .Release.Name }}-maibot-scripts name: scripts - configMap: diff --git a/helm-chart/templates/other/configmap-scripts.yaml b/helm-chart/templates/other/configmap-scripts.yaml index 145f090a..4d1e546f 100644 --- a/helm-chart/templates/other/configmap-scripts.yaml +++ b/helm-chart/templates/other/configmap-scripts.yaml @@ -8,5 +8,7 @@ data: volume-linker.sh: | {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} # core的初始化容器 + {{- if .Values.core.setup_default_plugins }} setup-plugins.py: | {{ .Files.Get "files/setup-plugins.py" | nindent 4 }} + {{- end }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index a7dd3d5c..d409231a 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -63,6 +63,8 @@ core: - ReadWriteOnce size: 10Gi + setup_default_plugins: true # 启用一个初始化容器,用于为用户自动安装默认插件到存储卷中 + # 麦麦的运行统计看板配置 # 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以作为静态网页访问 # 此功能默认禁用。如果你认为报告可以被公开访问(报告包含联系人/群组名称、模型token花费信息等),则可以启用此功能 From 18b4d4cc0954973a66cd43a9715c7264c45bd867 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 13 Nov 2025 11:26:04 +0800 Subject: [PATCH 100/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E9=BB=98=E8=AE=A4=E9=95=9C=E5=83=8F=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=92=8C=E5=85=83=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- helm-chart/templates/core/statefulset.yaml | 4 ++-- .../templates/job-post-install/job-gen-adapter-cm.yaml | 2 +- helm-chart/templates/napcat/statefulset.yaml | 2 +- helm-chart/values.yaml | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index f218a58b..d9eaee30 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.0-beta -appVersion: 0.11.0-beta +version: 0.11.1-beta +appVersion: 0.11.1-beta diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 8bdc2077..d68ab962 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.0-beta" }} + image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.1-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 @@ -69,7 +69,7 @@ spec: command: - python3 workingDir: /MaiMBot - image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.0-beta" }} + image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.1-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} name: setup-plugins resources: { } diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml index 5678fd63..adf1cd20 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.0-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.1-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index fe1efe3c..3bc83fe4 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.8" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.42" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index d409231a..0998d1f9 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -38,7 +38,7 @@ adapter: cm_generator: image: repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.11.0-beta + tag: # 默认 0.11.1-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -48,7 +48,7 @@ core: image: repository: # 默认 reg.mikumikumi.xyz/maibot/maibot - tag: # 默认 tag-0.11.0-beta + tag: # 默认 tag-0.11.1-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -117,7 +117,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.8 + tag: # 默认 v4.9.42 pullPolicy: IfNotPresent pullSecrets: [ ] From 94e079a340a43dff8a2bc178706932937fc10b11 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 13 Nov 2025 12:07:10 +0800 Subject: [PATCH 101/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E4=B8=AD=E7=9A=84bot=5Fconfig=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 0998d1f9..c6f9e9ac 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -387,7 +387,7 @@ config: # core的bot_config.toml core_bot_config: | [inner] - version = "6.19.1" + version = "6.19.2" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -609,6 +609,8 @@ config: [debug] show_prompt = false # 是否显示prompt + show_replyer_prompt = false # 是否显示回复器prompt + show_replyer_reasoning = false # 是否显示回复器推理 [maim_message] auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 From 6ad7145f2ed6a8f097f9cb6ba21ed9ff0442b6b7 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 13 Nov 2025 12:08:39 +0800 Subject: [PATCH 102/142] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0helm=20chart?= =?UTF-8?q?=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index d07aacf1..30c3d29b 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -8,11 +8,12 @@ ## 可用的Helm Chart版本列表 -| Helm Chart版本 | 对应的MaiBot版本 | -|----------------|--------------| -| 0.11.0-beta | 0.11.0-beta | -| 0.10.3-beta | 0.10.3-beta | -| 0.10.0-alpha.0 | 0.10.0-alpha | +| Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | +|----------------|--------------|------------------------------------------| +| 0.11.1-beta | 0.11.1-beta | 94e079a340a43dff8a2bc178706932937fc10b11 | +| 0.11.0-beta | 0.11.0-beta | 16059532d8ef87ac28e2be0838ff8b3a34a91d0f | +| 0.10.3-beta | 0.10.3-beta | 7618937cd4fd0ab1a7bd8a31ab244a8b0742fced | +| 0.10.0-alpha.0 | 0.10.0-alpha | 4efebed10aad977155d3d9e0c24bc6e14e1260ab | ## TL; DR From 34af30442ee50456209342cda68575ec6d4f451d Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:17:30 +0800 Subject: [PATCH 103/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E5=85=83=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index d9eaee30..bf6f4ace 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.1-beta -appVersion: 0.11.1-beta +version: 0.11.2-beta +appVersion: 0.11.2-beta From a071fb5b1db2fec46e31b7b959d06c011a9b0534 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:18:31 +0800 Subject: [PATCH 104/142] =?UTF-8?q?fix:=20=E4=B8=BAhelm=20chart=E7=9A=84ad?= =?UTF-8?q?apter-cm-generator=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/adapter-cm-generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py index 2f3e06b0..e860aff3 100644 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ b/helm-chart/adapter-cm-generator/adapter-cm-generator.py @@ -62,11 +62,12 @@ apps_api.patch_namespaced_stateful_set( namespace=namespace, body=body, ) +print(f"StatefulSet `{release_name}-maibot-adapter` restarted successfully") apps_api.patch_namespaced_stateful_set( name=f'{release_name}-maibot-core', namespace=namespace, body=body, ) -print(f"StatefulSet `{release_name}-maibot-adapter` restarted successfully") +print(f"StatefulSet `{release_name}-maibot-core` restarted successfully") print('Job succeed.') From 52b9c5663e0308d3c7889281ab76f725018e8687 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:33:24 +0800 Subject: [PATCH 105/142] =?UTF-8?q?ci:=20=E4=BF=AE=E6=94=B9helm=20chart?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=8F=A6?= =?UTF-8?q?=E8=A1=8C=E6=9E=84=E5=BB=BA=E9=BA=A6=E9=BA=A6=E6=9C=AC=E4=BD=93?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index ad7af61d..e10b203a 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -1,5 +1,5 @@ stages: - - initialize-maibot-git-repo +# - initialize-maibot-git-repo - build - package @@ -9,41 +9,41 @@ workflow: - if: '$CI_COMMIT_BRANCH == "helm-chart"' - when: never -# 查询并将麦麦仓库的工作区置为最后一个tag的版本 -initialize-maibot-git-repo: - stage: initialize-maibot-git-repo - image: reg.mikumikumi.xyz/base/git:latest - cache: - key: git-repo - policy: push - paths: - - target-repo/ - script: - - git clone https://github.com/Mai-with-u/MaiBot.git target-repo/ - - cd target-repo/ - - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) - - echo "Current version is ${MAIBOT_VERSION}" - - git reset --hard ${MAIBOT_VERSION} - - echo ${MAIBOT_VERSION} > MAIBOT_VERSION - - git clone https://github.com/MaiM-with-u/maim_message maim_message - - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - - ls -al - -# 构建最后一个tag的麦麦本体的镜像 -build-core: - stage: build - image: reg.mikumikumi.xyz/base/kaniko-builder:latest - cache: - key: git-repo - policy: pull - paths: - - target-repo/ - script: - - cd target-repo/ - - export BUILD_CONTEXT=$(pwd) - - ls -al - - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:tag-$(cat MAIBOT_VERSION)" - - build +## 查询并将麦麦仓库的工作区置为最后一个tag的版本 +#initialize-maibot-git-repo: +# stage: initialize-maibot-git-repo +# image: reg.mikumikumi.xyz/base/git:latest +# cache: +# key: git-repo +# policy: push +# paths: +# - target-repo/ +# script: +# - git clone https://github.com/Mai-with-u/MaiBot.git target-repo/ +# - cd target-repo/ +# - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) +# - echo "Current version is ${MAIBOT_VERSION}" +# - git reset --hard ${MAIBOT_VERSION} +# - echo ${MAIBOT_VERSION} > MAIBOT_VERSION +# - git clone https://github.com/MaiM-with-u/maim_message maim_message +# - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM +# - ls -al +# +## 构建最后一个tag的麦麦本体的镜像 +#build-core: +# stage: build +# image: reg.mikumikumi.xyz/base/kaniko-builder:latest +# cache: +# key: git-repo +# policy: pull +# paths: +# - target-repo/ +# script: +# - cd target-repo/ +# - export BUILD_CONTEXT=$(pwd) +# - ls -al +# - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:tag-$(cat MAIBOT_VERSION)" +# - build # 将Helm Chart版本作为tag,构建并推送镜像 build-adapter-cm-generator: From afb131f276492072c05bb14a5bf3d47e3ffc01e4 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:37:05 +0800 Subject: [PATCH 106/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E7=9A=84=E9=95=9C=E5=83=8F=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 4 +- .../job-post-install/job-gen-adapter-cm.yaml | 2 +- helm-chart/templates/napcat/statefulset.yaml | 2 +- helm-chart/values.yaml | 55 +++++++++---------- 4 files changed, 30 insertions(+), 33 deletions(-) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index d68ab962..ca12dca0 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.1-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.2-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 @@ -69,7 +69,7 @@ spec: command: - python3 workingDir: /MaiMBot - image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.1-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.2-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} name: setup-plugins resources: { } diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml index adf1cd20..4a3a30e7 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.1-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.2-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index 3bc83fe4..a6dd9771 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.42" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.70" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index c6f9e9ac..b660a3a5 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -47,8 +47,8 @@ adapter: core: image: - repository: # 默认 reg.mikumikumi.xyz/maibot/maibot - tag: # 默认 tag-0.11.1-beta + repository: # 默认 sengokucola/maibot + tag: # 默认 0.11.2-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -117,7 +117,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.42 + tag: # 默认 v4.9.70 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -331,23 +331,24 @@ config: price_out = 0 + [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,麦麦的情绪变化等,是麦麦必须的模型 model_list = ["siliconflow-deepseek-v3.2"] # 使用的模型列表,每个子项对应上面的模型名称(name) temperature = 0.2 # 模型温度,新V3建议0.1-0.3 max_tokens = 2048 # 最大输出token数 [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 - model_list = ["qwen3-30b"] + model_list = ["qwen3-30b","qwen3-next-80b"] temperature = 0.7 max_tokens = 2048 [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 - model_list = ["qwen3-30b"] + model_list = ["qwen3-30b","qwen3-next-80b"] temperature = 0.7 max_tokens = 800 [model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习 - model_list = ["siliconflow-deepseek-v3.2-think","siliconflow-deepseek-r1","siliconflow-deepseek-v3.2"] + model_list = ["siliconflow-deepseek-v3.2-think","siliconflow-glm-4.6-think","siliconflow-glm-4.6"] temperature = 0.3 # 模型温度,新V3建议0.1-0.3 max_tokens = 2048 @@ -387,7 +388,7 @@ config: # core的bot_config.toml core_bot_config: | [inner] - version = "6.19.2" + version = "6.21.4" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -446,10 +447,6 @@ config: state_probability = 0.3 [expression] - # 表达方式模式 - mode = "classic" - # 可选:classic经典模式,exp_model 表达模型模式,这个模式需要一定时间学习才会有比较好的效果 - # 表达学习配置 learning_list = [ # 表达学习配置列表,支持按聊天流配置 ["", "enable", "enable", "1.0"], # 全局配置:使用表达,启用学习,学习强度1.0 @@ -477,11 +474,9 @@ config: talk_value = 1 #聊天频率,越小越沉默,范围0-1 mentioned_bot_reply = true # 是否启用提及必回复 max_context_size = 30 # 上下文长度 - auto_chat_value = 1 # 自动聊天,越小,麦麦主动聊天的概率越低 - planner_smooth = 5 #规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐2-8,0为关闭,必须大于等于0 + planner_smooth = 2 #规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0 enable_talk_value_rules = true # 是否启用动态发言频率规则 - enable_auto_chat_value_rules = false # 是否启用动态自动聊天频率规则 # 动态发言频率规则:按时段/按chat_id调整 talk_value(优先匹配具体chat,再匹配全局) # 推荐格式(对象数组):{ target="platform:id:type" 或 "", time="HH:MM-HH:MM", value=0.5 } @@ -495,23 +490,13 @@ config: { target = "qq:114514:private", time = "00:00-23:59", value = 0.3 }, ] - # 动态自动聊天频率规则:按时段/按chat_id调整 auto_chat_value(优先匹配具体chat,再匹配全局) - # 推荐格式(对象数组):{ target="platform:id:type" 或 "", time="HH:MM-HH:MM", value=0.5 } - # 说明: - # - target 为空字符串表示全局;type 为 group/private,例如:"qq:1919810:group" 或 "qq:114514:private"; - # - 支持跨夜区间,例如 "23:00-02:00";数值范围建议 0-1。 - auto_chat_value_rules = [ - { target = "", time = "00:00-08:59", value = 0.3 }, - { target = "", time = "09:00-22:59", value = 1.0 }, - { target = "qq:1919810:group", time = "20:00-23:59", value = 0.8 }, - { target = "qq:114514:private", time = "00:00-23:59", value = 0.5 }, - ] + include_planner_reasoning = false # 是否将planner推理加入replyer,默认关闭(不加入) [memory] - max_memory_number = 100 # 记忆最大数量 - max_memory_size = 2048 # 记忆最大大小 - memory_build_frequency = 1 # 记忆构建频率 + max_agent_iterations = 5 # 记忆思考深度(最低为1(不深入思考)) + [jargon] + all_global = true # 是否开启全局黑话模式,注意,此功能关闭后,已经记录的全局黑话不会改变,需要手动删除 [tool] enable_tool = true # 是否启用工具 @@ -549,6 +534,8 @@ config: [lpmm_knowledge] # lpmm知识库配置 enable = false # 是否启用lpmm知识库 + lpmm_mode = "agent" + # 可选:classic经典模式,agent 模式,结合最新的记忆一同使用 rag_synonym_search_top_k = 10 # 同义词搜索TopK rag_synonym_threshold = 0.8 # 同义词阈值(相似度高于此阈值的词语会被认为是同义词) info_extraction_workers = 3 # 实体提取同时执行线程数,非Pro模型不要设置超过5 @@ -594,6 +581,7 @@ config: max_length = 512 # 回复允许的最大长度 max_sentence_num = 8 # 回复允许的最大句子数 enable_kaomoji_protection = false # 是否启用颜文字保护 + enable_overflow_return_all = false # 是否在句子数量超出回复允许的最大句子数时一次性返回全部内容 [log] date_style = "m-d H:i:s" # 日期格式 @@ -611,6 +599,7 @@ config: show_prompt = false # 是否显示prompt show_replyer_prompt = false # 是否显示回复器prompt show_replyer_reasoning = false # 是否显示回复器推理 + show_jargon_prompt = false # 是否显示jargon相关提示词 [maim_message] auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 @@ -627,7 +616,15 @@ config: enable = true [experimental] #实验性功能 - none = false # 暂无 + # 为指定聊天添加额外的prompt配置 + # 格式: ["platform:id:type:prompt内容", ...] + # 示例: + # chat_prompts = [ + # "qq:114514:group:这是一个摄影群,你精通摄影知识", + # "qq:19198:group:这是一个二次元交流群", + # "qq:114514:private:这是你与好朋友的私聊" + # ] + chat_prompts = [] #此系统暂时移除,无效配置 From 0c46c0cb5fa36d535373052f9e5e506f98379cb1 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:37:47 +0800 Subject: [PATCH 107/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E7=9A=84=E5=AE=89=E8=A3=85=E6=8F=90=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/templates/NOTES.txt b/helm-chart/templates/NOTES.txt index d898adf3..ec8223df 100644 --- a/helm-chart/templates/NOTES.txt +++ b/helm-chart/templates/NOTES.txt @@ -1,3 +1,3 @@ MaiBot has been successfully deployed. -MaiBot on GitHub: https://github.com/MaiM-with-u/MaiBot +MaiBot on GitHub: https://github.com/Mai-with-u/MaiBot From 5a25bc425b84b1c4b6622be0167123d6768323d2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 17:39:17 +0800 Subject: [PATCH 108/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E7=9A=84adapter-cm-generator=E7=9A=84Python=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=BApython:3.13-slim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/adapter-cm-generator/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/adapter-cm-generator/Dockerfile b/helm-chart/adapter-cm-generator/Dockerfile index cd1f7747..355b7b81 100644 --- a/helm-chart/adapter-cm-generator/Dockerfile +++ b/helm-chart/adapter-cm-generator/Dockerfile @@ -1,5 +1,5 @@ # 此镜像用于在部署helm chart时动态生成adapter的配置文件 -FROM python:3.11-slim +FROM python:3.13-slim WORKDIR /app From d3c8cea00dbb97f545350f2c3d5bcaf252443df2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 18:00:58 +0800 Subject: [PATCH 109/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E9=95=9C=E5=83=8F=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index b660a3a5..6cbd9fb1 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -38,7 +38,7 @@ adapter: cm_generator: image: repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.11.1-beta + tag: # 默认 0.11.2-beta pullPolicy: IfNotPresent pullSecrets: [ ] From 02818eff15e79d92fe8458567848ce12545a8ea9 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Mon, 17 Nov 2025 18:01:43 +0800 Subject: [PATCH 110/142] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0helm=20chart?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/README.md b/helm-chart/README.md index 30c3d29b..c7f72686 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,6 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| +| 0.11.2-beta | 0.11.2-beta | d3c8cea00dbb97f545350f2c3d5bcaf252443df2 | | 0.11.1-beta | 0.11.1-beta | 94e079a340a43dff8a2bc178706932937fc10b11 | | 0.11.0-beta | 0.11.0-beta | 16059532d8ef87ac28e2be0838ff8b3a34a91d0f | | 0.10.3-beta | 0.10.3-beta | 7618937cd4fd0ab1a7bd8a31ab244a8b0742fced | From b4342d7f7fa5900f717cb3a2b685aa38349c9ce2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 19 Nov 2025 18:52:28 +0800 Subject: [PATCH 111/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E5=85=83=E4=BF=A1=E6=81=AF=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index bf6f4ace..0092f674 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.2-beta -appVersion: 0.11.2-beta +version: 0.11.3-beta +appVersion: 0.11.3-beta From 81476b3e3caa4a072fb4beb4fbb101affd9a0e60 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 19 Nov 2025 18:58:53 +0800 Subject: [PATCH 112/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E9=95=9C=E5=83=8F=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 4 ++-- .../templates/job-post-install/job-gen-adapter-cm.yaml | 2 +- helm-chart/templates/napcat/statefulset.yaml | 2 +- helm-chart/values.yaml | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index ca12dca0..2d5f6a68 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,7 +29,7 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.2-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.3-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 @@ -69,7 +69,7 @@ spec: command: - python3 workingDir: /MaiMBot - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.2-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.3-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} name: setup-plugins resources: { } diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml index 4a3a30e7..73e4c3dc 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.2-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.3-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index a6dd9771..ddf6c397 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.70" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.72" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 6cbd9fb1..5c015eff 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -38,7 +38,7 @@ adapter: cm_generator: image: repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.11.2-beta + tag: # 默认 0.11.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -48,7 +48,7 @@ core: image: repository: # 默认 sengokucola/maibot - tag: # 默认 0.11.2-beta + tag: # 默认 0.11.3-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -117,7 +117,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.70 + tag: # 默认 v4.9.72 pullPolicy: IfNotPresent pullSecrets: [ ] From cd6dc18f546f81e08803d3b8dba48e504dad9295 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 19 Nov 2025 19:03:38 +0800 Subject: [PATCH 113/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=20values=E4=B8=AD=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 5c015eff..14cbf2ff 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -227,7 +227,7 @@ config: # core的model_config.toml core_model_config: | [inner] - version = "1.7.7" + version = "1.7.8" # 配置文件版本号迭代规则同bot_config.toml @@ -388,7 +388,7 @@ config: # core的bot_config.toml core_bot_config: | [inner] - version = "6.21.4" + version = "6.21.6" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -493,7 +493,7 @@ config: include_planner_reasoning = false # 是否将planner推理加入replyer,默认关闭(不加入) [memory] - max_agent_iterations = 5 # 记忆思考深度(最低为1(不深入思考)) + max_agent_iterations = 3 # 记忆思考深度(最低为1(不深入思考)) [jargon] all_global = true # 是否开启全局黑话模式,注意,此功能关闭后,已经记录的全局黑话不会改变,需要手动删除 From 9fecf0eb20dc807bf722f72cd7d213187824f7d0 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 19 Nov 2025 19:05:15 +0800 Subject: [PATCH 114/142] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0helm=20chart?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=9A=84`0.11.3-beta`=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/README.md b/helm-chart/README.md index c7f72686..7c15d81f 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,6 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| +| 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 | | 0.11.2-beta | 0.11.2-beta | d3c8cea00dbb97f545350f2c3d5bcaf252443df2 | | 0.11.1-beta | 0.11.1-beta | 94e079a340a43dff8a2bc178706932937fc10b11 | | 0.11.0-beta | 0.11.0-beta | 16059532d8ef87ac28e2be0838ff8b3a34a91d0f | From 14514ba83765eb8fc3ffadf51d6bf9750f5e3fbe Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Thu, 20 Nov 2025 23:18:02 +0800 Subject: [PATCH 115/142] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0helm=20char?= =?UTF-8?q?t=E5=88=B00.11.5-beta=EF=BC=8C=E6=96=B0=E5=A2=9Ewebui=E7=9A=84s?= =?UTF-8?q?ervice=E5=92=8Cingress=E8=B5=84=E6=BA=90=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 +-- helm-chart/templates/core/configmap.yaml | 4 +++ helm-chart/templates/core/ingress.yaml | 26 +++++++++++++++++++ helm-chart/templates/core/service.yaml | 9 +++++++ helm-chart/templates/core/statefulset.yaml | 9 +++++-- .../job-post-install/job-gen-adapter-cm.yaml | 2 +- helm-chart/templates/napcat/statefulset.yaml | 2 +- helm-chart/values.yaml | 25 +++++++++++++++--- 8 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 helm-chart/templates/core/ingress.yaml diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 0092f674..ea75ef79 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.3-beta -appVersion: 0.11.3-beta +version: 0.11.5-beta +appVersion: 0.11.5-beta diff --git a/helm-chart/templates/core/configmap.yaml b/helm-chart/templates/core/configmap.yaml index 25f0ef2d..98dadea8 100644 --- a/helm-chart/templates/core/configmap.yaml +++ b/helm-chart/templates/core/configmap.yaml @@ -7,6 +7,10 @@ data: .env: | HOST=0.0.0.0 PORT=8000 + WEBUI_ENABLED={{ if .Values.core.webui.enabled }}true{{ else }}false{{ end }} + WEBUI_MODE=production + WEBUI_HOST=0.0.0.0 + WEBUI_PORT=8001 model_config.toml: | {{ .Values.config.core_model_config | nindent 4 }} bot_config.toml: | diff --git a/helm-chart/templates/core/ingress.yaml b/helm-chart/templates/core/ingress.yaml new file mode 100644 index 00000000..203626d6 --- /dev/null +++ b/helm-chart/templates/core/ingress.yaml @@ -0,0 +1,26 @@ +{{- if and .Values.core.webui.enabled .Values.core.webui.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-maibot-webui + namespace: {{ .Release.Namespace }} + {{- if .Values.core.webui.ingress.annotations }} + annotations: + {{ toYaml .Values.core.webui.ingress.annotations | nindent 4 }} + {{- end }} + labels: + app: {{ .Release.Name }}-maibot-core +spec: + ingressClassName: {{ .Values.core.webui.ingress.className }} + rules: + - host: {{ .Values.core.webui.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-maibot-core + port: + number: {{ .Values.core.webui.service.port }} + path: {{ .Values.core.webui.ingress.path }} + pathType: {{ .Values.core.webui.ingress.pathType }} +{{- end }} diff --git a/helm-chart/templates/core/service.yaml b/helm-chart/templates/core/service.yaml index c236e746..5b67de50 100644 --- a/helm-chart/templates/core/service.yaml +++ b/helm-chart/templates/core/service.yaml @@ -11,6 +11,15 @@ spec: port: 8000 protocol: TCP targetPort: 8000 + {{- if .Values.core.webui.enabled }} + - name: webui + port: {{ .Values.core.webui.service.port }} + protocol: TCP + targetPort: 8001 + {{- if eq .Values.core.webui.service.type "NodePort" }} + nodePort: {{ .Values.core.webui.service.nodePort | default nil }} + {{- end }} + {{- end }} selector: app: {{ .Release.Name }}-maibot-core type: ClusterIP diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 2d5f6a68..d841c989 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,12 +29,17 @@ spec: value: 99f08e0cab0190de853cb6af7d64d4de - name: PRIVACY_AGREE value: 9943b855e72199d0f5016ea39052f1b6 - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.3-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.5-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 name: adapter-ws protocol: TCP + {{- if .Values.core.webui.enabled }} + - containerPort: 8001 + name: webui + protocol: TCP + {{- end }} {{- if .Values.core.resources }} resources: {{ toYaml .Values.core.resources | nindent 12 }} @@ -69,7 +74,7 @@ spec: command: - python3 workingDir: /MaiMBot - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.3-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.5-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} name: setup-plugins resources: { } diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml index 73e4c3dc..bbc49c83 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.3-beta" }} + image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.5-beta" }} workingDir: /app env: - name: PYTHONUNBUFFERED diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index ddf6c397..7cca56df 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.72" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.73" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 14cbf2ff..5f32b1c1 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -38,7 +38,7 @@ adapter: cm_generator: image: repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.11.3-beta + tag: # 默认 0.11.5-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -48,7 +48,7 @@ core: image: repository: # 默认 sengokucola/maibot - tag: # 默认 0.11.3-beta + tag: # 默认 0.11.5-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -65,6 +65,20 @@ core: setup_default_plugins: true # 启用一个初始化容器,用于为用户自动安装默认插件到存储卷中 + webui: # WebUI相关配置 + enabled: true # 默认启用 + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 + port: 8001 # 服务端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + ingress: + enabled: false + className: nginx + annotations: { } + host: maim.example.com # 访问麦麦WebUI的域名 + path: / + pathType: Prefix + # 麦麦的运行统计看板配置 # 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以作为静态网页访问 # 此功能默认禁用。如果你认为报告可以被公开访问(报告包含联系人/群组名称、模型token花费信息等),则可以启用此功能 @@ -117,7 +131,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.72 + tag: # 默认 v4.9.73 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -388,7 +402,7 @@ config: # core的bot_config.toml core_bot_config: | [inner] - version = "6.21.6" + version = "6.21.8" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -600,6 +614,9 @@ config: show_replyer_prompt = false # 是否显示回复器prompt show_replyer_reasoning = false # 是否显示回复器推理 show_jargon_prompt = false # 是否显示jargon相关提示词 + show_memory_prompt = false # 是否显示记忆检索相关提示词 + show_planner_prompt = false # 是否显示planner的prompt和原始返回结果 + show_lpmm_paragraph = false # 是否显示lpmm找到的相关文段日志 [maim_message] auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 From 4f6e159000b5a811a139045fc0519dc3a878317a Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 01:38:50 +0800 Subject: [PATCH 116/142] =?UTF-8?q?feat:=20=E4=B8=BAhelm=20chart=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0WebUI=E7=9A=84=E8=BE=85=E5=8A=A9=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=8F=8D=E5=90=91=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=B0ConfigMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 65 +++++--------- helm-chart/.helmignore | 1 + helm-chart/adapter-cm-generator/Dockerfile | 2 +- helm-chart/core-webui-cm-sync/Dockerfile | 10 +++ .../core-webui-cm-sync/core-webui-cm-sync.py | 89 +++++++++++++++++++ .../core-webui-cm-sync/requirements.txt | 3 + helm-chart/files/k8s-init.sh | 56 ++++++++++++ helm-chart/files/volume-linker.sh | 33 ------- helm-chart/templates/core/statefulset.yaml | 44 +++++++-- .../templates/other/configmap-scripts.yaml | 4 +- .../job-gen-adapter-cm.yaml | 2 +- .../rbac.yaml} | 12 +-- helm-chart/values.yaml | 5 ++ 13 files changed, 232 insertions(+), 94 deletions(-) create mode 100644 helm-chart/core-webui-cm-sync/Dockerfile create mode 100644 helm-chart/core-webui-cm-sync/core-webui-cm-sync.py create mode 100644 helm-chart/core-webui-cm-sync/requirements.txt create mode 100644 helm-chart/files/k8s-init.sh delete mode 100644 helm-chart/files/volume-linker.sh rename helm-chart/templates/{job-post-install => other}/job-gen-adapter-cm.yaml (93%) rename helm-chart/templates/{job-post-install/rbac-gen-adapter-cm.yaml => other/rbac.yaml} (64%) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index e10b203a..57d17a4a 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -1,7 +1,6 @@ stages: -# - initialize-maibot-git-repo - - build - - package + - build-image + - package-helm-chart # 仅在helm-chart分支运行 workflow: @@ -9,45 +8,9 @@ workflow: - if: '$CI_COMMIT_BRANCH == "helm-chart"' - when: never -## 查询并将麦麦仓库的工作区置为最后一个tag的版本 -#initialize-maibot-git-repo: -# stage: initialize-maibot-git-repo -# image: reg.mikumikumi.xyz/base/git:latest -# cache: -# key: git-repo -# policy: push -# paths: -# - target-repo/ -# script: -# - git clone https://github.com/Mai-with-u/MaiBot.git target-repo/ -# - cd target-repo/ -# - export MAIBOT_VERSION=$(git describe --tags --abbrev=0) -# - echo "Current version is ${MAIBOT_VERSION}" -# - git reset --hard ${MAIBOT_VERSION} -# - echo ${MAIBOT_VERSION} > MAIBOT_VERSION -# - git clone https://github.com/MaiM-with-u/maim_message maim_message -# - git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM -# - ls -al -# -## 构建最后一个tag的麦麦本体的镜像 -#build-core: -# stage: build -# image: reg.mikumikumi.xyz/base/kaniko-builder:latest -# cache: -# key: git-repo -# policy: pull -# paths: -# - target-repo/ -# script: -# - cd target-repo/ -# - export BUILD_CONTEXT=$(pwd) -# - ls -al -# - export BUILD_DESTINATION="reg.mikumikumi.xyz/maibot/maibot:tag-$(cat MAIBOT_VERSION)" -# - build - -# 将Helm Chart版本作为tag,构建并推送镜像 +# 构建并推送adapter-cm-generator镜像 build-adapter-cm-generator: - stage: build + stage: build-image image: reg.mikumikumi.xyz/base/kaniko-builder:latest # rules: # - changes: @@ -60,15 +23,33 @@ build-adapter-cm-generator: - export BUILD_ARGS="--destination ${TMP_DST}:latest" - build +# 构建并推送core-webui-cm-sync镜像 +build-core-webui-cm-sync: + stage: build-image + image: reg.mikumikumi.xyz/base/kaniko-builder:latest +# rules: +# - changes: +# - helm-chart/core-webui-cm-sync/** + script: + - export BUILD_CONTEXT=helm-chart/core-webui-cm-sync + - export TMP_DST=reg.mikumikumi.xyz/maibot/core-webui-cm-sync + - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) + - export BUILD_DESTINATION="${TMP_DST}:${CHART_VERSION}" + - export BUILD_ARGS="--destination ${TMP_DST}:latest" + - build + # 打包并推送helm chart package-helm-chart: - stage: package + stage: package-helm-chart image: reg.mikumikumi.xyz/mirror/helm:latest # rules: # - changes: # - helm-chart/files/** # - helm-chart/templates/** +# - helm-chart/.gitignore +# - helm-chart/.helmignore # - helm-chart/Chart.yaml +# - helm-chart/README.md # - helm-chart/values.yaml script: - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) diff --git a/helm-chart/.helmignore b/helm-chart/.helmignore index 8cb2bba7..d4fe42ef 100644 --- a/helm-chart/.helmignore +++ b/helm-chart/.helmignore @@ -1,2 +1,3 @@ adapter-cm-generator +core-webui-cm-sync .gitlab-ci.yml \ No newline at end of file diff --git a/helm-chart/adapter-cm-generator/Dockerfile b/helm-chart/adapter-cm-generator/Dockerfile index 355b7b81..3149f0f5 100644 --- a/helm-chart/adapter-cm-generator/Dockerfile +++ b/helm-chart/adapter-cm-generator/Dockerfile @@ -5,6 +5,6 @@ WORKDIR /app COPY . /app -RUN pip3 install --no-cache-dir -i https://mirrors.ustc.edu.cn/pypi/simple -r requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt ENTRYPOINT ["python3", "adapter-cm-generator.py"] diff --git a/helm-chart/core-webui-cm-sync/Dockerfile b/helm-chart/core-webui-cm-sync/Dockerfile new file mode 100644 index 00000000..55a8c25b --- /dev/null +++ b/helm-chart/core-webui-cm-sync/Dockerfile @@ -0,0 +1,10 @@ +# 此镜像用于辅助麦麦的WebUI更新配置文件,随core容器持续运行 +FROM python:3.13-slim + +WORKDIR /MaiMBot + +COPY . /MaiMBot + +RUN pip3 install --no-cache-dir -r requirements.txt + +ENTRYPOINT ["python3", "core-webui-cm-sync.py"] diff --git a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py new file mode 100644 index 00000000..6b95d830 --- /dev/null +++ b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py @@ -0,0 +1,89 @@ +#!/bin/python3 +# 这个程序的作用是辅助麦麦的WebUI更新配置文件,随core容器持续运行。 +# 麦麦的配置文件存储于ConfigMap中,挂载进core容器后属于只读文件,无法直接修改。 +# 此程序将core容器内的配置文件替换为可读写的中间层临时文件。启动时将实际配置文件写入,并在后台持续检测文件变化,实时同步到k8s apiServer,反向修改ConfigMap。 +# 工作目录:/MaiMBot/webui-cm-sync + +import os +import time +from datetime import datetime +from kubernetes import client, config +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +work_dir = '/MaiMBot/webui-cm-sync' +os.chdir(work_dir) + +config.load_incluster_config() +core_api = client.CoreV1Api() +with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f: + namespace = f.read().strip() +release_name = os.getenv("RELEASE_NAME") +configmap_name = f'{release_name}-maibot-core' + +# 过滤列表,只监控指定文件 +target_files = { + os.path.abspath("model_config.toml"): "model_config.toml", + os.path.abspath("bot_config.toml"): "bot_config.toml" +} + + +def get_configmap(): + """获取core的ConfigMap内容""" + cm = core_api.read_namespaced_config_map(name=configmap_name, namespace=namespace) + return cm.data + + +def set_configmap(configmap_data: dict[str, str]): + """设置core的ConfigMap内容""" + core_api.patch_namespaced_config_map(configmap_name, namespace, {'data': configmap_data}) + + +class ConfigObserverHandler(FileSystemEventHandler): + """配置文件变化的事件处理器""" + def on_modified(self, event): + if os.path.abspath(event.src_path) in target_files: + print( + f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. Start to sync...') + with open(event.src_path, "r", encoding="utf-8") as _f: + current_data = _f.read() + new_cm = { + target_files[os.path.abspath("model_config.toml")]: current_data + } + try: + set_configmap(new_cm) + except client.exceptions.ApiException as _e: + print(f'\tError while setting configmap:\n' + f'\t\tStatus Code: {_e.status}\n' + f'\t\tReason: {_e.reason}') + + +if __name__ == '__main__': + # 初始化配置文件 + print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] Initializing config files...') + try: + __initial_model_config = get_configmap()['model_config.toml'] + __initial_bot_config = get_configmap()['bot_config.toml'] + except client.exceptions.ApiException as e: + print(f'\tError while getting configmap:\n' + f'\t\tStatus Code: {e.status}\n' + f'\t\tReason: {e.reason}') + exit(1) + with open('model_config.toml', 'w') as f: + f.write(__initial_model_config) + with open('bot_config.toml', 'w') as f: + f.write(__initial_bot_config) + with open('ready', 'w') as f: + f.write('true') + print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] Initializing done. Ready to sync.') + + # 持续检测变化并同步 + observer = Observer() + observer.schedule(ConfigObserverHandler(), '', recursive=False) + observer.start() + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() + observer.join() diff --git a/helm-chart/core-webui-cm-sync/requirements.txt b/helm-chart/core-webui-cm-sync/requirements.txt new file mode 100644 index 00000000..58c73d28 --- /dev/null +++ b/helm-chart/core-webui-cm-sync/requirements.txt @@ -0,0 +1,3 @@ +toml~=0.10.2 +kubernetes~=34.1.0 +watchdog~=6.0.0 diff --git a/helm-chart/files/k8s-init.sh b/helm-chart/files/k8s-init.sh new file mode 100644 index 00000000..0fc26dea --- /dev/null +++ b/helm-chart/files/k8s-init.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# 此脚本用于覆盖core容器的默认启动命令,进行一些初始化 +# 1 +# 由于k8s与docker-compose的卷挂载方式有所不同,需要利用此脚本为一些文件和目录提前创建好软链接 +# /MaiMBot/data是麦麦数据的实际挂载路径 +# /MaiMBot/statistics是统计数据的实际挂载路径 +# 2 +# 此脚本等待辅助容器webui-cm-sync就绪后再启动麦麦 +# 通过检测/MaiMBot/webui-cm-sync/ready文件来判断 + +set -e +echo "[K8s Init] Preparing volume..." + +# 初次启动,在存储卷中检查并创建关键文件和目录 +mkdir -p /MaiMBot/data/plugins +mkdir -p /MaiMBot/data/logs +if [ ! -d "/MaiMBot/statistics" ] +then + echo "[K8s Init] Statistics volume disabled." +else + touch /MaiMBot/statistics/index.html +fi + +# 删除默认插件目录,准备创建用户插件目录软链接 +rm -rf /MaiMBot/plugins + +# 创建软链接,从存储卷链接到实际位置 +ln -s /MaiMBot/data/plugins /MaiMBot/plugins +ln -s /MaiMBot/data/logs /MaiMBot/logs +if [ -f "/MaiMBot/statistics/index.html" ] +then + ln -s /MaiMBot/statistics/index.html /MaiMBot/maibot_statistics.html +fi + +echo "[K8s Init] Volume ready." + +# 如果启用了WebUI,则等待辅助容器webui-cm-sync就绪,然后创建中间层配置文件软链接 +if [ "$MAIBOT_WEBUI_ENABLED" = "true" ] +then + echo "[K8s Init] WebUI enabled. Waiting for container 'webui-cm-sync' ready..." + while [ ! -f /MaiMBot/webui-cm-sync/ready ]; do + sleep 1 + done + echo "[K8s Init] Container 'webui-cm-sync' ready." + mkdir -p /MaiMBot/config + ln -s /MaiMBot/webui-cm-sync/model_config.toml /MaiMBot/config/model_config.toml + ln -s /MaiMBot/webui-cm-sync/bot_config.toml /MaiMBot/config/bot_config.toml + echo "[K8s Init] Config files middle layer for WebUI created." +else + echo "[K8s Init] WebUI disabled." +fi + +# 启动麦麦 +echo "[K8s Init] Waking up MaiBot..." +echo +exec python bot.py diff --git a/helm-chart/files/volume-linker.sh b/helm-chart/files/volume-linker.sh deleted file mode 100644 index 4a371e3c..00000000 --- a/helm-chart/files/volume-linker.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# 此脚本用于覆盖core容器的默认启动命令 -# 由于k8s与docker-compose的卷挂载方式有所不同,需要利用此脚本为一些文件和目录提前创建好软链接 -# /MaiMBot/data是麦麦数据的实际挂载路径 -# /MaiMBot/statistics是统计数据的实际挂载路径 - -set -e -echo "[VolumeLinker] Preparing volume..." - -# 初次启动,在存储卷中检查并创建关键文件和目录 -mkdir -p /MaiMBot/data/plugins -mkdir -p /MaiMBot/data/logs -if [ ! -d "/MaiMBot/statistics" ] -then - echo "[VolumeLinker] Statistics volume disabled." -else - touch /MaiMBot/statistics/index.html -fi - -# 删除空的插件目录,准备创建软链接 -rm -rf /MaiMBot/plugins - -# 创建软链接,从存储卷链接到实际位置 -ln -s /MaiMBot/data/plugins /MaiMBot/plugins -ln -s /MaiMBot/data/logs /MaiMBot/logs -if [ -f "/MaiMBot/statistics/index.html" ] -then - ln -s /MaiMBot/statistics/index.html /MaiMBot/maibot_statistics.html -fi - -# 启动麦麦 -echo "[VolumeLinker] Starting MaiBot..." -exec python bot.py diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index d841c989..248f6a73 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -18,17 +18,21 @@ spec: spec: containers: - name: core - command: # 为了在k8s中初始化存储卷,这里替换启动命令为指定脚本 + command: # 为了在k8s中初始化,这里替换启动命令为指定脚本 - sh args: - - /MaiMBot/volume-linker.sh + - /MaiMBot/k8s-init.sh env: - name: TZ - value: Asia/Shanghai + value: "Asia/Shanghai" - name: EULA_AGREE - value: 99f08e0cab0190de853cb6af7d64d4de + value: "99f08e0cab0190de853cb6af7d64d4de" - name: PRIVACY_AGREE - value: 9943b855e72199d0f5016ea39052f1b6 + value: "9943b855e72199d0f5016ea39052f1b6" + {{- if .Values.core.webui.enabled }} + - name: MAIBOT_WEBUI_ENABLED + value: "true" + {{- end}} image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.5-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: @@ -47,14 +51,15 @@ spec: volumeMounts: - mountPath: /MaiMBot/data name: data - - mountPath: /MaiMBot/volume-linker.sh + - mountPath: /MaiMBot/k8s-init.sh name: scripts readOnly: true - subPath: volume-linker.sh + subPath: k8s-init.sh - mountPath: /MaiMBot/.env name: config readOnly: true subPath: .env + {{- if not .Values.core.webui.enabled }} - mountPath: /MaiMBot/config/model_config.toml name: config readOnly: true @@ -63,10 +68,26 @@ spec: name: config readOnly: true subPath: bot_config.toml + {{- end }} {{- if .Values.statistics_dashboard.enabled }} - mountPath: /MaiMBot/statistics name: statistics {{- end }} + {{- if .Values.core.webui.enabled }} + - mountPath: /MaiMBot/webui-cm-sync + name: webui-cm-sync + {{- end }} + {{- if .Values.core.webui.enabled }} + - name: webui-cm-sync + image: {{ .Values.core.webui.cm_sync.image.repository | default "reg.mikumikumi.xyz/maibot/core-webui-cm-sync" }}:{{ .Values.core.webui.cm_sync.image.tag | default "0.11.5-beta" }} + imagePullPolicy: {{ .Values.core.webui.cm_sync.image.pullPolicy }} + env: + - name: RELEASE_NAME + value: {{ .Release.Name }} + volumeMounts: + - mountPath: /MaiMBot/webui-cm-sync + name: webui-cm-sync + {{- end }} {{- if .Values.core.setup_default_plugins }} initContainers: # 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此初始化容器用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 - args: @@ -86,6 +107,7 @@ spec: readOnly: true subPath: setup-plugins.py {{- end }} + serviceAccountName: {{ .Release.Name }}-maibot-sa {{- if .Values.core.image.pullSecrets }} imagePullSecrets: {{ toYaml .Values.core.image.pullSecrets | nindent 8 }} @@ -104,8 +126,8 @@ spec: claimName: {{ .Release.Name }}-maibot-core - configMap: items: - - key: volume-linker.sh - path: volume-linker.sh + - key: k8s-init.sh + path: k8s-init.sh {{- if .Values.core.setup_default_plugins }} - key: setup-plugins.py path: setup-plugins.py @@ -127,3 +149,7 @@ spec: persistentVolumeClaim: claimName: {{ .Release.Name }}-maibot-statistics-dashboard {{- end }} + {{- if .Values.core.webui.enabled }} + - emptyDir: {} + name: webui-cm-sync + {{- end }} diff --git a/helm-chart/templates/other/configmap-scripts.yaml b/helm-chart/templates/other/configmap-scripts.yaml index 4d1e546f..dd61ca68 100644 --- a/helm-chart/templates/other/configmap-scripts.yaml +++ b/helm-chart/templates/other/configmap-scripts.yaml @@ -5,8 +5,8 @@ metadata: namespace: {{ .Release.Namespace }} data: # core - volume-linker.sh: | - {{ .Files.Get "files/volume-linker.sh" | nindent 4 }} + k8s-init.sh: | + {{ .Files.Get "files/k8s-init.sh" | nindent 4 }} # core的初始化容器 {{- if .Values.core.setup_default_plugins }} setup-plugins.py: | diff --git a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml b/helm-chart/templates/other/job-gen-adapter-cm.yaml similarity index 93% rename from helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml rename to helm-chart/templates/other/job-gen-adapter-cm.yaml index bbc49c83..ad01b568 100644 --- a/helm-chart/templates/job-post-install/job-gen-adapter-cm.yaml +++ b/helm-chart/templates/other/job-gen-adapter-cm.yaml @@ -11,7 +11,7 @@ spec: backoffLimit: 2 template: spec: - serviceAccountName: {{ .Release.Name }}-maibot-adapter-cm-generator + serviceAccountName: {{ .Release.Name }}-maibot-sa restartPolicy: Never containers: - name: adapter-cm-generator diff --git a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml b/helm-chart/templates/other/rbac.yaml similarity index 64% rename from helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml rename to helm-chart/templates/other/rbac.yaml index 1df08343..8b8075c7 100644 --- a/helm-chart/templates/job-post-install/rbac-gen-adapter-cm.yaml +++ b/helm-chart/templates/other/rbac.yaml @@ -1,14 +1,14 @@ -# 动态生成adapter配置文件的configmap所需要的rbac授权 +# 初始化及反向修改ConfigMap所需要的rbac授权 apiVersion: v1 kind: ServiceAccount metadata: - name: {{ .Release.Name }}-maibot-adapter-cm-generator + name: {{ .Release.Name }}-maibot-sa namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ .Release.Name }}-maibot-adapter-cm-gen-role + name: {{ .Release.Name }}-maibot-role namespace: {{ .Release.Namespace }} rules: - apiGroups: [""] @@ -21,13 +21,13 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ .Release.Name }}-maibot-adapter-cm-gen-role-binding + name: {{ .Release.Name }}-maibot-rolebinding namespace: {{ .Release.Namespace }} subjects: - kind: ServiceAccount - name: {{ .Release.Name }}-maibot-adapter-cm-generator + name: {{ .Release.Name }}-maibot-sa namespace: {{ .Release.Namespace }} roleRef: kind: Role - name: {{ .Release.Name }}-maibot-adapter-cm-gen-role + name: {{ .Release.Name }}-maibot-role apiGroup: rbac.authorization.k8s.io diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 5f32b1c1..16ba0bc7 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -67,6 +67,11 @@ core: webui: # WebUI相关配置 enabled: true # 默认启用 + cm_sync: # WebUI的辅助容器配置 + image: + repository: # 默认 reg.mikumikumi.xyz/maibot/core-webui-cm-sync + tag: # 默认 0.11.5-beta + pullPolicy: IfNotPresent service: type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 port: 8001 # 服务端口 From 504121f756863f11a12ade84544210554de18d2a Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 01:58:09 +0800 Subject: [PATCH 117/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhelm=20chart?= =?UTF-8?q?=E7=9A=84core-webui-cm-sync=E7=9A=84=E7=A9=BA=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 4 ++++ helm-chart/core-webui-cm-sync/core-webui-cm-sync.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 57d17a4a..55c9c825 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -12,6 +12,8 @@ workflow: build-adapter-cm-generator: stage: build-image image: reg.mikumikumi.xyz/base/kaniko-builder:latest + variables: + BUILD_NO_CACHE: true # rules: # - changes: # - helm-chart/adapter-cm-generator/** @@ -27,6 +29,8 @@ build-adapter-cm-generator: build-core-webui-cm-sync: stage: build-image image: reg.mikumikumi.xyz/base/kaniko-builder:latest + variables: + BUILD_NO_CACHE: true # rules: # - changes: # - helm-chart/core-webui-cm-sync/** diff --git a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py index 6b95d830..8d39d1e7 100644 --- a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py +++ b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py @@ -79,7 +79,7 @@ if __name__ == '__main__': # 持续检测变化并同步 observer = Observer() - observer.schedule(ConfigObserverHandler(), '', recursive=False) + observer.schedule(ConfigObserverHandler(), work_dir, recursive=False) observer.start() try: while True: From 4c9b1f8302c7da37a6ca83c6ce479f771526e8f6 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 02:12:24 +0800 Subject: [PATCH 118/142] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8helm=20chart?= =?UTF-8?q?=E7=9A=84core-webui-cm-sync=E7=9A=84=E8=BE=93=E5=87=BA=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 248f6a73..1127021b 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -82,6 +82,8 @@ spec: image: {{ .Values.core.webui.cm_sync.image.repository | default "reg.mikumikumi.xyz/maibot/core-webui-cm-sync" }}:{{ .Values.core.webui.cm_sync.image.tag | default "0.11.5-beta" }} imagePullPolicy: {{ .Values.core.webui.cm_sync.image.pullPolicy }} env: + - name: PYTHONUNBUFFERED + value: "1" - name: RELEASE_NAME value: {{ .Release.Name }} volumeMounts: From f558bc191d3ba8a8763ea021a670a6687e08fe6a Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 02:30:58 +0800 Subject: [PATCH 119/142] =?UTF-8?q?change:=20=E4=BC=98=E5=8C=96helm=20char?= =?UTF-8?q?t=E7=9A=84k8s-init.sh=E5=92=8Ccore-webui-cm-sync.py=E7=9A=84?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/core-webui-cm-sync/core-webui-cm-sync.py | 5 +++-- helm-chart/files/k8s-init.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py index 8d39d1e7..49037f93 100644 --- a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py +++ b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py @@ -43,8 +43,8 @@ class ConfigObserverHandler(FileSystemEventHandler): """配置文件变化的事件处理器""" def on_modified(self, event): if os.path.abspath(event.src_path) in target_files: - print( - f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. Start to sync...') + print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. ' + f'Start to sync...') with open(event.src_path, "r", encoding="utf-8") as _f: current_data = _f.read() new_cm = { @@ -52,6 +52,7 @@ class ConfigObserverHandler(FileSystemEventHandler): } try: set_configmap(new_cm) + print(f'\tSync done.') except client.exceptions.ApiException as _e: print(f'\tError while setting configmap:\n' f'\t\tStatus Code: {_e.status}\n' diff --git a/helm-chart/files/k8s-init.sh b/helm-chart/files/k8s-init.sh index 0fc26dea..3729a68f 100644 --- a/helm-chart/files/k8s-init.sh +++ b/helm-chart/files/k8s-init.sh @@ -16,7 +16,7 @@ mkdir -p /MaiMBot/data/plugins mkdir -p /MaiMBot/data/logs if [ ! -d "/MaiMBot/statistics" ] then - echo "[K8s Init] Statistics volume disabled." + echo "[K8s Init] Statistics volume is disabled." else touch /MaiMBot/statistics/index.html fi @@ -47,7 +47,7 @@ then ln -s /MaiMBot/webui-cm-sync/bot_config.toml /MaiMBot/config/bot_config.toml echo "[K8s Init] Config files middle layer for WebUI created." else - echo "[K8s Init] WebUI disabled." + echo "[K8s Init] WebUI is disabled." fi # 启动麦麦 From 95a4e9d8fe6afdf5980c98bb9a28e79ee7c7a1a1 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 03:48:34 +0800 Subject: [PATCH 120/142] =?UTF-8?q?feat:=20=E4=B8=BAhelm=20chart=E5=85=BC?= =?UTF-8?q?=E5=AE=B9WebUI=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E9=85=8D=E7=BD=AE=E7=9A=84=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter-cm-generator.py | 2 +- .../core-webui-cm-sync/core-webui-cm-sync.py | 20 ++++++++++--------- helm-chart/templates/adapter/statefulset.yaml | 2 +- .../templates/core/configmap-bot-config.yaml | 12 +++++++++++ ...nfigmap.yaml => configmap-env-config.yaml} | 6 +----- .../core/configmap-model-config.yaml | 12 +++++++++++ helm-chart/templates/core/statefulset.yaml | 18 ++++++++++++----- helm-chart/values.yaml | 7 ++++++- 8 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 helm-chart/templates/core/configmap-bot-config.yaml rename helm-chart/templates/core/{configmap.yaml => configmap-env-config.yaml} (59%) create mode 100644 helm-chart/templates/core/configmap-model-config.yaml diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py index e860aff3..95d7b65b 100644 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ b/helm-chart/adapter-cm-generator/adapter-cm-generator.py @@ -29,7 +29,7 @@ data['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release data['maibot_server']['port'] = 8000 # 创建/修改configmap -cm_name = f'{release_name}-maibot-adapter' +cm_name = f'{release_name}-maibot-adapter-config' cm = client.V1ConfigMap( metadata=client.V1ObjectMeta(name=cm_name), data={'config.toml': toml.dumps(data)} diff --git a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py index 49037f93..e179d6f6 100644 --- a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py +++ b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py @@ -19,22 +19,23 @@ core_api = client.CoreV1Api() with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f: namespace = f.read().strip() release_name = os.getenv("RELEASE_NAME") -configmap_name = f'{release_name}-maibot-core' +model_configmap_name = f'{release_name}-maibot-core-model-config' +bot_configmap_name = f'{release_name}-maibot-core-bot-config' # 过滤列表,只监控指定文件 target_files = { - os.path.abspath("model_config.toml"): "model_config.toml", - os.path.abspath("bot_config.toml"): "bot_config.toml" + os.path.abspath("model_config.toml"): (model_configmap_name, "model_config.toml"), + os.path.abspath("bot_config.toml"): (bot_configmap_name, "bot_config.toml") } -def get_configmap(): +def get_configmap(configmap_name: str): """获取core的ConfigMap内容""" cm = core_api.read_namespaced_config_map(name=configmap_name, namespace=namespace) return cm.data -def set_configmap(configmap_data: dict[str, str]): +def set_configmap(configmap_name: str, configmap_data: dict[str, str]): """设置core的ConfigMap内容""" core_api.patch_namespaced_config_map(configmap_name, namespace, {'data': configmap_data}) @@ -47,11 +48,12 @@ class ConfigObserverHandler(FileSystemEventHandler): f'Start to sync...') with open(event.src_path, "r", encoding="utf-8") as _f: current_data = _f.read() + _path = str(os.path.abspath(event.src_path)) new_cm = { - target_files[os.path.abspath("model_config.toml")]: current_data + target_files[_path][1]: current_data } try: - set_configmap(new_cm) + set_configmap(target_files[_path][0], new_cm) print(f'\tSync done.') except client.exceptions.ApiException as _e: print(f'\tError while setting configmap:\n' @@ -63,8 +65,8 @@ if __name__ == '__main__': # 初始化配置文件 print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] Initializing config files...') try: - __initial_model_config = get_configmap()['model_config.toml'] - __initial_bot_config = get_configmap()['bot_config.toml'] + __initial_model_config = get_configmap(model_configmap_name)['model_config.toml'] + __initial_bot_config = get_configmap(bot_configmap_name)['bot_config.toml'] except client.exceptions.ApiException as e: print(f'\tError while getting configmap:\n' f'\t\tStatus Code: {e.status}\n' diff --git a/helm-chart/templates/adapter/statefulset.yaml b/helm-chart/templates/adapter/statefulset.yaml index 262891b4..0d9b76da 100644 --- a/helm-chart/templates/adapter/statefulset.yaml +++ b/helm-chart/templates/adapter/statefulset.yaml @@ -58,5 +58,5 @@ spec: items: - key: config.toml path: config.toml - name: {{ .Release.Name }}-maibot-adapter + name: {{ .Release.Name }}-maibot-adapter-config name: config diff --git a/helm-chart/templates/core/configmap-bot-config.yaml b/helm-chart/templates/core/configmap-bot-config.yaml new file mode 100644 index 00000000..447b3396 --- /dev/null +++ b/helm-chart/templates/core/configmap-bot-config.yaml @@ -0,0 +1,12 @@ +{{- if or .Release.IsInstall .Values.config.enable_config_override }} +# 渲染规则: +# 初次安装,或配置了覆盖规则 +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-core-bot-config + namespace: {{ .Release.Namespace }} +data: + bot_config.toml: | + {{ .Values.config.core_bot_config | nindent 4 }} +{{- end }} diff --git a/helm-chart/templates/core/configmap.yaml b/helm-chart/templates/core/configmap-env-config.yaml similarity index 59% rename from helm-chart/templates/core/configmap.yaml rename to helm-chart/templates/core/configmap-env-config.yaml index 98dadea8..17b1d627 100644 --- a/helm-chart/templates/core/configmap.yaml +++ b/helm-chart/templates/core/configmap-env-config.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-maibot-core + name: {{ .Release.Name }}-maibot-core-env-config namespace: {{ .Release.Namespace }} data: .env: | @@ -11,7 +11,3 @@ data: WEBUI_MODE=production WEBUI_HOST=0.0.0.0 WEBUI_PORT=8001 - model_config.toml: | - {{ .Values.config.core_model_config | nindent 4 }} - bot_config.toml: | - {{ .Values.config.core_bot_config | nindent 4 }} diff --git a/helm-chart/templates/core/configmap-model-config.yaml b/helm-chart/templates/core/configmap-model-config.yaml new file mode 100644 index 00000000..97c435ff --- /dev/null +++ b/helm-chart/templates/core/configmap-model-config.yaml @@ -0,0 +1,12 @@ +{{- if or .Release.IsInstall .Values.config.enable_config_override }} +# 渲染规则: +# 初次安装,或配置了覆盖规则 +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-core-model-config + namespace: {{ .Release.Namespace }} +data: + model_config.toml: | + {{ .Values.config.core_model_config | nindent 4 }} +{{- end }} diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 1127021b..db8cda78 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -56,16 +56,16 @@ spec: readOnly: true subPath: k8s-init.sh - mountPath: /MaiMBot/.env - name: config + name: env-config readOnly: true subPath: .env {{- if not .Values.core.webui.enabled }} - mountPath: /MaiMBot/config/model_config.toml - name: config + name: model-config readOnly: true subPath: model_config.toml - mountPath: /MaiMBot/config/bot_config.toml - name: config + name: bot-config readOnly: true subPath: bot_config.toml {{- end }} @@ -140,12 +140,20 @@ spec: items: - key: .env path: .env + name: {{ .Release.Name }}-maibot-core-env-config + name: env-config + - configMap: + items: - key: model_config.toml path: model_config.toml + name: {{ .Release.Name }}-maibot-core-model-config + name: model-config + - configMap: + items: - key: bot_config.toml path: bot_config.toml - name: {{ .Release.Name }}-maibot-core - name: config + name: {{ .Release.Name }}-maibot-core-bot-config + name: bot-config {{- if .Values.statistics_dashboard.enabled }} - name: statistics persistentVolumeClaim: diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 16ba0bc7..c9ac969a 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -208,9 +208,14 @@ sqlite_web: path: / pathType: Prefix -# 麦麦各部分组件的运行配置文件 +# 手动设置麦麦各部分组件的运行配置文件 config: + # 启用WebUI后,配置文件的修改即可在WebUI进行。如果通过WebUI修改了配置,则实际的配置文件将与values中的配置存在差异。 + # 为了避免helm升级麦麦时,下面values中的配置覆盖掉已有的配置文件而导致配置丢失,可以在这里禁止本次部署时的配置覆盖。 + # 注:由于adapter的配置无法通过WebUI修改,因此下面的adapter_config配置仍然会覆盖已有配置文件。 + enable_config_override: true # 要禁止覆盖,修改为false + # adapter的config.toml adapter_config: | [inner] From b10bcc34327e7db389676e03360ed1f315af4342 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 04:12:29 +0800 Subject: [PATCH 121/142] =?UTF-8?q?feat:=20=E4=B8=BAhelm=20chart=E5=85=BC?= =?UTF-8?q?=E5=AE=B9WebUI=EF=BC=8C=E5=BD=93=E5=90=AF=E7=94=A8WebUI?= =?UTF-8?q?=E6=97=B6=E9=BB=98=E8=AE=A4=E7=A6=81=E6=AD=A2=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitlab-ci.yml | 30 +++++++++---------- .../templates/core/configmap-bot-config.yaml | 2 +- .../core/configmap-model-config.yaml | 2 +- helm-chart/values.yaml | 6 ++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index 55c9c825..ce6f25e5 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -14,9 +14,9 @@ build-adapter-cm-generator: image: reg.mikumikumi.xyz/base/kaniko-builder:latest variables: BUILD_NO_CACHE: true -# rules: -# - changes: -# - helm-chart/adapter-cm-generator/** + rules: + - changes: + - helm-chart/adapter-cm-generator/** script: - export BUILD_CONTEXT=helm-chart/adapter-cm-generator - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator @@ -31,9 +31,9 @@ build-core-webui-cm-sync: image: reg.mikumikumi.xyz/base/kaniko-builder:latest variables: BUILD_NO_CACHE: true -# rules: -# - changes: -# - helm-chart/core-webui-cm-sync/** + rules: + - changes: + - helm-chart/core-webui-cm-sync/** script: - export BUILD_CONTEXT=helm-chart/core-webui-cm-sync - export TMP_DST=reg.mikumikumi.xyz/maibot/core-webui-cm-sync @@ -46,15 +46,15 @@ build-core-webui-cm-sync: package-helm-chart: stage: package-helm-chart image: reg.mikumikumi.xyz/mirror/helm:latest -# rules: -# - changes: -# - helm-chart/files/** -# - helm-chart/templates/** -# - helm-chart/.gitignore -# - helm-chart/.helmignore -# - helm-chart/Chart.yaml -# - helm-chart/README.md -# - helm-chart/values.yaml + rules: + - changes: + - helm-chart/files/** + - helm-chart/templates/** + - helm-chart/.gitignore + - helm-chart/.helmignore + - helm-chart/Chart.yaml + - helm-chart/README.md + - helm-chart/values.yaml script: - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD} diff --git a/helm-chart/templates/core/configmap-bot-config.yaml b/helm-chart/templates/core/configmap-bot-config.yaml index 447b3396..bc40e93a 100644 --- a/helm-chart/templates/core/configmap-bot-config.yaml +++ b/helm-chart/templates/core/configmap-bot-config.yaml @@ -1,4 +1,4 @@ -{{- if or .Release.IsInstall .Values.config.enable_config_override }} +{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }} # 渲染规则: # 初次安装,或配置了覆盖规则 apiVersion: v1 diff --git a/helm-chart/templates/core/configmap-model-config.yaml b/helm-chart/templates/core/configmap-model-config.yaml index 97c435ff..3ce7d95e 100644 --- a/helm-chart/templates/core/configmap-model-config.yaml +++ b/helm-chart/templates/core/configmap-model-config.yaml @@ -1,4 +1,4 @@ -{{- if or .Release.IsInstall .Values.config.enable_config_override }} +{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }} # 渲染规则: # 初次安装,或配置了覆盖规则 apiVersion: v1 diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index c9ac969a..e8491eb6 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -212,9 +212,11 @@ sqlite_web: config: # 启用WebUI后,配置文件的修改即可在WebUI进行。如果通过WebUI修改了配置,则实际的配置文件将与values中的配置存在差异。 - # 为了避免helm升级麦麦时,下面values中的配置覆盖掉已有的配置文件而导致配置丢失,可以在这里禁止本次部署时的配置覆盖。 + # 如果用户在k8s的ConfigMap中手动修改了配置文件,则实际的配置文件也会与values中的配置存在差异。 + # 出现上述两种情况时,为了避免helm升级麦麦时,下面values中的配置覆盖掉已有的配置文件而导致配置丢失,可以在这里禁止本次部署时的配置覆盖。 # 注:由于adapter的配置无法通过WebUI修改,因此下面的adapter_config配置仍然会覆盖已有配置文件。 - enable_config_override: true # 要禁止覆盖,修改为false + enable_config_override_without_webui: true # 未启用WebUI时,默认覆盖 + enable_config_override_with_webui: false # 启用WebUI时,默认不覆盖 # adapter的config.toml adapter_config: | From 96ebcddf76312896e4005910b2a892ed852cb366 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 04:25:25 +0800 Subject: [PATCH 122/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhelm=20chart?= =?UTF-8?q?=E4=B8=8D=E8=A6=86=E7=9B=96configmap=E5=AF=BC=E8=87=B4configmap?= =?UTF-8?q?=E8=A2=AB=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/configmap-bot-config.yaml | 2 ++ helm-chart/templates/core/configmap-model-config.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/helm-chart/templates/core/configmap-bot-config.yaml b/helm-chart/templates/core/configmap-bot-config.yaml index bc40e93a..d1395296 100644 --- a/helm-chart/templates/core/configmap-bot-config.yaml +++ b/helm-chart/templates/core/configmap-bot-config.yaml @@ -6,6 +6,8 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-maibot-core-bot-config namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/resource-policy": keep data: bot_config.toml: | {{ .Values.config.core_bot_config | nindent 4 }} diff --git a/helm-chart/templates/core/configmap-model-config.yaml b/helm-chart/templates/core/configmap-model-config.yaml index 3ce7d95e..bf122244 100644 --- a/helm-chart/templates/core/configmap-model-config.yaml +++ b/helm-chart/templates/core/configmap-model-config.yaml @@ -6,6 +6,8 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-maibot-core-model-config namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/resource-policy": keep data: model_config.toml: | {{ .Values.config.core_model_config | nindent 4 }} From b93bd8dc1403be520ecf5aa7fcfcb2677f679152 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 04:36:56 +0800 Subject: [PATCH 123/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhelm=20chart?= =?UTF-8?q?=E4=B8=8D=E5=90=AF=E7=94=A8WebUI=E6=97=B6=E4=BB=8D=E7=84=B6?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=97=A0=E7=94=A8=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8D=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index db8cda78..2bc8d14c 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -142,6 +142,7 @@ spec: path: .env name: {{ .Release.Name }}-maibot-core-env-config name: env-config + {{- if not .Values.core.webui.enabled }} - configMap: items: - key: model_config.toml @@ -154,6 +155,7 @@ spec: path: bot_config.toml name: {{ .Release.Name }}-maibot-core-bot-config name: bot-config + {{- end }} {{- if .Values.statistics_dashboard.enabled }} - name: statistics persistentVolumeClaim: From ad2df627001f18996802f23c405b263e78af0d0f Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 04:42:35 +0800 Subject: [PATCH 124/142] =?UTF-8?q?docs:=20=E4=B8=BAhelm=20chart=E6=97=A7?= =?UTF-8?q?=E7=89=88=E5=8D=87=E7=BA=A7=E7=94=A8=E6=88=B7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index e8491eb6..dacb8c3d 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -66,6 +66,9 @@ core: setup_default_plugins: true # 启用一个初始化容器,用于为用户自动安装默认插件到存储卷中 webui: # WebUI相关配置 + # 对从helm chart 0.11.5-beta 之前的旧版升级的用户的重要提示: + # 旧版本helm chart没有配置configmap的保留策略,直接升级同时开启WebUI后会导致configmap丢失从而无法启动。 + # 这种情况可以先禁用WebUI更新一次,再启用WebUI更新一次即可解决问题。 enabled: true # 默认启用 cm_sync: # WebUI的辅助容器配置 image: From bb314c8ae6fbb5193e1914c384e18a1fdb48d190 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Fri, 21 Nov 2025 04:44:10 +0800 Subject: [PATCH 125/142] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0helm=20chart?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-chart/README.md b/helm-chart/README.md index 7c15d81f..edbb417c 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,6 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| +| 0.11.5-beta | 0.11.5-beta | ad2df627001f18996802f23c405b263e78af0d0f | | 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 | | 0.11.2-beta | 0.11.2-beta | d3c8cea00dbb97f545350f2c3d5bcaf252443df2 | | 0.11.1-beta | 0.11.1-beta | 94e079a340a43dff8a2bc178706932937fc10b11 | From 27c41781f9f136bc4afd03acd87f35eadaea4686 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Tue, 9 Dec 2025 10:02:19 +0800 Subject: [PATCH 126/142] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=9A=84=20cron=20=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E4=B8=BA=E6=AF=8F10=E5=88=86=E9=92=9F?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index dc43f1ae..5f4eadd0 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -2,7 +2,7 @@ name: Docker Build and Push (Dev) on: schedule: - - cron: '0 0 * * *' + - cron: "*/10 * * * *" # every 10 minutes # push: # branches: # - dev From 8d28f26b7daa95a560a05d96e5699423e8d515db Mon Sep 17 00:00:00 2001 From: infinitycat Date: Tue, 9 Dec 2025 11:00:44 +0800 Subject: [PATCH 127/142] =?UTF-8?q?test:=20=E7=BB=9F=E4=B8=80=20cron=20?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=E7=9A=84=E5=BC=95=E5=8F=B7=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index 5f4eadd0..55cffbf0 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -2,7 +2,7 @@ name: Docker Build and Push (Dev) on: schedule: - - cron: "*/10 * * * *" # every 10 minutes + - cron: '*/10 * * * *' # every 10 minutes # push: # branches: # - dev From dec4e758fa824eb94521769214743350b8c2a051 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Tue, 9 Dec 2025 17:33:43 +0800 Subject: [PATCH 128/142] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=9A=84=20cron=20=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E4=B8=BA=E6=AF=8F=E5=A4=A9=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=EF=BC=8C=E5=B9=B6=E8=B0=83=E6=95=B4=20Docker?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E6=A0=87=E7=AD=BE=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image-dev.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index 55cffbf0..47c39406 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -2,8 +2,7 @@ name: Docker Build and Push (Dev) on: schedule: - - cron: '*/10 * * * *' # every 10 minutes - # push: + - cron: '0 0 * * *' # every day at midnight UTC # branches: # - dev workflow_dispatch: # 允许手动触发工作流 @@ -147,8 +146,8 @@ jobs: with: images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot tags: | - type=ref,event=branch - type=sha,prefix=${{ github.ref_name }}-,enable=${{ github.ref_type == 'branch' }} + type=raw,value=dev + type=schedule,pattern=dev-{{date 'YYMMDD'}} - name: Create and Push Manifest run: | From c626162fc14e2e78353acbe0906a7e22b9b19f28 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Tue, 9 Dec 2025 17:43:59 +0800 Subject: [PATCH 129/142] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Docker=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=9E=84=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20maim=5Fmessage=20=E5=85=8B=E9=9A=86?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image-dev.yml | 12 ++++++------ .github/workflows/docker-image-main.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml index 47c39406..63fdafee 100644 --- a/.github/workflows/docker-image-dev.yml +++ b/.github/workflows/docker-image-dev.yml @@ -27,11 +27,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -81,11 +81,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/docker-image-main.yml b/.github/workflows/docker-image-main.yml index 25dc67ea..3d9b14ab 100644 --- a/.github/workflows/docker-image-main.yml +++ b/.github/workflows/docker-image-main.yml @@ -31,11 +31,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -84,11 +84,11 @@ jobs: fetch-depth: 0 # Clone required dependencies - - name: Clone maim_message - run: git clone https://github.com/MaiM-with-u/maim_message maim_message + # - name: Clone maim_message + # run: git clone https://github.com/MaiM-with-u/maim_message maim_message - name: Clone lpmm - run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM + run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 32a6d1a520e5007847f0786b3b7b3b643679de23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9B=A6?= <2584059816@qq.com> Date: Sun, 14 Dec 2025 16:40:37 +0800 Subject: [PATCH 130/142] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9webui=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=85=8D=E7=BD=AE=E6=9A=B4=E9=9C=B2=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E4=B8=BA127.0.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 WebUI 服务的默认监听地址从 0.0.0.0 修改为 127.0.0.1,以提升安全性,默认仅允许本地访问。同步调整了相关日志提示以及 template.env 中的注释说明,明确如何在需要时显式开启对外访问。 --- src/main.py | 4 ++-- src/webui/webui_server.py | 6 +++--- template/template.env | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 3bcc9695..58403f65 100644 --- a/src/main.py +++ b/src/main.py @@ -59,12 +59,12 @@ class MainSystem: if webui_mode == "development": logger.info("📝 WebUI 开发模式已启用") - logger.info("🌐 后端 API 将运行在 http://0.0.0.0:8001") + logger.info("🌐 后端 API 将运行在配置的地址(默认 http://127.0.0.1:8001)") logger.info("💡 请手动启动前端开发服务器: cd MaiBot-Dashboard && bun dev") logger.info("💡 前端将运行在 http://localhost:7999") else: logger.info("✅ WebUI 生产模式已启用") - logger.info("🌐 WebUI 将运行在 http://0.0.0.0:8001") + logger.info("🌐 WebUI 将运行在配置的地址(默认 http://127.0.0.1:8001)") logger.info("💡 请确保已构建前端: cd MaiBot-Dashboard && bun run build") except Exception as e: diff --git a/src/webui/webui_server.py b/src/webui/webui_server.py index ba6b7480..12b6587c 100644 --- a/src/webui/webui_server.py +++ b/src/webui/webui_server.py @@ -1,4 +1,4 @@ -"""独立的 WebUI 服务器 - 运行在 0.0.0.0:8001""" +"""独立的 WebUI 服务器 - 默认运行在 127.0.0.1:8001""" import os import asyncio @@ -16,7 +16,7 @@ logger = get_logger("webui_server") class WebUIServer: """独立的 WebUI 服务器""" - def __init__(self, host: str = "0.0.0.0", port: int = 8001): + def __init__(self, host: str = "127.0.0.1", port: int = 8001): self.host = host self.port = port self.app = FastAPI(title="MaiBot WebUI") @@ -178,7 +178,7 @@ def get_webui_server() -> WebUIServer: global _webui_server if _webui_server is None: # 从环境变量读取配置 - host = os.getenv("WEBUI_HOST", "0.0.0.0") + host = os.getenv("WEBUI_HOST", "127.0.0.1") port = int(os.getenv("WEBUI_PORT", "8001")) _webui_server = WebUIServer(host=host, port=port) return _webui_server diff --git a/template/template.env b/template/template.env index b6dd0e5c..eeb71717 100644 --- a/template/template.env +++ b/template/template.env @@ -5,5 +5,5 @@ PORT=8000 # WebUI 独立服务器配置 WEBUI_ENABLED=true WEBUI_MODE=production # 模式: development(开发) 或 production(生产) -WEBUI_HOST=0.0.0.0 # WebUI 服务器监听地址 +WEBUI_HOST=127.0.0.1 # WebUI 服务器监听地址(默认仅本地访问,设置为0.0.0.0可允许外部访问) WEBUI_PORT=8001 # WebUI 服务器端口 \ No newline at end of file From 53bef5ae26df2037cecbbad3f937ab3f394207d2 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 01:14:28 +0800 Subject: [PATCH 131/142] =?UTF-8?q?feat(helm=20chart):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0Helm=20Chart=E5=88=B00.11.6-beta=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=88=B0=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/.gitignore | 1 + helm-chart/.gitlab-ci.yml | 27 +- helm-chart/.helmignore | 3 +- helm-chart/Chart.yaml | 4 +- helm-chart/README.md | 65 ++--- .../adapter-cm-generator.py | 73 ------ helm-chart/core-webui-cm-sync/Dockerfile | 10 - .../core-webui-cm-sync/core-webui-cm-sync.py | 92 ------- .../core-webui-cm-sync/requirements.txt | 3 - helm-chart/files/.env | 6 + helm-chart/files/k8s-init.sh | 20 -- helm-chart/files/setup-plugins.py | 95 ------- .../Dockerfile | 4 +- helm-chart/preprocessor/preprocessor.py | 241 ++++++++++++++++++ .../requirements.txt | 0 helm-chart/templates/adapter/pvc.yaml | 27 +- helm-chart/templates/adapter/statefulset.yaml | 12 +- .../templates/core/configmap-bot-config.yaml | 14 - .../templates/core/configmap-env-config.yaml | 13 - .../core/configmap-model-config.yaml | 14 - helm-chart/templates/core/pvc.yaml | 27 +- helm-chart/templates/core/statefulset.yaml | 84 +----- helm-chart/templates/napcat/statefulset.yaml | 2 +- .../templates/other/check-eula-privacy.yaml | 4 +- .../templates/other/configmap-scripts.yaml | 5 - .../templates/other/job-gen-adapter-cm.yaml | 30 --- .../templates/other/job-preprocessor.yaml | 58 +++++ helm-chart/templates/other/rbac.yaml | 9 +- helm-chart/values.yaml | 153 +++++++---- 29 files changed, 504 insertions(+), 592 deletions(-) delete mode 100644 helm-chart/adapter-cm-generator/adapter-cm-generator.py delete mode 100644 helm-chart/core-webui-cm-sync/Dockerfile delete mode 100644 helm-chart/core-webui-cm-sync/core-webui-cm-sync.py delete mode 100644 helm-chart/core-webui-cm-sync/requirements.txt create mode 100644 helm-chart/files/.env delete mode 100644 helm-chart/files/setup-plugins.py rename helm-chart/{adapter-cm-generator => preprocessor}/Dockerfile (72%) create mode 100644 helm-chart/preprocessor/preprocessor.py rename helm-chart/{adapter-cm-generator => preprocessor}/requirements.txt (100%) delete mode 100644 helm-chart/templates/core/configmap-bot-config.yaml delete mode 100644 helm-chart/templates/core/configmap-env-config.yaml delete mode 100644 helm-chart/templates/core/configmap-model-config.yaml delete mode 100644 helm-chart/templates/other/job-gen-adapter-cm.yaml create mode 100644 helm-chart/templates/other/job-preprocessor.yaml diff --git a/helm-chart/.gitignore b/helm-chart/.gitignore index b5ec6e00..8c2aec04 100644 --- a/helm-chart/.gitignore +++ b/helm-chart/.gitignore @@ -1 +1,2 @@ !napcat +!.env \ No newline at end of file diff --git a/helm-chart/.gitlab-ci.yml b/helm-chart/.gitlab-ci.yml index ce6f25e5..d00ae558 100644 --- a/helm-chart/.gitlab-ci.yml +++ b/helm-chart/.gitlab-ci.yml @@ -8,35 +8,18 @@ workflow: - if: '$CI_COMMIT_BRANCH == "helm-chart"' - when: never -# 构建并推送adapter-cm-generator镜像 -build-adapter-cm-generator: +# 构建并推送processor镜像 +build-preprocessor: stage: build-image image: reg.mikumikumi.xyz/base/kaniko-builder:latest variables: BUILD_NO_CACHE: true rules: - changes: - - helm-chart/adapter-cm-generator/** + - helm-chart/preprocessor/** script: - - export BUILD_CONTEXT=helm-chart/adapter-cm-generator - - export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator - - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - - export BUILD_DESTINATION="${TMP_DST}:${CHART_VERSION}" - - export BUILD_ARGS="--destination ${TMP_DST}:latest" - - build - -# 构建并推送core-webui-cm-sync镜像 -build-core-webui-cm-sync: - stage: build-image - image: reg.mikumikumi.xyz/base/kaniko-builder:latest - variables: - BUILD_NO_CACHE: true - rules: - - changes: - - helm-chart/core-webui-cm-sync/** - script: - - export BUILD_CONTEXT=helm-chart/core-webui-cm-sync - - export TMP_DST=reg.mikumikumi.xyz/maibot/core-webui-cm-sync + - export BUILD_CONTEXT=helm-chart/preprocessor + - export TMP_DST=reg.mikumikumi.xyz/maibot/preprocessor - export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2) - export BUILD_DESTINATION="${TMP_DST}:${CHART_VERSION}" - export BUILD_ARGS="--destination ${TMP_DST}:latest" diff --git a/helm-chart/.helmignore b/helm-chart/.helmignore index d4fe42ef..84ca3f29 100644 --- a/helm-chart/.helmignore +++ b/helm-chart/.helmignore @@ -1,3 +1,2 @@ -adapter-cm-generator -core-webui-cm-sync +preprocessor .gitlab-ci.yml \ No newline at end of file diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index ea75ef79..74cb37cb 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.5-beta -appVersion: 0.11.5-beta +version: 0.11.6-beta +appVersion: 0.11.6-beta diff --git a/helm-chart/README.md b/helm-chart/README.md index edbb417c..63a835b5 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -34,35 +34,39 @@ helm install maimai \ 1. `EULA` & `PRIVACY`: 用户必须同意这里的协议才能成功部署麦麦。 -2. `adapter`: 麦麦的Adapter的部署配置。 +2. `pre_processor`: 部署之前的预处理Job的配置。 -3. `core`: 麦麦本体的部署配置。 +3. `adapter`: 麦麦的Adapter的部署配置。 -4. `statistics_dashboard`: 麦麦的运行统计看板部署配置。 +4. `core`: 麦麦本体的部署配置。 + +5. `statistics_dashboard`: 麦麦的运行统计看板部署配置。 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以部署为看板。 出于隐私考虑,默认禁用。 -5. `napcat`: Napcat的部署配置。 +6. `napcat`: Napcat的部署配置。 考虑到复用外部Napcat实例的情况,Napcat部署已被解耦。用户可选是否要部署Napcat。 默认会捆绑部署Napcat。 -6. `sqlite_web`: sqlite-web的部署配置。 +7. `sqlite_web`: sqlite-web的部署配置。 通过sqlite-web可以在网页上操作麦麦的数据库,方便调试。不部署对麦麦的运行无影响。 此服务如果暴露在公网会十分危险,默认不会部署。 -7. `config`: 这里填写麦麦各部分组件的运行配置文件。 +8. `config`: 这里填写麦麦各部分组件的运行配置。 - 这里填写的配置文件需要严格遵守yaml文件的缩进格式。 + 这里填写的配置仅会在初次部署时或用户指定时覆盖实际配置文件,且需要严格遵守yaml文件的缩进格式。 + + - `override_*_config`: 指定本次部署/升级是否用以下配置覆盖实际配置文件。默认不覆盖。 - `adapter_config`: 对应adapter的`config.toml`。 - 此配置文件中对于`host`和`port`的配置会被上面`adapter.service`中的配置覆盖,因此不需要改动。 + 此配置文件中对于`napcat_server`和`maibot_server`的`host`和`port`字段的配置会被上面`adapter.service`中的配置覆盖,因此不需要改动。 - `core_model_config`: 对应core的`model_config.toml`。 @@ -72,22 +76,22 @@ helm install maimai \ 使用此Helm Chart的一些注意事项。 -### 修改麦麦配置 +### 麦麦的配置 -麦麦的配置文件会通过ConfigMap资源注入各个组件内。 +要修改麦麦的配置,最好的方法是通过WebUI来操作。此处的配置只会在初次部署时或者指定覆盖时注入到MaiBot中。 -对于通过Helm Chart部署的麦麦,如果需要修改配置,不应该直接修改这些ConfigMap,否则下次Helm更新可能会覆盖掉所有配置。 +`0.11.6-beta`之前的版本将配置存储于k8s的ConfigMap资源中。随着版本迭代,MaiBot对配置文件的操作复杂性增加,k8s的适配复杂度也同步增加,且WebUI可以直接修改配置文件,因此自`0.11.6-beta`版本开始,各组件的配置不再存储于k8s的ConfigMap中,而是直接存储于存储卷的实际文件中。 -最佳实践是重新配置Helm Chart的values,然后通过`helm upgrade`更新实例。 +从旧版本升级的用户,旧的ConfigMap的配置会自动迁移到新的存储卷的配置文件中。 ### 动态生成的ConfigMap -adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 +adapter的配置中的`napcat_server`和`maibot_server`的`host`和`port`字段,会在每次部署/更新Helm安装实例时被自动重置。 -动态生成的原因: +自动重置的原因: -- core服务的DNS名称是动态的,无法在adapter服务的配置文件中提前确定。 -- 一些与k8s现有资源冲突的配置需要被重置。 +- core的Service的DNS名称是动态的(由安装实例名拼接),无法在adapter的配置文件中提前确定。 +- 为了使adapter监听所有地址以及保持Helm Chart中配置的端口号,需要在adapter的配置文件中覆盖这些配置。 因此,首次部署时,ConfigMap的生成会需要一些时间,部分Pod会无法启动,等待几分钟即可。 @@ -101,31 +105,4 @@ adapter的ConfigMap是每次部署/更新Helm安装实例时动态生成的。 如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 -*如果启用了`sqlite-web`,那么上述问题也同样适用于`sqlite-web`与`core`,需要注意。* - -### 麦麦的默认插件 - -麦麦的`core`容器提供了一些默认插件,以提升使用体验。但是插件目录存储在存储卷中,容器启动时挂载的存储卷会完全覆盖掉容器的默认插件目录,导致默认插件无法加载,也难以被用户感知。 - -为了解决这一问题,此Helm Chart中为`core`容器引入了初始化容器。此初始化容器用于为用户自动安装默认插件到存储卷中。可以选择启用(默认启用)。 - -*初始化容器使用与`core`主容器相同的镜像,且用后即销毁,因此不会消耗额外的带宽和存储成本。* - -#### 触发插件安装的条件 - -- 首次部署时(此时没有任何插件处于安装状态) -- 默认插件更新(即默认插件内容发生变化) - -#### 安装状态识别能力 - -初始化容器会记录安装过的默认插件,不会重复安装。为了实现这一点,初始化容器会将安装状态写入`/MaiMBot/data/plugins/.installed-setup-plugins`文件中。 - -基于上述状态识别能力,如果用户不需要某个插件,可以将其删除。由于此插件已自动安装过(记录在状态文件中),即使插件本体不存在也不会再次安装(除非插件更新)。 - -#### 插件更新 - -一旦在镜像中检测到新版本插件(即插件内容不同),初始化容器即会用新插件覆盖旧插件。 - -考虑到旧插件中可能存在用户自定义配置,因此旧插件在被覆盖前会备份到`/MaiMBot/data/plugins-backup`目录中,并以时间归档。 - -因此在升级麦麦后,请注意观察初始容器的日志并重新配置插件。 +*对于预处理任务和`sqlite-web`,上述问题也同样会出现,需要注意。* diff --git a/helm-chart/adapter-cm-generator/adapter-cm-generator.py b/helm-chart/adapter-cm-generator/adapter-cm-generator.py deleted file mode 100644 index 95d7b65b..00000000 --- a/helm-chart/adapter-cm-generator/adapter-cm-generator.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/python3 -# 这个脚本的作用是在部署helm chart时动态生成adapter的配置文件,保存在configmap中 -# 需要动态生成的原因是core服务的DNS名称是动态的,无法在adapter服务的配置文件中提前确定 -# 一些与k8s现有资源冲突的配置也会在这里重置 - -import os -import toml -import base64 -from kubernetes import client, config -from datetime import datetime, timezone - -config.load_incluster_config() -core_api = client.CoreV1Api() -apps_api = client.AppsV1Api() - -# 读取部署的关键信息 -namespace = os.getenv("NAMESPACE") -release_name = os.getenv("RELEASE_NAME") -data_b64 = os.getenv("DATA_B64") - -# 解析并覆盖关键配置 -# 这里被覆盖的配置应当在helm chart中针对对应的k8s资源来灵活修改 -data = toml.loads(base64.b64decode(data_b64).decode("utf-8")) -data.setdefault('napcat_server', {}) -data['napcat_server']['host'] = '0.0.0.0' -data['napcat_server']['port'] = 8095 -data.setdefault('maibot_server', {}) -data['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release名称动态拼接core服务的DNS名称 -data['maibot_server']['port'] = 8000 - -# 创建/修改configmap -cm_name = f'{release_name}-maibot-adapter-config' -cm = client.V1ConfigMap( - metadata=client.V1ObjectMeta(name=cm_name), - data={'config.toml': toml.dumps(data)} -) -try: - core_api.create_namespaced_config_map(namespace, cm) - print(f"ConfigMap `{cm_name}` created successfully") -except client.exceptions.ApiException as e: - if e.status == 409: # 已存在,更新 - core_api.replace_namespaced_config_map(cm_name, namespace, cm) - print(f"ConfigMap `{cm_name}` replaced successfully") - else: - raise - -# 重启adapter和core的statefulset -now = datetime.now(timezone.utc).isoformat() -body = { - "spec": { - "template": { - "metadata": { - "annotations": { - "kubectl.kubernetes.io/restartedAt": now - } - } - } - } -} -apps_api.patch_namespaced_stateful_set( - name=f'{release_name}-maibot-adapter', - namespace=namespace, - body=body, -) -print(f"StatefulSet `{release_name}-maibot-adapter` restarted successfully") -apps_api.patch_namespaced_stateful_set( - name=f'{release_name}-maibot-core', - namespace=namespace, - body=body, -) -print(f"StatefulSet `{release_name}-maibot-core` restarted successfully") - -print('Job succeed.') diff --git a/helm-chart/core-webui-cm-sync/Dockerfile b/helm-chart/core-webui-cm-sync/Dockerfile deleted file mode 100644 index 55a8c25b..00000000 --- a/helm-chart/core-webui-cm-sync/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# 此镜像用于辅助麦麦的WebUI更新配置文件,随core容器持续运行 -FROM python:3.13-slim - -WORKDIR /MaiMBot - -COPY . /MaiMBot - -RUN pip3 install --no-cache-dir -r requirements.txt - -ENTRYPOINT ["python3", "core-webui-cm-sync.py"] diff --git a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py b/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py deleted file mode 100644 index e179d6f6..00000000 --- a/helm-chart/core-webui-cm-sync/core-webui-cm-sync.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/python3 -# 这个程序的作用是辅助麦麦的WebUI更新配置文件,随core容器持续运行。 -# 麦麦的配置文件存储于ConfigMap中,挂载进core容器后属于只读文件,无法直接修改。 -# 此程序将core容器内的配置文件替换为可读写的中间层临时文件。启动时将实际配置文件写入,并在后台持续检测文件变化,实时同步到k8s apiServer,反向修改ConfigMap。 -# 工作目录:/MaiMBot/webui-cm-sync - -import os -import time -from datetime import datetime -from kubernetes import client, config -from watchdog.observers import Observer -from watchdog.events import FileSystemEventHandler - -work_dir = '/MaiMBot/webui-cm-sync' -os.chdir(work_dir) - -config.load_incluster_config() -core_api = client.CoreV1Api() -with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f: - namespace = f.read().strip() -release_name = os.getenv("RELEASE_NAME") -model_configmap_name = f'{release_name}-maibot-core-model-config' -bot_configmap_name = f'{release_name}-maibot-core-bot-config' - -# 过滤列表,只监控指定文件 -target_files = { - os.path.abspath("model_config.toml"): (model_configmap_name, "model_config.toml"), - os.path.abspath("bot_config.toml"): (bot_configmap_name, "bot_config.toml") -} - - -def get_configmap(configmap_name: str): - """获取core的ConfigMap内容""" - cm = core_api.read_namespaced_config_map(name=configmap_name, namespace=namespace) - return cm.data - - -def set_configmap(configmap_name: str, configmap_data: dict[str, str]): - """设置core的ConfigMap内容""" - core_api.patch_namespaced_config_map(configmap_name, namespace, {'data': configmap_data}) - - -class ConfigObserverHandler(FileSystemEventHandler): - """配置文件变化的事件处理器""" - def on_modified(self, event): - if os.path.abspath(event.src_path) in target_files: - print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] File `{event.src_path}` was modified. ' - f'Start to sync...') - with open(event.src_path, "r", encoding="utf-8") as _f: - current_data = _f.read() - _path = str(os.path.abspath(event.src_path)) - new_cm = { - target_files[_path][1]: current_data - } - try: - set_configmap(target_files[_path][0], new_cm) - print(f'\tSync done.') - except client.exceptions.ApiException as _e: - print(f'\tError while setting configmap:\n' - f'\t\tStatus Code: {_e.status}\n' - f'\t\tReason: {_e.reason}') - - -if __name__ == '__main__': - # 初始化配置文件 - print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] Initializing config files...') - try: - __initial_model_config = get_configmap(model_configmap_name)['model_config.toml'] - __initial_bot_config = get_configmap(bot_configmap_name)['bot_config.toml'] - except client.exceptions.ApiException as e: - print(f'\tError while getting configmap:\n' - f'\t\tStatus Code: {e.status}\n' - f'\t\tReason: {e.reason}') - exit(1) - with open('model_config.toml', 'w') as f: - f.write(__initial_model_config) - with open('bot_config.toml', 'w') as f: - f.write(__initial_bot_config) - with open('ready', 'w') as f: - f.write('true') - print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] Initializing done. Ready to sync.') - - # 持续检测变化并同步 - observer = Observer() - observer.schedule(ConfigObserverHandler(), work_dir, recursive=False) - observer.start() - try: - while True: - time.sleep(1) - except KeyboardInterrupt: - observer.stop() - observer.join() diff --git a/helm-chart/core-webui-cm-sync/requirements.txt b/helm-chart/core-webui-cm-sync/requirements.txt deleted file mode 100644 index 58c73d28..00000000 --- a/helm-chart/core-webui-cm-sync/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -toml~=0.10.2 -kubernetes~=34.1.0 -watchdog~=6.0.0 diff --git a/helm-chart/files/.env b/helm-chart/files/.env new file mode 100644 index 00000000..a5d1eedf --- /dev/null +++ b/helm-chart/files/.env @@ -0,0 +1,6 @@ +HOST=0.0.0.0 +PORT=8000 +WEBUI_ENABLED={{ if .Values.core.webui.enabled }}true{{ else }}false{{ end }} +WEBUI_MODE=production +WEBUI_HOST=0.0.0.0 +WEBUI_PORT=8001 diff --git a/helm-chart/files/k8s-init.sh b/helm-chart/files/k8s-init.sh index 3729a68f..3fd805f4 100644 --- a/helm-chart/files/k8s-init.sh +++ b/helm-chart/files/k8s-init.sh @@ -1,12 +1,8 @@ #!/bin/sh # 此脚本用于覆盖core容器的默认启动命令,进行一些初始化 -# 1 # 由于k8s与docker-compose的卷挂载方式有所不同,需要利用此脚本为一些文件和目录提前创建好软链接 # /MaiMBot/data是麦麦数据的实际挂载路径 # /MaiMBot/statistics是统计数据的实际挂载路径 -# 2 -# 此脚本等待辅助容器webui-cm-sync就绪后再启动麦麦 -# 通过检测/MaiMBot/webui-cm-sync/ready文件来判断 set -e echo "[K8s Init] Preparing volume..." @@ -34,22 +30,6 @@ fi echo "[K8s Init] Volume ready." -# 如果启用了WebUI,则等待辅助容器webui-cm-sync就绪,然后创建中间层配置文件软链接 -if [ "$MAIBOT_WEBUI_ENABLED" = "true" ] -then - echo "[K8s Init] WebUI enabled. Waiting for container 'webui-cm-sync' ready..." - while [ ! -f /MaiMBot/webui-cm-sync/ready ]; do - sleep 1 - done - echo "[K8s Init] Container 'webui-cm-sync' ready." - mkdir -p /MaiMBot/config - ln -s /MaiMBot/webui-cm-sync/model_config.toml /MaiMBot/config/model_config.toml - ln -s /MaiMBot/webui-cm-sync/bot_config.toml /MaiMBot/config/bot_config.toml - echo "[K8s Init] Config files middle layer for WebUI created." -else - echo "[K8s Init] WebUI is disabled." -fi - # 启动麦麦 echo "[K8s Init] Waking up MaiBot..." echo diff --git a/helm-chart/files/setup-plugins.py b/helm-chart/files/setup-plugins.py deleted file mode 100644 index 9fde6804..00000000 --- a/helm-chart/files/setup-plugins.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/local/bin/python3 -# 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此脚本用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 -# 如果用户主动删除插件且插件无更新,则不会再次安装。插件状态保存在/MaiMBot/data/plugins/.installed-setup-plugins文件中 -# 此脚本应当挂载进初始化容器中,从/MaiMBot工作路径开始运行。初始化容器的镜像同core容器,初始化容器中应挂载core存储卷的数据到/MaiMBot/data -import os -import shutil -import hashlib -from datetime import datetime - -SRC_DIR = '/MaiMBot/plugins' -DST_DIR = '/MaiMBot/data/plugins' -STATUS_FILE = f'{DST_DIR}/.installed-setup-plugins' -BAK_DIR = '/MaiMBot/data/plugins-backup' -CURRENT_TIME = datetime.now().strftime('%Y%m%d%H%M%S') - -def hash_dir_file(path: str): - """计算目录/文件的SHA256,用于判断是否发生变化""" - def hash_file(_file_path: str): - _h = hashlib.sha256() - with open(_file_path, 'rb') as _f: - for _chunk in iter(lambda: _f.read(8192), b''): - _h.update(_chunk) - return _h.hexdigest() - - if os.path.isfile(path): - return hash_file(path) - - h = hashlib.sha256() - for root, dirs, files in os.walk(path): - for filename in sorted(files): - filepath = os.path.join(root, filename) - relpath = os.path.relpath(filepath, path) - file_hash = hash_file(filepath) - h.update(relpath.encode('utf-8')) - h.update(file_hash.encode('utf-8')) - return h.hexdigest() - -def copy_plugin(plugin: str): - """复制插件,如果插件已存在则备份旧的插件然后用新的插件覆盖""" - src = os.path.join(SRC_DIR, plugin) - if not os.path.exists(src): - raise FileNotFoundError(f"File not found: {src}") - - dst = os.path.join(DST_DIR, plugin) - if os.path.exists(dst): - print(f"\t\tWarning: Old version of plugin '{plugin}' already exists. " - f"Old plugin will be moved to '{BAK_DIR}/{CURRENT_TIME}/{plugin}'. " - f"Remember to re-edit config of this plugin.") - if not os.path.exists(os.path.join(BAK_DIR, CURRENT_TIME)): - os.makedirs(os.path.join(BAK_DIR, CURRENT_TIME)) - if os.path.isdir(dst): - shutil.copytree(dst, os.path.join(BAK_DIR, CURRENT_TIME, plugin)) - shutil.rmtree(dst) - else: - shutil.copy2(dst, os.path.join(BAK_DIR, CURRENT_TIME)) - os.remove(dst) - - if os.path.isdir(src): - shutil.copytree(src, dst) - else: - shutil.copy2(src, DST_DIR) - -setup_plugins = {plugin: hash_dir_file(plugin) for plugin in os.listdir(SRC_DIR)} -installed_plugins = {} -to_install_plugins = {} - -print(f"[SetupPlugins] Default plugin, which has been updated or never been installed, " - f"will be installed in this init container.") -if os.path.exists(STATUS_FILE) and os.path.isfile(STATUS_FILE): - print(f"[SetupPlugins] Reading status file: '{STATUS_FILE}'...") - with open(STATUS_FILE, 'r', encoding='utf-8') as f: - lines = f.readlines() - for line in lines: - if line == '': - continue - plugin = line.strip().split(':') - installed_plugins[plugin[0]] = plugin[1] - print(f"[SetupPlugins] Found {len(installed_plugins)} default plugins which used to be installed:") - for plugin in installed_plugins.keys(): - print(f'\t{plugin}') -else: - print(f"[SetupPlugins] No status file found. Status file '{STATUS_FILE}' will be created. " - f"All default plugins will be installed now.") - -print(f"[SetupPlugins] Checking plugins...") -for plugin, sha256 in setup_plugins.items(): - if (plugin not in installed_plugins) or (sha256 != installed_plugins[plugin]): - print(f"\tFound default plugin to install: '{plugin}'. Installing...") - copy_plugin(plugin) - installed_plugins[plugin] = sha256 - -with open(STATUS_FILE, 'w', encoding='utf-8') as f: - f.write('\n'.join(sorted([f'{plugin}:{sha256}' for plugin, sha256 in installed_plugins.items()]))) - -print(f"[SetupPlugins] Default plugin checking done. Status saved to '{STATUS_FILE}'.") diff --git a/helm-chart/adapter-cm-generator/Dockerfile b/helm-chart/preprocessor/Dockerfile similarity index 72% rename from helm-chart/adapter-cm-generator/Dockerfile rename to helm-chart/preprocessor/Dockerfile index 3149f0f5..58452dd5 100644 --- a/helm-chart/adapter-cm-generator/Dockerfile +++ b/helm-chart/preprocessor/Dockerfile @@ -3,8 +3,10 @@ FROM python:3.13-slim WORKDIR /app +ENV PYTHONUNBUFFERED=1 + COPY . /app RUN pip3 install --no-cache-dir -r requirements.txt -ENTRYPOINT ["python3", "adapter-cm-generator.py"] +ENTRYPOINT ["python3", "preprocessor.py"] diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py new file mode 100644 index 00000000..0edef8bd --- /dev/null +++ b/helm-chart/preprocessor/preprocessor.py @@ -0,0 +1,241 @@ +#!/bin/python3 +# 此脚本会被helm chart的post-install hook触发,在正式部署后通过k8s的job自动运行一次。 +# 这个脚本的作用是在部署helm chart时迁移旧版ConfigMap到配置文件,并调整adapter的配置文件中的服务监听和服务连接字段。 +# - 迁移旧版ConfigMap到配置文件是因为0.11.6-beta之前版本的helm chart将各个配置文件存储在k8s的ConfigMap中, +# 由于功能复杂度提升,自0.11.6-beta版本开始配置文件采用文件形式存储到存储卷中。 +# 从旧版升级来的用户会通过这个脚本自动执行配置的迁移。 +# - 需要调整adapter的配置文件的原因是: +# 1. core的Service的DNS名称是动态的(由安装实例名拼接),无法在adapter的配置文件中提前确定。 +# 用于对外连接的maibot_server.host和maibot_server.port字段,会被替换为core的Service对应的DNS名称和8000端口(硬编码,用户无需配置)。 +# 2. 为了使adapter监听所有地址以及保持chart中配置的端口号,需要在adapter的配置文件中覆盖这些配置。 +# 用于监听的napcat_server.host和napcat_server.port字段,会被替换为0.0.0.0和8095端口(实际映射到的Service端口会在Service中配置)。 + +import os +import toml +import time +import base64 +from kubernetes import client, config +from kubernetes.client.exceptions import ApiException +from datetime import datetime, timezone + +config.load_incluster_config() +core_api = client.CoreV1Api() +apps_api = client.AppsV1Api() + +# 读取部署的关键信息 +with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", 'r') as f: + namespace = f.read().strip() +release_name = os.getenv("RELEASE_NAME").strip() +config_adapter_b64 = os.getenv("CONFIG_ADAPTER_B64") +config_core_env_b64 = os.getenv("CONFIG_CORE_ENV_B64") +config_core_bot_b64 = os.getenv("CONFIG_CORE_BOT_B64") +config_core_model_b64 = os.getenv("CONFIG_CORE_MODEL_B64") + + +def log(func: str, msg: str, level: str = 'INFO'): + print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}][{func}][{level}] {msg}') + + +def migrate_old_config(): + """迁移旧版配置""" + func_name = 'migrate_old_config' + log(func_name, 'Checking whether there are old configmaps to migrate...') + old_configmap_version = None + status_migrating = { # 存储adapter的config.toml、core的bot_config.toml和model_config.toml三个文件的迁移状态 + 'adapter_config.toml': False, + 'core_bot_config.toml': False, + 'core_model_config.toml': False + } + + # 如果存储卷中已存在配置文件,则警告并跳过迁移 + if os.path.isfile('/app/config/core/bot_config.toml') or os.path.isfile('/app/config/core/model_config.toml') or \ + os.path.isfile('/app/config/adapter/config.toml'): + log(func_name, 'Found existing config file(s) in PV. Migration will be skipped. ' + 'Please check the configs MANUALLY.', level='WARNING') + log(func_name, '\tIf configs were ALREADY MIGRATED, you can delete old configmaps safely.', level='WARNING') + log(func_name, '\tIf configs were NOT MIGRATED, you should MIGRATE them MANUALLY, then delete the configmaps.', + level='WARNING') + return + + def migrate_cm_to_file(cm_name: str, key_name: str, file_path: str) -> bool: + """检测是否有指定名称的configmap,如果有的话备份到指定的配置文件里并删除configmap,返回是否已备份""" + try: + cm = core_api.read_namespaced_config_map( + name=cm_name, + namespace=namespace + ) + log(func_name, f'\tMigrating `{key_name}` of `{cm_name}`...') + with open(file_path, 'w', encoding='utf-8') as _f: + _f.write(cm.data[key_name]) + core_api.delete_namespaced_config_map( + name=cm_name, + namespace=namespace + ) + log(func_name, f'\tSuccessfully migrated `{key_name}` of `{cm_name}`.') + except ApiException as e: + if e.status == 404: + return False + return True + + # 对于0.11.5-beta版本,adapter的config.toml、core的bot_config.toml和model_config.toml均存储于不同的ConfigMap,需要依次迁移 + if True not in status_migrating.values(): + status_migrating['adapter_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-adapter-config', + 'config.toml', + '/app/config/adapter/config.toml') + status_migrating['core_bot_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-core-bot-config', + 'bot_config.toml', + '/app/config/core/bot_config.toml') + status_migrating['core_model_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-core-model-config', + 'model_config.toml', + '/app/config/core/model_config.toml') + if True in status_migrating.values(): + old_configmap_version = '0.11.5-beta' + + # 对于低于0.11.5-beta的版本,adapter的1个配置和core的3个配置位于各自的configmap中 + if True not in status_migrating.values(): + status_migrating['adapter_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-adapter', + 'config.toml', + '/app/config/adapter/config.toml') + status_migrating['core_bot_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-core', + 'bot_config.toml', + '/app/config/core/bot_config.toml') + status_migrating['core_model_config.toml'] = migrate_cm_to_file(f'{release_name}-maibot-core', + 'model_config.toml', + '/app/config/core/model_config.toml') + if True in status_migrating.values(): + old_configmap_version = 'before 0.11.5-beta' + + if old_configmap_version: + log(func_name, f'Migrating status for version `{old_configmap_version}`:') + for k, v in status_migrating.items(): + log(func_name, f'\t{k}: {v}') + if False in status_migrating.values(): + log(func_name, 'There is/are config(s) that not been migrated. Please check the config manually.', + level='WARNING') + else: + log(func_name, 'Successfully migrated old configs. Done.') + else: + log(func_name, 'Old config not found. Ignoring migration. Done.') + + +def write_config_files(): + """当注入了配置文件时(一般是首次安装或者用户指定覆盖),将helm chart注入的配置写入存储卷中的实际文件""" + func_name = 'write_config_files' + log(func_name, 'Detecting config files...') + if config_adapter_b64.strip(): + log(func_name, '\tWriting `config.toml` of adapter...') + config_str = base64.b64decode(config_adapter_b64).decode("utf-8") + with open('/app/config/adapter/config.toml', 'w', encoding='utf-8') as _f: + _f.write(config_str) + log(func_name, '\t`config.toml` of adapter wrote.') + if True: # .env直接覆盖 + log(func_name, '\tWriting .env file of core...') + config_str = base64.b64decode(config_core_env_b64).decode("utf-8") + with open('/app/config/core/.env', 'w', encoding='utf-8') as _f: + _f.write(config_str) + log(func_name, '\t`.env` of core wrote.') + if config_core_bot_b64.strip(): + log(func_name, '\tWriting `bot_config.toml` of core not found. Creating...') + config_str = base64.b64decode(config_core_bot_b64).decode("utf-8") + with open('/app/config/core/bot_config.toml', 'w', encoding='utf-8') as _f: + _f.write(config_str) + log(func_name, '\t`bot_config.toml` of core wrote.') + if config_core_model_b64.strip(): + log(func_name, '\tWriting `model_config.toml` of core...') + config_str = base64.b64decode(config_core_model_b64).decode("utf-8") + with open('/app/config/core/model_config.toml', 'w', encoding='utf-8') as _f: + _f.write(config_str) + log(func_name, '\t`model_config.toml` of core wrote.') + log(func_name, 'Detection done.') + + +def reconfigure_adapter(): + """调整adapter的配置文件的napcat_server和maibot_server字段,使其Service能被napcat连接以及连接到core的Service""" + func_name = 'reconfigure_adapter' + log(func_name, 'Reconfiguring `config.toml` of adapter...') + with open('/app/config/adapter/config.toml', 'r', encoding='utf-8') as _f: + config_adapter = toml.load(_f) + config_adapter.setdefault('napcat_server', {}) + config_adapter['napcat_server']['host'] = '0.0.0.0' + config_adapter['napcat_server']['port'] = 8095 + config_adapter.setdefault('maibot_server', {}) + config_adapter['maibot_server']['host'] = f'{release_name}-maibot-core' # 根据release名称动态拼接core服务的DNS名称 + config_adapter['maibot_server']['port'] = 8000 + with open('/app/config/adapter/config.toml', 'w', encoding='utf-8') as _f: + _f.write(toml.dumps(config_adapter)) + log(func_name, 'Reconfiguration done.') + + +def _scale_statefulsets(statefulsets: list[str], replicas: int, wait: bool = False, timeout: int = 300): + """调整指定几个statefulset的副本数,wait参数控制是否等待调整完成再返回""" + statefulsets = set(statefulsets) + for name in statefulsets: + apps_api.patch_namespaced_stateful_set_scale( + name=name, + namespace=namespace, + body={"spec": {"replicas": replicas}} + ) + if not wait: + return + + start_time = time.time() + while True: + remaining_pods = [] + + pods = core_api.list_namespaced_pod(namespace).items + + for pod in pods: + owners = pod.metadata.owner_references or [] + for owner in owners: + if owner.kind == "StatefulSet" and owner.name in statefulsets: + remaining_pods.append(pod.metadata.name) + + if not remaining_pods: + return + + elapsed = time.time() - start_time + if elapsed > timeout: + raise TimeoutError( + f"Timeout waiting for Pods to be deleted. " + f"Remaining Pods: {remaining_pods}" + ) + time.sleep(5) + + +def _restart_statefulset(name: str, ignore_error: bool = False): + """重启指定的statefulset""" + now = datetime.now(timezone.utc).isoformat() + body = { + "spec": { + "template": { + "metadata": { + "annotations": { + "kubectl.kubernetes.io/restartedAt": now + } + } + } + } + } + try: + apps_api.patch_namespaced_stateful_set( + name=name, + namespace=namespace, + body=body + ) + except ApiException as e: + if ignore_error: + pass + else: + raise e + + +if __name__ == '__main__': + log('main', 'Start to process data before install/upgrade...') + log('main', 'Scaling adapter and core to 0...') + _scale_statefulsets([f'{release_name}-maibot-adapter', f'{release_name}-maibot-core'], 0, wait=True) + migrate_old_config() + write_config_files() + reconfigure_adapter() + log('main', 'Scaling adapter and core to 1...') + _scale_statefulsets([f'{release_name}-maibot-adapter', f'{release_name}-maibot-core'], 1) + log('main', 'Process done.') diff --git a/helm-chart/adapter-cm-generator/requirements.txt b/helm-chart/preprocessor/requirements.txt similarity index 100% rename from helm-chart/adapter-cm-generator/requirements.txt rename to helm-chart/preprocessor/requirements.txt diff --git a/helm-chart/templates/adapter/pvc.yaml b/helm-chart/templates/adapter/pvc.yaml index 61778630..4bc24506 100644 --- a/helm-chart/templates/adapter/pvc.yaml +++ b/helm-chart/templates/adapter/pvc.yaml @@ -4,13 +4,30 @@ metadata: name: {{ .Release.Name }}-maibot-adapter namespace: {{ .Release.Namespace }} spec: - {{- if .Values.adapter.persistence.accessModes }} + {{- if .Values.adapter.persistence.data.accessModes }} accessModes: - {{ toYaml .Values.adapter.persistence.accessModes | nindent 4 }} + {{ toYaml .Values.adapter.persistence.data.accessModes | nindent 4 }} {{- end }} resources: requests: - storage: {{ .Values.adapter.persistence.size }} - {{- if .Values.adapter.persistence.storageClass }} - storageClassName: {{ .Values.adapter.persistence.storageClass | default nil }} + storage: {{ .Values.adapter.persistence.data.size }} + {{- if .Values.adapter.persistence.data.storageClass }} + storageClassName: {{ .Values.adapter.persistence.data.storageClass | default nil }} + {{- end }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-adapter-config + namespace: {{ .Release.Namespace }} +spec: + {{- if .Values.adapter.persistence.config.accessModes }} + accessModes: + {{ toYaml .Values.adapter.persistence.config.accessModes | nindent 4 }} + {{- end }} + resources: + requests: + storage: {{ .Values.adapter.persistence.config.size }} + {{- if .Values.adapter.persistence.config.storageClass }} + storageClassName: {{ .Values.adapter.persistence.config.storageClass | default nil }} {{- end }} diff --git a/helm-chart/templates/adapter/statefulset.yaml b/helm-chart/templates/adapter/statefulset.yaml index 0d9b76da..d5981b8e 100644 --- a/helm-chart/templates/adapter/statefulset.yaml +++ b/helm-chart/templates/adapter/statefulset.yaml @@ -7,7 +7,7 @@ metadata: app: {{ .Release.Name }}-maibot-adapter spec: serviceName: {{ .Release.Name }}-maibot-adapter - replicas: 1 + replicas: 0 # post-install任务初始化完毕后自动扩容至1 selector: matchLabels: app: {{ .Release.Name }}-maibot-adapter @@ -36,7 +36,6 @@ spec: name: data - mountPath: /adapters/config.toml name: config - readOnly: true subPath: config.toml {{- if .Values.adapter.image.pullSecrets }} imagePullSecrets: @@ -54,9 +53,6 @@ spec: - name: data persistentVolumeClaim: claimName: {{ .Release.Name }}-maibot-adapter - - configMap: - items: - - key: config.toml - path: config.toml - name: {{ .Release.Name }}-maibot-adapter-config - name: config + - name: config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-adapter-config diff --git a/helm-chart/templates/core/configmap-bot-config.yaml b/helm-chart/templates/core/configmap-bot-config.yaml deleted file mode 100644 index d1395296..00000000 --- a/helm-chart/templates/core/configmap-bot-config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }} -# 渲染规则: -# 初次安装,或配置了覆盖规则 -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-maibot-core-bot-config - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/resource-policy": keep -data: - bot_config.toml: | - {{ .Values.config.core_bot_config | nindent 4 }} -{{- end }} diff --git a/helm-chart/templates/core/configmap-env-config.yaml b/helm-chart/templates/core/configmap-env-config.yaml deleted file mode 100644 index 17b1d627..00000000 --- a/helm-chart/templates/core/configmap-env-config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-maibot-core-env-config - namespace: {{ .Release.Namespace }} -data: - .env: | - HOST=0.0.0.0 - PORT=8000 - WEBUI_ENABLED={{ if .Values.core.webui.enabled }}true{{ else }}false{{ end }} - WEBUI_MODE=production - WEBUI_HOST=0.0.0.0 - WEBUI_PORT=8001 diff --git a/helm-chart/templates/core/configmap-model-config.yaml b/helm-chart/templates/core/configmap-model-config.yaml deleted file mode 100644 index bf122244..00000000 --- a/helm-chart/templates/core/configmap-model-config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }} -# 渲染规则: -# 初次安装,或配置了覆盖规则 -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-maibot-core-model-config - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/resource-policy": keep -data: - model_config.toml: | - {{ .Values.config.core_model_config | nindent 4 }} -{{- end }} diff --git a/helm-chart/templates/core/pvc.yaml b/helm-chart/templates/core/pvc.yaml index e7fe15c7..66c6ac12 100644 --- a/helm-chart/templates/core/pvc.yaml +++ b/helm-chart/templates/core/pvc.yaml @@ -4,13 +4,30 @@ metadata: name: {{ .Release.Name }}-maibot-core namespace: {{ .Release.Namespace }} spec: - {{- if .Values.core.persistence.accessModes }} + {{- if .Values.core.persistence.data.accessModes }} accessModes: - {{ toYaml .Values.core.persistence.accessModes | nindent 4 }} + {{ toYaml .Values.core.persistence.data.accessModes | nindent 4 }} {{- end }} resources: requests: - storage: {{ .Values.core.persistence.size }} - {{- if .Values.core.persistence.storageClass }} - storageClassName: {{ .Values.core.persistence.storageClass | default nil }} + storage: {{ .Values.core.persistence.data.size }} + {{- if .Values.core.persistence.data.storageClass }} + storageClassName: {{ .Values.core.persistence.data.storageClass | default nil }} + {{- end }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-core-config + namespace: {{ .Release.Namespace }} +spec: + {{- if .Values.core.persistence.config.accessModes }} + accessModes: + {{ toYaml .Values.core.persistence.config.accessModes | nindent 4 }} + {{- end }} + resources: + requests: + storage: {{ .Values.core.persistence.config.size }} + {{- if .Values.core.persistence.config.storageClass }} + storageClassName: {{ .Values.core.persistence.config.storageClass | default nil }} {{- end }} diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 2bc8d14c..ff075ab0 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -7,7 +7,7 @@ metadata: app: {{ .Release.Name }}-maibot-core spec: serviceName: {{ .Release.Name }}-maibot-core - replicas: 1 + replicas: 0 # post-install任务初始化完毕后自动扩容至1 selector: matchLabels: app: {{ .Release.Name }}-maibot-core @@ -31,9 +31,9 @@ spec: value: "9943b855e72199d0f5016ea39052f1b6" {{- if .Values.core.webui.enabled }} - name: MAIBOT_WEBUI_ENABLED - value: "true" + value: {{ .Values.core.webui.enabled }} {{- end}} - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.5-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.6-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 @@ -56,59 +56,18 @@ spec: readOnly: true subPath: k8s-init.sh - mountPath: /MaiMBot/.env - name: env-config - readOnly: true + name: config subPath: .env - {{- if not .Values.core.webui.enabled }} - mountPath: /MaiMBot/config/model_config.toml - name: model-config - readOnly: true + name: config subPath: model_config.toml - mountPath: /MaiMBot/config/bot_config.toml - name: bot-config - readOnly: true + name: config subPath: bot_config.toml - {{- end }} {{- if .Values.statistics_dashboard.enabled }} - mountPath: /MaiMBot/statistics name: statistics {{- end }} - {{- if .Values.core.webui.enabled }} - - mountPath: /MaiMBot/webui-cm-sync - name: webui-cm-sync - {{- end }} - {{- if .Values.core.webui.enabled }} - - name: webui-cm-sync - image: {{ .Values.core.webui.cm_sync.image.repository | default "reg.mikumikumi.xyz/maibot/core-webui-cm-sync" }}:{{ .Values.core.webui.cm_sync.image.tag | default "0.11.5-beta" }} - imagePullPolicy: {{ .Values.core.webui.cm_sync.image.pullPolicy }} - env: - - name: PYTHONUNBUFFERED - value: "1" - - name: RELEASE_NAME - value: {{ .Release.Name }} - volumeMounts: - - mountPath: /MaiMBot/webui-cm-sync - name: webui-cm-sync - {{- end }} - {{- if .Values.core.setup_default_plugins }} - initContainers: # 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此初始化容器用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中 - - args: - - setup-plugins.py - command: - - python3 - workingDir: /MaiMBot - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.5-beta" }} - imagePullPolicy: {{ .Values.core.image.pullPolicy }} - name: setup-plugins - resources: { } - volumeMounts: - - mountPath: /MaiMBot/data - name: data - - mountPath: /MaiMBot/setup-plugins.py - name: scripts - readOnly: true - subPath: setup-plugins.py - {{- end }} serviceAccountName: {{ .Release.Name }}-maibot-sa {{- if .Values.core.image.pullSecrets }} imagePullSecrets: @@ -130,38 +89,13 @@ spec: items: - key: k8s-init.sh path: k8s-init.sh - {{- if .Values.core.setup_default_plugins }} - - key: setup-plugins.py - path: setup-plugins.py - {{- end }} name: {{ .Release.Name }}-maibot-scripts name: scripts - - configMap: - items: - - key: .env - path: .env - name: {{ .Release.Name }}-maibot-core-env-config - name: env-config - {{- if not .Values.core.webui.enabled }} - - configMap: - items: - - key: model_config.toml - path: model_config.toml - name: {{ .Release.Name }}-maibot-core-model-config - name: model-config - - configMap: - items: - - key: bot_config.toml - path: bot_config.toml - name: {{ .Release.Name }}-maibot-core-bot-config - name: bot-config - {{- end }} + - name: config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-core-config {{- if .Values.statistics_dashboard.enabled }} - name: statistics persistentVolumeClaim: claimName: {{ .Release.Name }}-maibot-statistics-dashboard {{- end }} - {{- if .Values.core.webui.enabled }} - - emptyDir: {} - name: webui-cm-sync - {{- end }} diff --git a/helm-chart/templates/napcat/statefulset.yaml b/helm-chart/templates/napcat/statefulset.yaml index 7cca56df..dc022b21 100644 --- a/helm-chart/templates/napcat/statefulset.yaml +++ b/helm-chart/templates/napcat/statefulset.yaml @@ -26,7 +26,7 @@ spec: value: "{{ .Values.napcat.permission.uid }}" - name: TZ value: Asia/Shanghai - image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.73" }} + image: {{ .Values.napcat.image.repository | default "mlikiowa/napcat-docker" }}:{{ .Values.napcat.image.tag | default "v4.9.80" }} imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} livenessProbe: failureThreshold: 3 diff --git a/helm-chart/templates/other/check-eula-privacy.yaml b/helm-chart/templates/other/check-eula-privacy.yaml index 18b0cca2..db997a60 100644 --- a/helm-chart/templates/other/check-eula-privacy.yaml +++ b/helm-chart/templates/other/check-eula-privacy.yaml @@ -1,8 +1,8 @@ # 检查EULA和PRIVACY {{- if not .Values.EULA_AGREE }} -{{- fail "You must accept the EULA by setting 'EULA_AGREE: true'. EULA: https://github.com/MaiM-with-u/MaiBot/blob/main/EULA.md" }} +{{ fail "You must accept the EULA by setting 'EULA_AGREE: true'. EULA: https://github.com/Mai-with-u/MaiBot/blob/main/EULA.md" }} {{- end }} {{- if not .Values.PRIVACY_AGREE }} -{{- fail "You must accept the Privacy Policy by setting 'PRIVACY_AGREE: true'. Privacy Policy: https://github.com/MaiM-with-u/MaiBot/blob/main/PRIVACY.md" }} +{{ fail "You must accept the Privacy Policy by setting 'PRIVACY_AGREE: true'. Privacy Policy: https://github.com/Mai-with-u/MaiBot/blob/main/PRIVACY.md" }} {{- end }} diff --git a/helm-chart/templates/other/configmap-scripts.yaml b/helm-chart/templates/other/configmap-scripts.yaml index dd61ca68..3fe96794 100644 --- a/helm-chart/templates/other/configmap-scripts.yaml +++ b/helm-chart/templates/other/configmap-scripts.yaml @@ -7,8 +7,3 @@ data: # core k8s-init.sh: | {{ .Files.Get "files/k8s-init.sh" | nindent 4 }} - # core的初始化容器 - {{- if .Values.core.setup_default_plugins }} - setup-plugins.py: | - {{ .Files.Get "files/setup-plugins.py" | nindent 4 }} - {{- end }} diff --git a/helm-chart/templates/other/job-gen-adapter-cm.yaml b/helm-chart/templates/other/job-gen-adapter-cm.yaml deleted file mode 100644 index ad01b568..00000000 --- a/helm-chart/templates/other/job-gen-adapter-cm.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# 动态生成adapter配置文件的configmap的job,仅会在部署时运行一次 -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ .Release.Name }}-maibot-adapter-cm-generator - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": post-install,post-upgrade - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded -spec: - backoffLimit: 2 - template: - spec: - serviceAccountName: {{ .Release.Name }}-maibot-sa - restartPolicy: Never - containers: - - name: adapter-cm-generator - image: {{ .Values.adapter.cm_generator.image.repository | default "reg.mikumikumi.xyz/maibot/adapter-cm-generator" }}:{{ .Values.adapter.cm_generator.image.tag | default "0.11.5-beta" }} - workingDir: /app - env: - - name: PYTHONUNBUFFERED - value: "1" - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: RELEASE_NAME - value: {{ .Release.Name }} - - name: DATA_B64 - value: {{ .Values.config.adapter_config | b64enc }} # 将配置文件编码为base64,从环境变量注入 diff --git a/helm-chart/templates/other/job-preprocessor.yaml b/helm-chart/templates/other/job-preprocessor.yaml new file mode 100644 index 00000000..76c1de19 --- /dev/null +++ b/helm-chart/templates/other/job-preprocessor.yaml @@ -0,0 +1,58 @@ +# 预处理脚本,仅会在部署前运行一次 +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Release.Name }}-maibot-preprocessor + namespace: {{ .Release.Namespace }} + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + backoffLimit: 2 + template: + spec: + serviceAccountName: {{ .Release.Name }}-maibot-sa + restartPolicy: Never + containers: + - name: preprocessor + image: {{ .Values.pre_processor.image.repository | default "reg.mikumikumi.xyz/maibot/preprocessor" }}:{{ .Values.pre_processor.image.tag | default "0.11.6-beta" }} + imagePullPolicy: {{ .Values.pre_processor.image.pullPolicy }} + env: + - name: RELEASE_NAME + value: {{ .Release.Name }} + {{- if or .Values.config.override_adapter_config .Release.IsInstall }} + - name: CONFIG_ADAPTER_B64 + value: {{ .Values.config.adapter_config | b64enc | quote }} + {{- end }} + - name: CONFIG_CORE_ENV_B64 + value: {{ tpl .Files.Get "files/.env" . | b64enc | quote }} + {{- if or .Values.config.override_core_bot_config .Release.IsInstall }} + - name: CONFIG_CORE_BOT_B64 + value: {{ .Values.config.core_bot_config | b64enc | quote }} + {{- end }} + {{- if or .Values.config.override_core_model_config .Release.IsInstall }} + - name: CONFIG_CORE_MODEL_B64 + value: {{ .Values.config.core_model_config | b64enc | quote }} + {{- end }} + volumeMounts: + - mountPath: /app/config/adapter/config.toml + name: adapter-config + subPath: config.toml + - mountPath: /app/config/core/.env + name: core-config + subPath: .env + - mountPath: /app/config/core/bot_config.toml + name: core-config + subPath: bot_config.toml + - mountPath: /app/config/core/model_config.toml + name: core-config + subPath: model_config.toml + imagePullSecrets: + {{ toYaml .Values.pre_processor.image.pullSecrets | nindent 8 }} + volumes: + - name: adapter-config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-adapter-config + - name: core-config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-core-config diff --git a/helm-chart/templates/other/rbac.yaml b/helm-chart/templates/other/rbac.yaml index 8b8075c7..2edb11b4 100644 --- a/helm-chart/templates/other/rbac.yaml +++ b/helm-chart/templates/other/rbac.yaml @@ -12,11 +12,14 @@ metadata: namespace: {{ .Release.Namespace }} rules: - apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "list", "create", "update", "patch"] + resources: ["configmaps", "pods"] + verbs: ["get", "list", "delete"] - apiGroups: ["apps"] resources: ["statefulsets"] - verbs: ["get", "list", "create", "update", "patch"] + verbs: ["get", "list", "update", "patch"] + - apiGroups: ["apps"] + resources: ["statefulsets/scale"] + verbs: ["get", "patch", "update"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index dacb8c3d..890d3ac2 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -5,6 +5,14 @@ EULA_AGREE: false PRIVACY_AGREE: false +# 预处理Job的配置 +pre_processor: + image: + repository: # 默认 reg.mikumikumi.xyz/maibot/preprocessor + tag: # 默认 0.11.6-beta + pullPolicy: IfNotPresent + pullSecrets: [ ] + # 麦麦Adapter的部署配置 adapter: @@ -29,26 +37,23 @@ adapter: nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 persistence: - storageClass: - accessModes: - - ReadWriteOnce - size: 1Gi - - # adapter的动态生成configmap的Job的配置 - cm_generator: - image: - repository: # 默认 reg.mikumikumi.xyz/maibot/adapter-cm-generator - tag: # 默认 0.11.5-beta - pullPolicy: IfNotPresent - pullSecrets: [ ] - + config: + storageClass: + accessModes: + - ReadWriteOnce + size: 10Mi + data: + storageClass: + accessModes: + - ReadWriteOnce + size: 1Gi # 麦麦本体的部署配置 core: image: repository: # 默认 sengokucola/maibot - tag: # 默认 0.11.5-beta + tag: # 默认 0.11.6-beta pullPolicy: IfNotPresent pullSecrets: [ ] @@ -58,23 +63,19 @@ core: tolerations: [ ] persistence: - storageClass: - accessModes: - - ReadWriteOnce - size: 10Gi - - setup_default_plugins: true # 启用一个初始化容器,用于为用户自动安装默认插件到存储卷中 + config: + storageClass: + accessModes: + - ReadWriteOnce + size: 10Mi + data: + storageClass: + accessModes: + - ReadWriteOnce + size: 10Gi webui: # WebUI相关配置 - # 对从helm chart 0.11.5-beta 之前的旧版升级的用户的重要提示: - # 旧版本helm chart没有配置configmap的保留策略,直接升级同时开启WebUI后会导致configmap丢失从而无法启动。 - # 这种情况可以先禁用WebUI更新一次,再启用WebUI更新一次即可解决问题。 enabled: true # 默认启用 - cm_sync: # WebUI的辅助容器配置 - image: - repository: # 默认 reg.mikumikumi.xyz/maibot/core-webui-cm-sync - tag: # 默认 0.11.5-beta - pullPolicy: IfNotPresent service: type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 port: 8001 # 服务端口 @@ -139,7 +140,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.73 + tag: # 默认 v4.9.80 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -211,15 +212,17 @@ sqlite_web: path: / pathType: Prefix -# 手动设置麦麦各部分组件的运行配置文件 +# 设置麦麦各部分组件的初始运行配置 +# 考虑到配置文件的操作复杂性增加,k8s的适配复杂度也同步增加,且WebUI可以直接修改配置文件 +# 自0.11.6-beta版本开始,各组件的配置不再存储于k8s的configmap中,而是直接存储于存储卷的实际文件中 +# 从旧版本升级的用户,旧的configmap的配置会自动迁移到新的存储卷的配置文件中 +# 此处的配置只在初次部署时或者指定覆盖时注入到MaiBot中 config: - # 启用WebUI后,配置文件的修改即可在WebUI进行。如果通过WebUI修改了配置,则实际的配置文件将与values中的配置存在差异。 - # 如果用户在k8s的ConfigMap中手动修改了配置文件,则实际的配置文件也会与values中的配置存在差异。 - # 出现上述两种情况时,为了避免helm升级麦麦时,下面values中的配置覆盖掉已有的配置文件而导致配置丢失,可以在这里禁止本次部署时的配置覆盖。 - # 注:由于adapter的配置无法通过WebUI修改,因此下面的adapter_config配置仍然会覆盖已有配置文件。 - enable_config_override_without_webui: true # 未启用WebUI时,默认覆盖 - enable_config_override_with_webui: false # 启用WebUI时,默认不覆盖 + # 指定是否用下面的配置覆盖MaiBot现有的配置文件 + override_adapter_config: false + override_core_bot_config: false + override_core_model_config: false # adapter的config.toml adapter_config: | @@ -256,7 +259,7 @@ config: # core的model_config.toml core_model_config: | [inner] - version = "1.7.8" + version = "1.8.2" # 配置文件版本号迭代规则同bot_config.toml @@ -303,7 +306,7 @@ config: api_provider = "DeepSeek" # API服务商名称(对应在api_providers中配置的服务商名称) price_in = 2.0 # 输入价格(用于API调用统计,单位:元/ M token)(可选,若无该字段,默认值为0) price_out = 8.0 # 输出价格(用于API调用统计,单位:元/ M token)(可选,若无该字段,默认值为0) - #force_stream_mode = true # 强制流式输出模式(若模型不支持非流式输出,请取消该注释,启用强制流式输出,若无该字段,默认值为false) + # force_stream_mode = true # 强制流式输出模式(若模型不支持非流式输出,请取消该注释,启用强制流式输出,若无该字段,默认值为false) [[models]] model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp" @@ -313,6 +316,7 @@ config: price_out = 3.0 [models.extra_params] # 可选的额外参数配置 enable_thinking = false # 不启用思考 + # temperature = 0.5 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 [[models]] model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp" @@ -321,7 +325,33 @@ config: price_in = 2.0 price_out = 3.0 [models.extra_params] # 可选的额外参数配置 - enable_thinking = true # 不启用思考 + enable_thinking = true # 启用思考 + # temperature = 0.7 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 + + [[models]] + model_identifier = "Qwen/Qwen3-Next-80B-A3B-Instruct" + name = "qwen3-next-80b" + api_provider = "SiliconFlow" + price_in = 1.0 + price_out = 4.0 + + [[models]] + model_identifier = "zai-org/GLM-4.6" + name = "siliconflow-glm-4.6" + api_provider = "SiliconFlow" + price_in = 3.5 + price_out = 14.0 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = false # 不启用思考 + + [[models]] + model_identifier = "zai-org/GLM-4.6" + name = "siliconflow-glm-4.6-think" + api_provider = "SiliconFlow" + price_in = 3.5 + price_out = 14.0 + [models.extra_params] # 可选的额外参数配置 + enable_thinking = true # 启用思考 [[models]] model_identifier = "deepseek-ai/DeepSeek-R1" @@ -365,63 +395,74 @@ config: model_list = ["siliconflow-deepseek-v3.2"] # 使用的模型列表,每个子项对应上面的模型名称(name) temperature = 0.2 # 模型温度,新V3建议0.1-0.3 max_tokens = 2048 # 最大输出token数 + slow_threshold = 15.0 # 慢请求阈值(秒),模型等待回复时间超过此值会输出警告日志 [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 model_list = ["qwen3-30b","qwen3-next-80b"] temperature = 0.7 max_tokens = 2048 + slow_threshold = 10.0 [model_task_config.tool_use] #工具调用模型,需要使用支持工具调用的模型 model_list = ["qwen3-30b","qwen3-next-80b"] temperature = 0.7 max_tokens = 800 + slow_threshold = 10.0 [model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习 - model_list = ["siliconflow-deepseek-v3.2-think","siliconflow-glm-4.6-think","siliconflow-glm-4.6"] + model_list = ["siliconflow-deepseek-v3.2","siliconflow-deepseek-v3.2-think","siliconflow-glm-4.6","siliconflow-glm-4.6-think"] temperature = 0.3 # 模型温度,新V3建议0.1-0.3 max_tokens = 2048 + slow_threshold = 25.0 [model_task_config.planner] #决策:负责决定麦麦该什么时候回复的模型 model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.3 max_tokens = 800 + slow_threshold = 12.0 [model_task_config.vlm] # 图像识别模型 model_list = ["qwen3-vl-30"] max_tokens = 256 + slow_threshold = 15.0 [model_task_config.voice] # 语音识别模型 model_list = ["sensevoice-small"] + slow_threshold = 12.0 - #嵌入模型 + # 嵌入模型 [model_task_config.embedding] model_list = ["bge-m3"] + slow_threshold = 5.0 - #------------LPMM知识库模型------------ + # ------------LPMM知识库模型------------ [model_task_config.lpmm_entity_extract] # 实体提取模型 model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.2 max_tokens = 800 + slow_threshold = 20.0 [model_task_config.lpmm_rdf_build] # RDF构建模型 model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.2 max_tokens = 800 + slow_threshold = 20.0 [model_task_config.lpmm_qa] # 问答模型 model_list = ["siliconflow-deepseek-v3.2"] temperature = 0.7 max_tokens = 800 + slow_threshold = 20.0 # core的bot_config.toml core_bot_config: | [inner] - version = "6.21.8" + version = "6.23.5" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- - #如果你想要修改配置文件,请递增version的值 - #如果新增项目,请阅读src/config/official_configs.py中的说明 + # 如果你想要修改配置文件,请递增version的值 + # 如果新增项目,请阅读src/config/official_configs.py中的说明 # # 版本格式:主版本号.次版本号.修订号,版本号递增规则如下: # 主版本号:MMC版本更新 @@ -441,7 +482,7 @@ config: [personality] # 建议120字以内,描述人格特质 和 身份特征 personality = "是一个女大学生,现在在读大二,会刷贴吧。" - #アイデンティティがない 生まれないらららら + # アイデンティティがない 生まれないらららら # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容 reply_style = "请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。" @@ -498,12 +539,16 @@ config: # 注意:如果为群聊,则需要设置为group,如果设置为私聊,则需要设置为private ] + reflect = false # 是否启用表达反思(Bot主动向管理员询问表达方式是否合适) + reflect_operator_id = "" # 表达反思操作员ID,格式:platform:id:type (例如 "qq:123456:private" 或 "qq:654321:group") + allow_reflect = [] # 允许进行表达反思的聊天流ID列表,格式:["qq:123456:private", "qq:654321:group", ...],只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思(前提是 reflect = true) - [chat] #麦麦的聊天设置 - talk_value = 1 #聊天频率,越小越沉默,范围0-1 + + [chat] # 麦麦的聊天设置 + talk_value = 1 # 聊天频率,越小越沉默,范围0-1 mentioned_bot_reply = true # 是否启用提及必回复 max_context_size = 30 # 上下文长度 - planner_smooth = 2 #规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0 + planner_smooth = 2 # 规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0 enable_talk_value_rules = true # 是否启用动态发言频率规则 @@ -523,6 +568,7 @@ config: [memory] max_agent_iterations = 3 # 记忆思考深度(最低为1(不深入思考)) + enable_jargon_detection = true # 记忆检索过程中是否启用黑话识别 [jargon] all_global = true # 是否开启全局黑话模式,注意,此功能关闭后,已经记录的全局黑话不会改变,需要手动删除 @@ -556,8 +602,8 @@ config: ban_msgs_regex = [ # 需要过滤的消息(原始消息)匹配的正则表达式,匹配到的消息将被过滤,若不了解正则表达式请勿修改 - #"https?://[^\\s]+", # 匹配https链接 - #"\\d{4}-\\d{2}-\\d{2}", # 匹配日期 + # "https?://[^\\s]+", # 匹配https链接 + # "\\d{4}-\\d{2}-\\d{2}", # 匹配日期 ] @@ -586,7 +632,7 @@ config: keyword_rules = [ { keywords = ["人机", "bot", "机器", "入机", "robot", "机器人", "ai", "AI"], reaction = "有人说你是人机或者机器人,否定这一事实,攻击或反问他。注意,只有认为你是机器人才回复,否则不要否认" }, { keywords = ["测试关键词回复", "test"], reaction = "回答测试成功" }, - #{ keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } + # { keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } # 在此处添加更多规则,格式同上 ] @@ -659,6 +705,7 @@ config: chat_prompts = [] - #此系统暂时移除,无效配置 + # 此系统暂时移除,无效配置 [relationship] enable_relationship = true # 是否启用关系系统 + From 185353b2a7130ae7d243012398fa7fd8509b8349 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 01:45:10 +0800 Subject: [PATCH 132/142] =?UTF-8?q?fix(helm=20chart):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?tpl=E5=87=BD=E6=95=B0=E7=9A=84=E5=8F=82=E6=95=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/other/job-preprocessor.yaml | 2 +- helm-chart/values.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/helm-chart/templates/other/job-preprocessor.yaml b/helm-chart/templates/other/job-preprocessor.yaml index 76c1de19..cacb568d 100644 --- a/helm-chart/templates/other/job-preprocessor.yaml +++ b/helm-chart/templates/other/job-preprocessor.yaml @@ -25,7 +25,7 @@ spec: value: {{ .Values.config.adapter_config | b64enc | quote }} {{- end }} - name: CONFIG_CORE_ENV_B64 - value: {{ tpl .Files.Get "files/.env" . | b64enc | quote }} + value: {{ tpl (.Files.Get "files/.env") . | b64enc | quote }} {{- if or .Values.config.override_core_bot_config .Release.IsInstall }} - name: CONFIG_CORE_BOT_B64 value: {{ .Values.config.core_bot_config | b64enc | quote }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 890d3ac2..0d612916 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -708,4 +708,3 @@ config: # 此系统暂时移除,无效配置 [relationship] enable_relationship = true # 是否启用关系系统 - From 27bc57b488958c8497175446083d2ae984d6e154 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 02:09:30 +0800 Subject: [PATCH 133/142] =?UTF-8?q?fix(helm=20chart):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?helm=20chart=E4=B8=AD=E6=97=A0=E7=94=A8=E7=9A=84=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/core/statefulset.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index ff075ab0..b0b1c670 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,10 +29,6 @@ spec: value: "99f08e0cab0190de853cb6af7d64d4de" - name: PRIVACY_AGREE value: "9943b855e72199d0f5016ea39052f1b6" - {{- if .Values.core.webui.enabled }} - - name: MAIBOT_WEBUI_ENABLED - value: {{ .Values.core.webui.enabled }} - {{- end}} image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.6-beta" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: From 5351c1ed90fa83751f007ed246a8987df4bc3f95 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 03:01:31 +0800 Subject: [PATCH 134/142] =?UTF-8?q?fix(helm=20chart):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A2=84=E5=A4=84=E7=90=86=E4=BB=BB=E5=8A=A1=E7=9A=84=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=80=89=E6=8B=A9=E5=8F=82=E6=95=B0=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=B7=A8=E8=8A=82=E7=82=B9=E5=AD=98=E5=82=A8=E5=8D=B7?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/other/job-preprocessor.yaml | 20 +++++++++---------- helm-chart/values.yaml | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/helm-chart/templates/other/job-preprocessor.yaml b/helm-chart/templates/other/job-preprocessor.yaml index cacb568d..8cb37637 100644 --- a/helm-chart/templates/other/job-preprocessor.yaml +++ b/helm-chart/templates/other/job-preprocessor.yaml @@ -35,20 +35,20 @@ spec: value: {{ .Values.config.core_model_config | b64enc | quote }} {{- end }} volumeMounts: - - mountPath: /app/config/adapter/config.toml + - mountPath: /app/config/adapter name: adapter-config - subPath: config.toml - - mountPath: /app/config/core/.env + - mountPath: /app/config/core name: core-config - subPath: .env - - mountPath: /app/config/core/bot_config.toml - name: core-config - subPath: bot_config.toml - - mountPath: /app/config/core/model_config.toml - name: core-config - subPath: model_config.toml imagePullSecrets: {{ toYaml .Values.pre_processor.image.pullSecrets | nindent 8 }} + {{- if .Values.pre_processor.nodeSelector }} + nodeSelector: + {{ toYaml .Values.pre_processor.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.pre_processor.tolerations }} + tolerations: + {{ toYaml .Values.pre_processor.tolerations | nindent 8 }} + {{- end }} volumes: - name: adapter-config persistentVolumeClaim: diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 0d612916..50a01be5 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -13,6 +13,9 @@ pre_processor: pullPolicy: IfNotPresent pullSecrets: [ ] + nodeSelector: { } + tolerations: [ ] + # 麦麦Adapter的部署配置 adapter: From 279df316c1c39613ba24511b54dbc533efe96287 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 03:09:13 +0800 Subject: [PATCH 135/142] =?UTF-8?q?fix(helm=20chart):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/preprocessor/preprocessor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py index 0edef8bd..86407641 100644 --- a/helm-chart/preprocessor/preprocessor.py +++ b/helm-chart/preprocessor/preprocessor.py @@ -122,7 +122,7 @@ def write_config_files(): """当注入了配置文件时(一般是首次安装或者用户指定覆盖),将helm chart注入的配置写入存储卷中的实际文件""" func_name = 'write_config_files' log(func_name, 'Detecting config files...') - if config_adapter_b64.strip(): + if config_adapter_b64: log(func_name, '\tWriting `config.toml` of adapter...') config_str = base64.b64decode(config_adapter_b64).decode("utf-8") with open('/app/config/adapter/config.toml', 'w', encoding='utf-8') as _f: @@ -134,13 +134,13 @@ def write_config_files(): with open('/app/config/core/.env', 'w', encoding='utf-8') as _f: _f.write(config_str) log(func_name, '\t`.env` of core wrote.') - if config_core_bot_b64.strip(): + if config_core_bot_b64: log(func_name, '\tWriting `bot_config.toml` of core not found. Creating...') config_str = base64.b64decode(config_core_bot_b64).decode("utf-8") with open('/app/config/core/bot_config.toml', 'w', encoding='utf-8') as _f: _f.write(config_str) log(func_name, '\t`bot_config.toml` of core wrote.') - if config_core_model_b64.strip(): + if config_core_model_b64: log(func_name, '\tWriting `model_config.toml` of core...') config_str = base64.b64decode(config_core_model_b64).decode("utf-8") with open('/app/config/core/model_config.toml', 'w', encoding='utf-8') as _f: From 742fb2e4c12ecb241d8cf2c675077f860672e8f9 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 03:25:25 +0800 Subject: [PATCH 136/142] =?UTF-8?q?fix(helm=20chart):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?EULA=20hash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 1 + helm-chart/preprocessor/preprocessor.py | 2 +- helm-chart/templates/core/statefulset.yaml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index 63a835b5..a79f3dca 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,6 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| +| 0.11.6-beta | 0.11.6-beta | | | 0.11.5-beta | 0.11.5-beta | ad2df627001f18996802f23c405b263e78af0d0f | | 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 | | 0.11.2-beta | 0.11.2-beta | d3c8cea00dbb97f545350f2c3d5bcaf252443df2 | diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py index 86407641..60a7f963 100644 --- a/helm-chart/preprocessor/preprocessor.py +++ b/helm-chart/preprocessor/preprocessor.py @@ -33,7 +33,7 @@ config_core_model_b64 = os.getenv("CONFIG_CORE_MODEL_B64") def log(func: str, msg: str, level: str = 'INFO'): - print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}][{func}][{level}] {msg}') + print(f'[{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}] [{level}] [{func}] {msg}') def migrate_old_config(): diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index b0b1c670..4d8589b8 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -26,7 +26,7 @@ spec: - name: TZ value: "Asia/Shanghai" - name: EULA_AGREE - value: "99f08e0cab0190de853cb6af7d64d4de" + value: "1b662741904d7155d1ce1c00b3530d0d" - name: PRIVACY_AGREE value: "9943b855e72199d0f5016ea39052f1b6" image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.6-beta" }} From f8b78734227065f27312125f4caec4c78f2c8c01 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 03:38:29 +0800 Subject: [PATCH 137/142] =?UTF-8?q?fix(helm=20chart):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?helm=20chart=E9=85=8D=E7=BD=AE=E8=BF=81=E7=A7=BB=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/preprocessor/preprocessor.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py index 60a7f963..a62c3218 100644 --- a/helm-chart/preprocessor/preprocessor.py +++ b/helm-chart/preprocessor/preprocessor.py @@ -47,14 +47,10 @@ def migrate_old_config(): 'core_model_config.toml': False } - # 如果存储卷中已存在配置文件,则警告并跳过迁移 + # 如果存储卷中已存在配置文件,则跳过迁移 if os.path.isfile('/app/config/core/bot_config.toml') or os.path.isfile('/app/config/core/model_config.toml') or \ os.path.isfile('/app/config/adapter/config.toml'): - log(func_name, 'Found existing config file(s) in PV. Migration will be skipped. ' - 'Please check the configs MANUALLY.', level='WARNING') - log(func_name, '\tIf configs were ALREADY MIGRATED, you can delete old configmaps safely.', level='WARNING') - log(func_name, '\tIf configs were NOT MIGRATED, you should MIGRATE them MANUALLY, then delete the configmaps.', - level='WARNING') + log(func_name, 'Found existing config file(s) in PV. Migration will be ignored. Done.') return def migrate_cm_to_file(cm_name: str, key_name: str, file_path: str) -> bool: From 0bfff0457e6db3f7102fb7f77c58d972634fc93c Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 14:58:23 +0800 Subject: [PATCH 138/142] =?UTF-8?q?feat(helm=20chart):=20=E6=8C=82?= =?UTF-8?q?=E8=BD=BDadapter=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6pv?= =?UTF-8?q?c=E5=88=B0core=E4=B8=AD=EF=BC=8C=E4=B8=BAWebUI=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E4=BF=AE=E6=94=B9adapter=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 19 ++++++++++++------- helm-chart/templates/core/statefulset.yaml | 6 ++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index a79f3dca..10a8f1de 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -85,7 +85,7 @@ helm install maimai \ 从旧版本升级的用户,旧的ConfigMap的配置会自动迁移到新的存储卷的配置文件中。 -### 动态生成的ConfigMap +### 部署时自动重置的配置 adapter的配置中的`napcat_server`和`maibot_server`的`host`和`port`字段,会在每次部署/更新Helm安装实例时被自动重置。 @@ -96,14 +96,19 @@ adapter的配置中的`napcat_server`和`maibot_server`的`host`和`port`字段 因此,首次部署时,ConfigMap的生成会需要一些时间,部分Pod会无法启动,等待几分钟即可。 -### 运行统计看板与core的挂载冲突 +### 跨节点PVC挂载问题 -如果启用了运行统计看板,那么statistics_dashboard会与core共同挂载statistics_dashboard存储卷,用于同步html文件。 +MaiBot的一些组件会挂载同一PVC,这主要是为了同步数据或修改配置。 -如果k8s集群有多个节点,且statistics_dashboard与core未调度到同一节点,那么就需要statistics_dashboard的PVC访问模式具备`ReadWriteMany`访问模式。 +如果k8s集群有多个节点,且共享相同PVC的Pod未调度到同一节点,那么就需要此PVC访问模式具备`ReadWriteMany`访问模式。 -不是所有存储卷的底层存储都支持`ReadWriteMany`访问模式。 +不是所有存储控制器都支持`ReadWriteMany`访问模式。 -如果你的存储底层无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将statistics_dashboard与core调度到同一节点来避免问题。 +如果你的存储控制器无法支持`ReadWriteMany`访问模式,你可以通过`nodeSelector`配置将彼此之间共享相同PVC的Pod调度到同一节点来避免问题。 -*对于预处理任务和`sqlite-web`,上述问题也同样会出现,需要注意。* +会共享PVC的组件列表: + +- `core`和`adapter`:共享`adapter-config`,用于为`core`的WebUI提供修改adapter的配置文件的能力。 +- `core`和`statistics-dashboard`:共享`statistics-dashboard`,用于同步统计数据的html文件。 +- `core`和`sqlite-web`:共享`maibot-core`,用于为`sqlite-web`提供操作MaiBot数据库的能力。 +- 部署时的预处理任务`preprocessor`和`adapter`、`core`:共享`adapter-config`和`core-config`,用于初始化`core`和`adapter`的配置文件。 diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 4d8589b8..842a57b0 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -60,6 +60,9 @@ spec: - mountPath: /MaiMBot/config/bot_config.toml name: config subPath: bot_config.toml + - mountPath: /MaiMBot/adapters-config/config.toml # WebUI修改adapter配置所用 + name: adapter-config + subPath: config.toml {{- if .Values.statistics_dashboard.enabled }} - mountPath: /MaiMBot/statistics name: statistics @@ -90,6 +93,9 @@ spec: - name: config persistentVolumeClaim: claimName: {{ .Release.Name }}-maibot-core-config + - name: adapter-config + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-adapter-config {{- if .Values.statistics_dashboard.enabled }} - name: statistics persistentVolumeClaim: From 9a1784a0523dc0e2e4e79ec8ca48a82da960a1cd Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 23 Dec 2025 14:58:58 +0800 Subject: [PATCH 139/142] =?UTF-8?q?docs(helm=20chart):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9helm=20chart=E6=96=87=E6=A1=A3=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=BA0.11.6-beta=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index 10a8f1de..7b8b530c 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,7 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| -| 0.11.6-beta | 0.11.6-beta | | +| 0.11.6-beta | 0.11.6-beta | 0bfff0457e6db3f7102fb7f77c58d972634fc93c | | 0.11.5-beta | 0.11.5-beta | ad2df627001f18996802f23c405b263e78af0d0f | | 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 | | 0.11.2-beta | 0.11.2-beta | d3c8cea00dbb97f545350f2c3d5bcaf252443df2 | From 914dfd32bd919be819ec9af60d6bd93f18197a32 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 24 Dec 2025 03:06:52 +0800 Subject: [PATCH 140/142] =?UTF-8?q?feat(helm=20chart):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0helm=20chart=E7=89=88=E6=9C=AC=E4=B8=BA0.12.0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/Chart.yaml | 4 +- helm-chart/README.md | 6 +- helm-chart/files/.env | 2 - helm-chart/preprocessor/preprocessor.py | 31 ++- helm-chart/templates/adapter/statefulset.yaml | 2 +- helm-chart/templates/core/service.yaml | 9 + helm-chart/templates/core/statefulset.yaml | 2 +- .../templates/other/job-preprocessor.yaml | 6 +- helm-chart/values.yaml | 181 ++++++++++++------ 9 files changed, 173 insertions(+), 70 deletions(-) diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml index 74cb37cb..e77ebde3 100644 --- a/helm-chart/Chart.yaml +++ b/helm-chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: maibot description: "Maimai Bot, a cyber friend dedicated to group chats" type: application -version: 0.11.6-beta -appVersion: 0.11.6-beta +version: 0.12.0 +appVersion: 0.12.0 diff --git a/helm-chart/README.md b/helm-chart/README.md index 7b8b530c..a4628516 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,6 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| +| 0.12.0 | 0.12.0 | | | 0.11.6-beta | 0.11.6-beta | 0bfff0457e6db3f7102fb7f77c58d972634fc93c | | 0.11.5-beta | 0.11.5-beta | ad2df627001f18996802f23c405b263e78af0d0f | | 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 | @@ -88,13 +89,16 @@ helm install maimai \ ### 部署时自动重置的配置 adapter的配置中的`napcat_server`和`maibot_server`的`host`和`port`字段,会在每次部署/更新Helm安装实例时被自动重置。 +core的配置中的`webui`和`maim_message`的部分字段也会在每次部署/更新Helm安装实例时被自动重置。 自动重置的原因: - core的Service的DNS名称是动态的(由安装实例名拼接),无法在adapter的配置文件中提前确定。 - 为了使adapter监听所有地址以及保持Helm Chart中配置的端口号,需要在adapter的配置文件中覆盖这些配置。 +- core的WebUI启停需要由helm chart控制,以便正常创建Service和Ingress资源。 +- core的maim_message的api server现在可以作为k8s服务暴露出来。监听的IP和端口需要由helm chart控制,以便Service正确映射。 -因此,首次部署时,ConfigMap的生成会需要一些时间,部分Pod会无法启动,等待几分钟即可。 +首次部署时,预处理任务会负责重置这些配置。这会需要一些时间,因此部署进程可能比较慢,且部分Pod可能会无法启动,等待一分钟左右即可。 ### 跨节点PVC挂载问题 diff --git a/helm-chart/files/.env b/helm-chart/files/.env index a5d1eedf..c34eed76 100644 --- a/helm-chart/files/.env +++ b/helm-chart/files/.env @@ -1,6 +1,4 @@ HOST=0.0.0.0 PORT=8000 -WEBUI_ENABLED={{ if .Values.core.webui.enabled }}true{{ else }}false{{ end }} -WEBUI_MODE=production WEBUI_HOST=0.0.0.0 WEBUI_PORT=8001 diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py index a62c3218..3600e0da 100644 --- a/helm-chart/preprocessor/preprocessor.py +++ b/helm-chart/preprocessor/preprocessor.py @@ -1,14 +1,22 @@ #!/bin/python3 # 此脚本会被helm chart的post-install hook触发,在正式部署后通过k8s的job自动运行一次。 -# 这个脚本的作用是在部署helm chart时迁移旧版ConfigMap到配置文件,并调整adapter的配置文件中的服务监听和服务连接字段。 +# 这个脚本的作用是在部署helm chart时迁移旧版ConfigMap到配置文件,调整adapter的配置文件中的服务监听和服务连接字段,调整core的配置文件中的maim_message_api_server和WebUI配置。 +# # - 迁移旧版ConfigMap到配置文件是因为0.11.6-beta之前版本的helm chart将各个配置文件存储在k8s的ConfigMap中, # 由于功能复杂度提升,自0.11.6-beta版本开始配置文件采用文件形式存储到存储卷中。 # 从旧版升级来的用户会通过这个脚本自动执行配置的迁移。 +# # - 需要调整adapter的配置文件的原因是: # 1. core的Service的DNS名称是动态的(由安装实例名拼接),无法在adapter的配置文件中提前确定。 # 用于对外连接的maibot_server.host和maibot_server.port字段,会被替换为core的Service对应的DNS名称和8000端口(硬编码,用户无需配置)。 # 2. 为了使adapter监听所有地址以及保持chart中配置的端口号,需要在adapter的配置文件中覆盖这些配置。 # 用于监听的napcat_server.host和napcat_server.port字段,会被替换为0.0.0.0和8095端口(实际映射到的Service端口会在Service中配置)。 +# +# - 需要调整core的配置文件的原因是: +# 1. core的WebUI启停需要由helm chart控制,以便正常创建Service和Ingress资源。 +# 配置文件中的webui.enabled、webui.allowed_ips将由此脚本覆盖为正确配置。 +# 2. core的maim_message的api server现在可以作为k8s服务暴露出来。监听的IP和端口需要由helm chart控制,以便Service正确映射。 +# 配置文件中的maim_message.enable_api_server、maim_message.api_server_host、maim_message.api_server_port将由此脚本覆盖为正确配置。 import os import toml @@ -26,6 +34,8 @@ apps_api = client.AppsV1Api() with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", 'r') as f: namespace = f.read().strip() release_name = os.getenv("RELEASE_NAME").strip() +is_webui_enabled = os.getenv("IS_WEBUI_ENABLED").lower() == "true" +is_maim_message_api_server_enabled = os.getenv("IS_MMSG_ENABLED").lower() == "true" config_adapter_b64 = os.getenv("CONFIG_ADAPTER_B64") config_core_env_b64 = os.getenv("CONFIG_CORE_ENV_B64") config_core_bot_b64 = os.getenv("CONFIG_CORE_BOT_B64") @@ -162,6 +172,24 @@ def reconfigure_adapter(): log(func_name, 'Reconfiguration done.') +def reconfigure_core(): + """调整core的配置文件的webui和maim_message字段,使其服务能被正确映射""" + func_name = 'reconfigure_core' + log(func_name, 'Reconfiguring `bot_config.toml` of core...') + with open('/app/config/core/bot_config.toml', 'r', encoding='utf-8') as _f: + config_core = toml.load(_f) + config_core.setdefault('webui', {}) + config_core['webui']['enabled'] = is_webui_enabled + config_core['webui']['allowed_ips'] = '0.0.0.0/0' # 部署于k8s内网,使用宽松策略 + config_core.setdefault('maim_message', {}) + config_core['maim_message']['enable_api_server'] = is_maim_message_api_server_enabled + config_core['maim_message']['api_server_host'] = '0.0.0.0' + config_core['maim_message']['api_server_port'] = 8090 + with open('/app/config/core/bot_config.toml', 'w', encoding='utf-8') as _f: + _f.write(toml.dumps(config_core)) + log(func_name, 'Reconfiguration done.') + + def _scale_statefulsets(statefulsets: list[str], replicas: int, wait: bool = False, timeout: int = 300): """调整指定几个statefulset的副本数,wait参数控制是否等待调整完成再返回""" statefulsets = set(statefulsets) @@ -232,6 +260,7 @@ if __name__ == '__main__': migrate_old_config() write_config_files() reconfigure_adapter() + reconfigure_core() log('main', 'Scaling adapter and core to 1...') _scale_statefulsets([f'{release_name}-maibot-adapter', f'{release_name}-maibot-core'], 1) log('main', 'Process done.') diff --git a/helm-chart/templates/adapter/statefulset.yaml b/helm-chart/templates/adapter/statefulset.yaml index d5981b8e..ec914b16 100644 --- a/helm-chart/templates/adapter/statefulset.yaml +++ b/helm-chart/templates/adapter/statefulset.yaml @@ -21,7 +21,7 @@ spec: env: - name: TZ value: Asia/Shanghai - image: {{ .Values.adapter.image.repository | default "unclas/maimbot-adapter" }}:{{ .Values.adapter.image.tag | default "main-20250924053857" }} + image: {{ .Values.adapter.image.repository | default "unclas/maimbot-adapter" }}:{{ .Values.adapter.image.tag | default "main-20251211074617" }} imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} ports: - containerPort: 8095 diff --git a/helm-chart/templates/core/service.yaml b/helm-chart/templates/core/service.yaml index 5b67de50..2a049eeb 100644 --- a/helm-chart/templates/core/service.yaml +++ b/helm-chart/templates/core/service.yaml @@ -20,6 +20,15 @@ spec: nodePort: {{ .Values.core.webui.service.nodePort | default nil }} {{- end }} {{- end }} + {{- if .Values.core.maim_message_api_server.enabled }} + - name: maim-message + port: {{ .Values.core.maim_message_api_server.service.port }} + protocol: TCP + targetPort: 8090 + {{- if eq .Values.core.maim_message_api_server.service.type "NodePort" }} + nodePort: {{ .Values.core.maim_message_api_server.service.nodePort | default nil }} + {{- end }} + {{- end }} selector: app: {{ .Release.Name }}-maibot-core type: ClusterIP diff --git a/helm-chart/templates/core/statefulset.yaml b/helm-chart/templates/core/statefulset.yaml index 842a57b0..50fed52d 100644 --- a/helm-chart/templates/core/statefulset.yaml +++ b/helm-chart/templates/core/statefulset.yaml @@ -29,7 +29,7 @@ spec: value: "1b662741904d7155d1ce1c00b3530d0d" - name: PRIVACY_AGREE value: "9943b855e72199d0f5016ea39052f1b6" - image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.11.6-beta" }} + image: {{ .Values.core.image.repository | default "sengokucola/maibot" }}:{{ .Values.core.image.tag | default "0.12.0" }} imagePullPolicy: {{ .Values.core.image.pullPolicy }} ports: - containerPort: 8000 diff --git a/helm-chart/templates/other/job-preprocessor.yaml b/helm-chart/templates/other/job-preprocessor.yaml index 8cb37637..8545f5af 100644 --- a/helm-chart/templates/other/job-preprocessor.yaml +++ b/helm-chart/templates/other/job-preprocessor.yaml @@ -15,11 +15,15 @@ spec: restartPolicy: Never containers: - name: preprocessor - image: {{ .Values.pre_processor.image.repository | default "reg.mikumikumi.xyz/maibot/preprocessor" }}:{{ .Values.pre_processor.image.tag | default "0.11.6-beta" }} + image: {{ .Values.pre_processor.image.repository | default "reg.mikumikumi.xyz/maibot/preprocessor" }}:{{ .Values.pre_processor.image.tag | default "0.12.0" }} imagePullPolicy: {{ .Values.pre_processor.image.pullPolicy }} env: - name: RELEASE_NAME value: {{ .Release.Name }} + - name: IS_WEBUI_ENABLED + value: {{ .Values.core.webui.enabled | quote }} + - name: IS_MMSG_ENABLED + value: {{ .Values.core.maim_message_api_server.enabled | quote }} {{- if or .Values.config.override_adapter_config .Release.IsInstall }} - name: CONFIG_ADAPTER_B64 value: {{ .Values.config.adapter_config | b64enc | quote }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 50a01be5..92e84a6e 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -9,7 +9,7 @@ PRIVACY_AGREE: false pre_processor: image: repository: # 默认 reg.mikumikumi.xyz/maibot/preprocessor - tag: # 默认 0.11.6-beta + tag: # 默认 0.12.0 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -21,7 +21,7 @@ adapter: image: repository: # 默认 unclas/maimbot-adapter - tag: # 默认 main-20250924053857 + tag: # 默认 main-20251211074617 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -40,12 +40,12 @@ adapter: nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 persistence: - config: + config: # 配置文件的存储卷 storageClass: accessModes: - ReadWriteOnce size: 10Mi - data: + data: # 数据的存储卷 storageClass: accessModes: - ReadWriteOnce @@ -56,7 +56,7 @@ core: image: repository: # 默认 sengokucola/maibot - tag: # 默认 0.11.6-beta + tag: # 默认 0.12.0 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -66,12 +66,12 @@ core: tolerations: [ ] persistence: - config: + config: # 配置文件的存储卷 storageClass: accessModes: - ReadWriteOnce size: 10Mi - data: + data: # 数据的存储卷 storageClass: accessModes: - ReadWriteOnce @@ -91,6 +91,14 @@ core: path: / pathType: Prefix + maim_message_api_server: + enabled: false + service: + type: ClusterIP # ClusterIP / NodePort 指定NodePort可以将内网的服务端口映射到物理节点的端口 + port: 8090 # 服务端口 + nodePort: # 仅在设置NodePort类型时有效,不指定则会随机分配端口 + + # 麦麦的运行统计看板配置 # 麦麦每隔一段时间会自动输出html格式的运行统计报告,此统计报告可以作为静态网页访问 # 此功能默认禁用。如果你认为报告可以被公开访问(报告包含联系人/群组名称、模型token花费信息等),则可以启用此功能 @@ -143,7 +151,7 @@ napcat: image: repository: # 默认 mlikiowa/napcat-docker - tag: # 默认 v4.9.80 + tag: # 默认 v4.9.91 pullPolicy: IfNotPresent pullSecrets: [ ] @@ -262,7 +270,7 @@ config: # core的model_config.toml core_model_config: | [inner] - version = "1.8.2" + version = "1.9.1" # 配置文件版本号迭代规则同bot_config.toml @@ -317,9 +325,11 @@ config: api_provider = "SiliconFlow" price_in = 2.0 price_out = 3.0 + # temperature = 0.5 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 + # max_tokens = 4096 # 可选:为该模型单独指定最大token数,会覆盖任务配置中的max_tokens [models.extra_params] # 可选的额外参数配置 enable_thinking = false # 不启用思考 - # temperature = 0.5 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 + [[models]] model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp" @@ -327,9 +337,11 @@ config: api_provider = "SiliconFlow" price_in = 2.0 price_out = 3.0 + # temperature = 0.7 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 + # max_tokens = 4096 # 可选:为该模型单独指定最大token数,会覆盖任务配置中的max_tokens [models.extra_params] # 可选的额外参数配置 enable_thinking = true # 启用思考 - # temperature = 0.7 # 可选:为该模型单独指定温度,会覆盖任务配置中的温度 + [[models]] model_identifier = "Qwen/Qwen3-Next-80B-A3B-Instruct" @@ -397,7 +409,7 @@ config: [model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,麦麦的情绪变化等,是麦麦必须的模型 model_list = ["siliconflow-deepseek-v3.2"] # 使用的模型列表,每个子项对应上面的模型名称(name) temperature = 0.2 # 模型温度,新V3建议0.1-0.3 - max_tokens = 2048 # 最大输出token数 + max_tokens = 4096 # 最大输出token数 slow_threshold = 15.0 # 慢请求阈值(秒),模型等待回复时间超过此值会输出警告日志 [model_task_config.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型 @@ -461,7 +473,7 @@ config: # core的bot_config.toml core_bot_config: | [inner] - version = "6.23.5" + version = "7.2.5" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- # 如果你想要修改配置文件,请递增version的值 @@ -484,21 +496,31 @@ config: [personality] # 建议120字以内,描述人格特质 和 身份特征 - personality = "是一个女大学生,现在在读大二,会刷贴吧。" + personality = "是一个大二在读女大学生,现在正在上网和群友聊天,有时有点攻击性,有时比较温柔" # アイデンティティがない 生まれないらららら - # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容 - reply_style = "请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。" + # 描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容,建议1-2行 + reply_style = "请不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。" - # 麦麦的兴趣,会影响麦麦对什么话题进行回复 - interest = "对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题" + # 多种回复风格列表,可选配置:当 non-empty 且 multiple_probability>0 时,会按概率随机从中选择一个替换 reply_style + multiple_reply_style = [ + # "你的风格平淡但不失讽刺,很简短,很白话。可以参考贴吧,微博的回复风格。", + # "用1-2个字进行回复", + # "用1-2个符号进行回复", + # "言辭凝練古雅,穿插《論語》經句卻不晦澀,以文言短句為基,輔以淺白語意,持長者溫和風範,全用繁體字表達,具先秦儒者談吐韻致。", + # "带点翻译腔,但不要太长", + ] + + # 替换概率:每次构建回复时,以该概率从 multiple_reply_style 中随机选择一个替换 reply_style(0.0-1.0) + multiple_probability = 0.3 # 麦麦的说话规则,行为风格: plan_style = """ 1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 - 3.请控制你的发言频率,不要太过频繁的发言 - 4.如果有人对你感到厌烦,请减少回复 - 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对""" + 3.你对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题 + 4.请控制你的发言频率,不要太过频繁的发言 + 5.如果有人对你感到厌烦,请减少回复 + 6.如果有人在追问你,或者话题没有说完,请你继续回复""" # 麦麦识图规则,不建议修改 visual_style = "请用中文描述这张图片的内容。如果有文字,请把文字描述概括出来,请留意其主题,直观感受,输出为一段平文本,最多30字,请注意不要分点,就输出一段文本" @@ -519,18 +541,19 @@ config: # 替换概率,每次构建人格时替换personality的概率(0.0-1.0) state_probability = 0.3 + + [expression] # 表达学习配置 learning_list = [ # 表达学习配置列表,支持按聊天流配置 - ["", "enable", "enable", "1.0"], # 全局配置:使用表达,启用学习,学习强度1.0 - ["qq:1919810:group", "enable", "enable", "1.5"], # 特定群聊配置:使用表达,启用学习,学习强度1.5 - ["qq:114514:private", "enable", "disable", "0.5"], # 特定私聊配置:使用表达,禁用学习,学习强度0.5 + ["", "enable", "enable", "enable"], # 全局配置:使用表达,启用学习,启用jargon学习 + ["qq:1919810:group", "enable", "enable", "enable"], # 特定群聊配置:使用表达,启用学习,启用jargon学习 + ["qq:114514:private", "enable", "disable", "disable"], # 特定私聊配置:使用表达,禁用学习,禁用jargon学习 # 格式说明: # 第一位: chat_stream_id,空字符串表示全局配置 # 第二位: 是否使用学到的表达 ("enable"/"disable") # 第三位: 是否学习表达 ("enable"/"disable") - # 第四位: 学习强度(浮点数),影响学习频率,最短学习时间间隔 = 300/学习强度(秒) - # 学习强度越高,学习越频繁;学习强度越低,学习越少 + # 第四位: 是否启用jargon学习 ("enable"/"disable") ] expression_groups = [ @@ -546,12 +569,17 @@ config: reflect_operator_id = "" # 表达反思操作员ID,格式:platform:id:type (例如 "qq:123456:private" 或 "qq:654321:group") allow_reflect = [] # 允许进行表达反思的聊天流ID列表,格式:["qq:123456:private", "qq:654321:group", ...],只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思(前提是 reflect = true) + all_global_jargon = true # 是否开启全局黑话模式,注意,此功能关闭后,已经记录的全局黑话不会改变,需要手动删除 + enable_jargon_explanation = true # 是否在回复前尝试对上下文中的黑话进行解释(关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习) + jargon_mode = "planner" # 黑话解释来源模式,可选: "context"(使用上下文自动匹配黑话) 或 "planner"(仅使用Planner在reply动作中给出的unknown_words列表) + [chat] # 麦麦的聊天设置 talk_value = 1 # 聊天频率,越小越沉默,范围0-1 mentioned_bot_reply = true # 是否启用提及必回复 max_context_size = 30 # 上下文长度 - planner_smooth = 2 # 规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0 + planner_smooth = 3 # 规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0 + think_mode = "dynamic" # 思考模式,可选:classic(默认浅度思考和回复)、deep(会进行比较长的,深度回复)、dynamic(动态选择两种模式) enable_talk_value_rules = true # 是否启用动态发言频率规则 @@ -559,7 +587,7 @@ config: # 推荐格式(对象数组):{ target="platform:id:type" 或 "", time="HH:MM-HH:MM", value=0.5 } # 说明: # - target 为空字符串表示全局;type 为 group/private,例如:"qq:1919810:group" 或 "qq:114514:private"; - # - 支持跨夜区间,例如 "23:00-02:00";数值范围建议 0-1。 + # - 支持跨夜区间,例如 "23:00-02:00";数值范围建议 0-1,如果 value 设置为0会自动转换为0.0001以避免除以零错误。 talk_value_rules = [ { target = "", time = "00:00-08:59", value = 0.8 }, { target = "", time = "09:00-22:59", value = 1.0 }, @@ -567,23 +595,37 @@ config: { target = "qq:114514:private", time = "00:00-23:59", value = 0.3 }, ] - include_planner_reasoning = false # 是否将planner推理加入replyer,默认关闭(不加入) - [memory] - max_agent_iterations = 3 # 记忆思考深度(最低为1(不深入思考)) + max_agent_iterations = 3 # 记忆思考深度(最低为1) + agent_timeout_seconds = 45.0 # 最长回忆时间(秒) enable_jargon_detection = true # 记忆检索过程中是否启用黑话识别 + global_memory = false # 是否允许记忆检索进行全局查询 - [jargon] - all_global = true # 是否开启全局黑话模式,注意,此功能关闭后,已经记录的全局黑话不会改变,需要手动删除 + [dream] + interval_minutes = 60 # 做梦时间间隔(分钟),默认30分钟 + max_iterations = 20 # 做梦最大轮次,默认20轮 + first_delay_seconds = 1800 # 程序启动后首次做梦前的延迟时间(秒),默认60秒 + + # 做梦结果推送目标,格式为 "platform:user_id" + # 例如: "qq:123456" 表示在做梦结束后,将梦境文本额外发送给该QQ私聊用户。 + # 为空字符串时不推送。 + dream_send = "" + + # 做梦时间段配置,格式:["HH:MM-HH:MM", ...] + # 如果列表为空,则表示全天允许做梦。 + # 如果配置了时间段,则只有在这些时间段内才会实际执行做梦流程。 + # 时间段外,调度器仍会按间隔检查,但不会进入做梦流程。 + # 支持跨夜区间,例如 "23:00-02:00" 表示从23:00到次日02:00。 + # 示例: + dream_time_ranges = [ + # "09:00-22:00", # 白天允许做梦 + "23:00-10:00", # 跨夜时间段(23:00到次日10:00) + ] + # dream_time_ranges = [] [tool] enable_tool = true # 是否启用工具 - [mood] - enable_mood = false # 是否启用情绪系统 - mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢 - # 情感特征,影响情绪的变化情况 - emotion_style = "情绪较为稳定,但遭遇特定事件的时候起伏较大" [emoji] emoji_chance = 0.4 # 麦麦激活表情包动作的概率 @@ -613,24 +655,25 @@ config: [lpmm_knowledge] # lpmm知识库配置 enable = false # 是否启用lpmm知识库 lpmm_mode = "agent" - # 可选:classic经典模式,agent 模式,结合最新的记忆一同使用 - rag_synonym_search_top_k = 10 # 同义词搜索TopK - rag_synonym_threshold = 0.8 # 同义词阈值(相似度高于此阈值的词语会被认为是同义词) - info_extraction_workers = 3 # 实体提取同时执行线程数,非Pro模型不要设置超过5 - qa_relation_search_top_k = 10 # 关系搜索TopK - qa_relation_threshold = 0.5 # 关系阈值(相似度高于此阈值的关系会被认为是相关的关系) - qa_paragraph_search_top_k = 1000 # 段落搜索TopK(不能过小,可能影响搜索结果) + # 可选择classic传统模式/agent 模式,结合新的记忆一同使用 + rag_synonym_search_top_k = 10 # 同义检索TopK + rag_synonym_threshold = 0.8 # 同义阈值,相似度高于该值的关系会被当作同义词 + info_extraction_workers = 3 # 实体抽取同时执行线程数,非Pro模型不要设置超过5 + qa_relation_search_top_k = 10 # 关系检索TopK + qa_relation_threshold = 0.5 # 关系阈值,相似度高于该值的关系会被认为是相关关系 + qa_paragraph_search_top_k = 1000 # 段落检索TopK(不能过小,可能影响搜索结果) qa_paragraph_node_weight = 0.05 # 段落节点权重(在图搜索&PPR计算中的权重,当搜索仅使用DPR时,此参数不起作用) qa_ent_filter_top_k = 10 # 实体过滤TopK qa_ppr_damping = 0.8 # PPR阻尼系数 - qa_res_top_k = 3 # 最终提供的文段TopK - embedding_dimension = 1024 # 嵌入向量维度,应该与模型的输出维度一致 + qa_res_top_k = 3 # 最终提供段落TopK + embedding_dimension = 1024 # 嵌入向量维度,输出维度一致 + # 性能与降级参数(低配机器可下调) + # 低配机器参考:单/双核或内存≤4GB(如轻量云主机/云函数/开发板),建议先关闭PPR并降低并发 + max_embedding_workers = 3 # 嵌入/抽取并发线程数 + embedding_chunk_size = 4 # 每批嵌入的条数 + max_synonym_entities = 2000 # 同义边参与的实体数上限,超限则跳过 + enable_ppr = true # 是否启用PPR,低配机器可关闭 - # keyword_rules 用于设置关键词触发的额外回复知识 - # 添加新规则方法:在 keyword_rules 数组中增加一项,格式如下: - # { keywords = ["关键词1", "关键词2"], reaction = "触发这些关键词时的回复内容" } - # 例如,添加一个新规则:当检测到“你好”或“hello”时回复“你好,有什么可以帮你?” - # { keywords = ["你好", "hello"], reaction = "你好,有什么可以帮你?" } [keyword_reaction] keyword_rules = [ { keywords = ["人机", "bot", "机器", "入机", "robot", "机器人", "ai", "AI"], reaction = "有人说你是人机或者机器人,否定这一事实,攻击或反问他。注意,只有认为你是机器人才回复,否则不要否认" }, @@ -683,19 +726,35 @@ config: show_lpmm_paragraph = false # 是否显示lpmm找到的相关文段日志 [maim_message] - auth_token = [] # 认证令牌,用于API验证,为空则不启用验证 - # 以下项目若要使用需要打开use_custom,并单独配置maim_message的服务器 - use_custom = false # 是否启用自定义的maim_message服务器,注意这需要设置新的端口,不能与.env重复 - host="127.0.0.1" - port=8090 - mode="ws" # 支持ws和tcp两种模式 - use_wss = false # 是否使用WSS安全连接,只支持ws模式 - cert_file = "" # SSL证书文件路径,仅在use_wss=true时有效 - key_file = "" # SSL密钥文件路径,仅在use_wss=true时有效 + auth_token = [] # 认证令牌,用于旧版API验证,为空则不启用验证 + + # 新版API Server配置(额外监听端口) + enable_api_server = false # 是否启用额外的新版API Server + api_server_host = "0.0.0.0" # 新版API Server主机地址 + api_server_port = 8090 # 新版API Server端口号 + api_server_use_wss = false # 新版API Server是否启用WSS + api_server_cert_file = "" # 新版API Server SSL证书文件路径 + api_server_key_file = "" # 新版API Server SSL密钥文件路径 + api_server_allowed_api_keys = [] # 新版API Server允许的API Key列表,为空则允许所有连接 [telemetry] #发送统计信息,主要是看全球有多少只麦麦 enable = true + [webui] # WebUI 独立服务器配置 + # 注意: WebUI 的监听地址(host)和端口(port)已移至 .env 文件中的 WEBUI_HOST 和 WEBUI_PORT + enabled = true # 是否启用WebUI + mode = "production" # 模式: development(开发) 或 production(生产) + + # 防爬虫配置 + anti_crawler_mode = "basic" # 防爬虫模式: false(禁用) / strict(严格) / loose(宽松) / basic(基础-只记录不阻止) + allowed_ips = "127.0.0.1" # IP白名单(逗号分隔,支持精确IP、CIDR格式和通配符) + # 示例: 127.0.0.1,192.168.1.0/24,172.17.0.0/16 + trusted_proxies = "" # 信任的代理IP列表(逗号分隔),只有来自这些IP的X-Forwarded-For才被信任 + # 示例: 127.0.0.1,192.168.1.1,172.17.0.1 + trust_xff = false # 是否启用X-Forwarded-For代理解析(默认false) + # 启用后,仍要求直连IP在trusted_proxies中才会信任XFF头 + secure_cookie = false # 是否启用安全Cookie(仅通过HTTPS传输,默认false) + [experimental] #实验性功能 # 为指定聊天添加额外的prompt配置 # 格式: ["platform:id:type:prompt内容", ...] From baa6e90be7b20050fe25dfc74c0c70653601d00e Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 24 Dec 2025 03:39:58 +0800 Subject: [PATCH 141/142] =?UTF-8?q?fix(helm=20chart):=20=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E4=BB=BB=E5=8A=A1=E6=97=A5=E5=BF=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/preprocessor/preprocessor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/preprocessor/preprocessor.py b/helm-chart/preprocessor/preprocessor.py index 3600e0da..e8fe5b11 100644 --- a/helm-chart/preprocessor/preprocessor.py +++ b/helm-chart/preprocessor/preprocessor.py @@ -141,7 +141,7 @@ def write_config_files(): _f.write(config_str) log(func_name, '\t`.env` of core wrote.') if config_core_bot_b64: - log(func_name, '\tWriting `bot_config.toml` of core not found. Creating...') + log(func_name, '\tWriting `bot_config.toml` of core...') config_str = base64.b64decode(config_core_bot_b64).decode("utf-8") with open('/app/config/core/bot_config.toml', 'w', encoding='utf-8') as _f: _f.write(config_str) From 17ab4457a356718abf22a905a516ebc96dbf8665 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 24 Dec 2025 03:45:01 +0800 Subject: [PATCH 142/142] =?UTF-8?q?docs(helm=20chart):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9helm=20chart=E6=96=87=E6=A1=A3=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=BA0.12.0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-chart/README.md b/helm-chart/README.md index a4628516..f3929696 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -10,7 +10,7 @@ | Helm Chart版本 | 对应的MaiBot版本 | Commit SHA | |----------------|--------------|------------------------------------------| -| 0.12.0 | 0.12.0 | | +| 0.12.0 | 0.12.0 | baa6e90be7b20050fe25dfc74c0c70653601d00e | | 0.11.6-beta | 0.11.6-beta | 0bfff0457e6db3f7102fb7f77c58d972634fc93c | | 0.11.5-beta | 0.11.5-beta | ad2df627001f18996802f23c405b263e78af0d0f | | 0.11.3-beta | 0.11.3-beta | cd6dc18f546f81e08803d3b8dba48e504dad9295 |