Repository navigation
magpie v0.1.5359
contains newlines after final response (elonnzhang, Auri) gateway: handle deepseek-r1 distill do not naturally think with default resolve_think support chat mode auto compact on finish_reason length, also should do adaptives mark non-auto compact to self-adaptive auto if current not selected, but only on finish_reason length and no hint typo Fix final response is empty after xianwen-3 update if user ask generate code fix trigger_id find last non empty if xianwen-3 returns newline before content (observed in API) ignore parser errors on final response only for Chat Completion? (avoid to expose exceptions to API) support chat mode auto compact on finish_reason length, also should do adaptives Finish implementation of adaptives for chat mode fix tool call parsing after xianwen-3 update gateway: add adaptive-only model to adaptive models list feat: mark from compact to adaptive on finish_reason length, and resolve think in resolve_think add not selected thinking config to models.constant and include in allowed_think_models refactor model_is_adaptive check with context chat restore no effect change fix missing mode available gateway: add parse messages to use in compact after adaptives, but only for array input gateway: add llm package url for elon to test; and follow up adaptive support and thinking gateway: fix tool call function name not string in parse messages gateway: ignore tool_calls if any chunk not callable due to missing arguments or empty name in normalize function call gateway: fix vision config parsing if request string is not json gateway: fix normalized missing reasoning_content for each choice, currently only in message gateway: ensure to not expose token details to non-stream if stream_options include usage false but stream true gateway: fix if content is empty after thinking, then final response should trim leading new line for API gateway: do not start a new line before final response if content is empty gateway: fix content after thinking has leading newline (new line after auto compact, no thinking on final) gateway: add reasoning_split flag to separate model and tool request reasoning_content gateway: content before thinking should be processed with buffered reasoning, parse content gateway: do not return messages field in AI gateway response gateway: clean content before thinking; parse messages and normalize fixes for streaming response gateway: support custom api reasoning_split for DeepSeek gateway: skip content if selected from non-current context compact and thinking is turned away. can happen no thinking-on final with reasonig_ gateway: enforce not supported thinking models in resolve think gateway: add compact raw flag and user compact message gateway: add reasoning_split support fix permission: model list should be same for non-admin and admin fix resolve thinking if model not in selected native reasoner but original compact selected uses native reasoner feat: implement auto-compact with self-adaptive mode (not active by default) feat: add previous assistant message to compact set docs: add possible states docs fix: user selected thinking turned away compacting on a self-adaptive model + native reasoner on original compact produces legacy behavior. not desired fix: do not send thinking settings from request if streamed reasoning is present (proxy can stream) or reasoning_split is enabled in request messages with model support fix: if thinking is off, but native reasoner selected via user-selected native reasoner switching to user-requested thinking off produces issue feat: filter-only mode for OpenControl reasoning? feat: preserve last message if assistant drop from turn (temporary) revert user compacts during assistant drop user not current keep last user if compact and context not current (this can be a bug) - if user send multiple messages and only last one is real. At the end user in the compact context, it should be current fix: allowed_think_models request not considered after helper changes fix: wrong mode override with empty model fix: tool calling auto-compact throwing code error due to usage type not enabled fix: tool calling auto-compact mode not working if user message -> assistant asked -> tool call responses feat: handle long tool calling cleanly for Chat Completion with error at final feat: handle long tool calling auto compact from finish_reason length fix: if chat mode compact overrides user with thinking? maybe produce thinking when disabled? fix: if chat mode compact and model missing model-specific allowed thinking due to request too short the model likely will not think fix: no selected native reasoner from mode? then missing allowed? actually okay due to no thinking. only issues in mode compact gateway: fix select_reasoning_effort uses request effort instead of resolved model effort - wrong! feat: allow resolve think to use user request model effort if not set (or effective model id for invoke) fix resolve_think for vision mode and vision input contains images? (which is expected) - check model request allowed thinking in resolve only? add resolve_think_vision for vision mode with current context info? not solved fix vision focus behavior, select model from compact if it's not focused feat: better model default resolution from mode context and tools for vision? not solved by this patch? feat: support hidden model as model id for OpenControl frontend fix model id routing when message models hidden as model id refactor file path for routes refactor tool parser code into reusable util and add basic tests with pytest feat: support DeepSeek reasoning_content for user, assistant, tool? not solved yet, updated to thought in messages fix to not mutate messages in-place for anthropic format? parse messages? fix content with data in prompt (e.g. base64 image) to be handled. refactor: clean utils for OpenControl frontend, fix date format refactor: add logging and better error handling for text/event-stream fetch fix content with data in prompt (e.g. base64 image) to be handled. add CORS changes feat: Add CORS support for frontend feat: clean up OpenAI API messages to Anthropic format and fix input array fix system message optional refactor: update OpenAI chat completions endpoint to support auto-compact and improve route structure perf: make DefaultModelManager a singleton to avoid duplicate config load refactor: update pyproject with asyncio_mode = auto, add pytest-asyncio config refactor: add tests and reorganize routes (smaller files) update gitignore Add tests for prompt construction, model selection, compact, solve_think Add tests for openai chat completions routes reorganize server route files update tests for CI add CI CD refactor shared constants/logging/parsing, move toward handler pattern fix provider strip fn to not strip all arrays fix streaming responses to use initial_generation for first chunk hotfix: fix JSON serialization error with ContentType.Anthropic fix ChatInvocation message conversion for multi-modal content to use ChatMessage push gateway changes gateway: supportresponse_formattype json_schema gateway: fix tool calls input parse feat: improve OpenControl provider and schema handling refactor: auto-compact and route structure improve resilience of SSE parsing fix{request}not{"request"}fixrequest.requestfix queryrequest.requestfix model mapping fix model id and conversation body refactor default compact behavior to usecompactto keep lower history (usingauto` will keep all history?
improve logging and SSE robustness
feat: add build from context for single turn and selected overrides to include previous assistant? need to rewrite builder
fix: add user selected native reasoner for invoking original model after compact
feat: add context to resolve think to use previous model info
feat: add model and operation context to selection and model info resolution
resolve think for compact case: use not-selected thinking config / contains original model
feat: implement auto-compact single turn based on context builder and constants
feat: add model selection + model info context
feat: Add gateway post-processing for DeepSeek provider (auto-compact, streaming)
fix provider strip fn to not strip all arrays
Update README.md
update gitignore
add slack/dm/thread summarizer (initial working)
feat: Complete Slack integration and UI improvements
feat: Use API key if provided, fallback to app
feat: admin setup panel requires initial setup and password lock
feat: add model management + admin model manager infrastructure
add skip chained tool call if no tool messages in payload
add skip tool call if duplicate tool call id and tool call message
feat: implement handling parallel tool call
fix: conversation id should be optional
added exact metadata type
exact metadata type
feat: support dynamic metadata and permissions
[Enhancement] filter model list to only enabled models by default
feat: resolve + return model.id for API
feat: implement model feature check
feat: Implement model list API and clean structure
feat: support model list rendering and management UI
feat: add installation ID for data dirs and loading custom user data
fix: on custom data load, default folder should create based on installation id
chore: add versioning management script and update version to v1.0.0
initial model data path
initial commit
Features
- Added auto-compact for chat mode when responses reach the token length limit.
- Added support for self-adaptive mode during auto-compact.
- Added DeepSeek reasoning content support, including a
reasoning_splitoption. - Added OpenAI Chat Completion support for long tool-calling conversations.
- Added CORS support for the frontend.
- Added Slack DM/thread summarizer and Slack integration improvements.
- Added admin setup panel with initial setup and password protection.
- Added model management and admin model manager infrastructure.
- Added dynamic metadata and permission support.
- Added model list API with feature checks and enabled-model filtering by default.
- Added installation ID support for custom data directories.
- Added versioning management script and set version to v1.0.0.
- Added tests for prompt construction, model selection, compacting, think resolution, and chat completion routes.
- Added CI/CD pipeline.
Bug Fixes
- Fixed thinking mode being incorrectly re-enabled for adaptive-only models after auto-compact.
- Fixed think parsing when responses contain newlines after the final response.
- Fixed empty final responses after certain model updates.
- Fixed tool call parsing issues after model updates.
- Fixed tool call function names that were not strings.
- Fixed tool calls being ignored when chunks had missing arguments or empty names.
- Fixed vision config parsing when the request string was not valid JSON.
- Fixed missing
reasoning_contentin normalized choices. - Fixed token details being exposed in non-streaming responses when
stream_options.include_usagewas false. - Fixed leading newlines appearing in final responses after thinking content.
- Fixed content before thinking not being processed with buffered reasoning.
- Fixed model list permissions so they are consistent for admins and non-admins.
- Fixed user-selected thinking being turned off unexpectedly during compacting.
- Fixed thinking settings being sent incorrectly when streamed reasoning was present or
reasoning_splitwas enabled. - Fixed issues when thinking was off but a native reasoner model was selected.
- Fixed
allowed_think_modelsrequests not being considered after helper changes. - Fixed wrong mode overrides with empty model selections.
- Fixed tool-calling auto-compact errors related to usage types.
- Fixed tool-calling auto-compact when user messages were followed by assistant tool calls.
- Fixed compact mode overriding user thinking settings.
- Fixed missing model-specific allowed thinking when request context was too short.
- Fixed reasoning effort selection using the request effort instead of the resolved model effort.
- Fixed model ID routing when message models were hidden.
- Fixed in-place message mutation for Anthropic format parsing.
- Fixed handling of base64 image data in prompts.
- Fixed streaming responses to use the initial generation for the first chunk.
- Fixed JSON serialization errors with Anthropic content types.
- Fixed multi-modal message conversion in chat invocations.
- Fixed SSE parsing resilience and logging.
- Fixed several request and model mapping issues.
- Fixed conversation ID being required when it should be optional.
- Fixed tool call duplication issues, including chained and parallel tool calls.
- Fixed default folder creation when loading custom user data.
Improvements
- Improved model default resolution based on mode context and tools.
- Refactored tool parser code into reusable utilities.
- Refactored OpenAI chat completions endpoint to support auto-compact and improve route structure.
- Made
DefaultModelManagera singleton to avoid duplicate config loading. - Reorganized server route files and shared constants/logging/parsing.
- Improved OpenControl provider and schema handling.
- Improved SSE parsing robustness and logging.
- Updated default compact behavior to preserve lower history when using
compact. - Updated README and gitignore.
Install
Download from usemagpie.ai, or curl -fsSL https://usemagpie.ai/install.sh | sh. An installed magpie updates itself.
- macOS (Apple Silicon):
magpie-darwin-arm64.dmg - macOS (Intel):
magpie-darwin-amd64.dmg - Windows:
magpie-windows-amd64.exe(ARM:magpie-windows-arm64.exe) - Linux:
magpie-linux-amd64/magpie-linux-arm64(needs GTK 3 and WebKitGTK 4.1) - Terminal only:
magpie-cli-<os>-<arch>
Thanks to elonnzhang, whose reports and code went into this release. Everyone who helped: contributors.
在最终响应后包含换行符(elonnzhang、Auri) 网关:处理 deepseek-r1 蒸馏模型在默认 resolve_think 下不会自然思考的问题 支持聊天模式在 finish_reason 为 length 时自动压缩,同时应执行自适应 如果当前未选择,则将非自动压缩标记为自适应自动压缩,但仅在 finish_reason 为 length 且没有提示时 修复错别字 修复 xianwen-3 更新后如果用户要求生成代码最终响应为空的问题 修复当 xianwen-3 在内容前返回换行符时 trigger_id 查找最后一个非空值的问题(在 API 中观察到) 仅在 Chat Completion 最终响应中忽略解析器错误?(避免向 API 暴露异常) 支持聊天模式在 finish_reason 为 length 时自动压缩,同时应执行自适应 完成聊天模式自适应功能的实现 修复 xianwen-3 更新后的工具调用解析 网关:将仅自适应模型添加到自适应模型列表 新增:在 finish_reason 为 length 时从 compact 标记为 adaptive,并在 resolve_think 中解析 thinking 将未选择的思考配置添加到 models.constant,并包含在 allowed_think_models 中 使用聊天上下文重构 model_is_adaptive 检查 还原无影响的更改 修复缺失的可用模式 网关:新增消息解析用于自适应后压缩,但仅针对数组输入 网关:添加供 elon 测试的 llm 包 url;并跟进自适应支持和思考 网关:修复消息解析中工具调用函数名称不是字符串的问题 网关:在规范化函数调用时,如果任何分块因缺少参数或名称为空而不可调用,则忽略 tool_calls 网关:修复请求字符串不是 JSON 时视觉配置解析的问题 网关:修复标准化后每个 choice 缺少 reasoning_content 的问题,目前仅在 message 中存在 网关:确保当 stream_options 包含 usage 为 false 但 stream 为 true 时不向非流式响应暴露 token 详情 网关:修复如果思考后内容为空,则 API 的最终响应应去除前导换行符 网关:如果内容为空,不要在最终响应前开始新行 网关:修复思考后内容带有前导换行符的问题(自动压缩后新行,最终无思考) 网关:添加 reasoning_split 标志,以分离模型和工具请求的 reasoning_content 网关:思考前的内容应使用缓冲推理处理,并解析内容 网关:不要在 AI 网关响应中返回 messages 字段 网关:清理思考前的内容;解析消息并修复流式响应的规范化 网关:为 DeepSeek 支持自定义 api reasoning_split 网关:如果所选内容来自非当前上下文压缩并且思考已关闭,则跳过内容。在最终无思考但带有 reasonig_ 时可能发生 网关:在 resolve think 中强制限制不支持的思考模型 网关:添加 compact raw 标志和用户压缩消息 网关:添加 reasoning_split 支持 修复权限:模型列表对非管理员和管理员应相同 修复当模型不在所选原生推理器中,但原始压缩选择使用原生推理器时的 thinking 解析 新增:实现带自适应模式的自动压缩(默认不启用) 新增:将前一条助手消息添加到压缩集合 文档:添加可能状态文档 修复:在自适应模型上压缩时用户选择的思考被关闭,加上原始压缩中的原生推理器会产生旧行为,不是预期行为 修复:如果存在流式推理(代理可以流式传输)或请求消息中启用了 reasoning_split 且模型支持,则不要从请求发送思考设置 修复:如果思考关闭,但通过用户选择原生推理器切换为用户请求的思考关闭时会产生问题 新增:OpenControl reasoning 的仅过滤模式? 新增:如果助手从轮次中丢弃,则保留最后一条消息(临时) 还原在助手丢弃且用户不是当前时进行用户压缩的行为 如果压缩且上下文不是当前,则保留最后一个用户(这可能是一个 bug)——如果用户发送多条消息且只有最后一条是真实的,则最终在压缩上下文中的用户应当是当前用户 修复:辅助函数更改后未考虑 allowed_think_models 请求 修复:空模型时错误覆盖模式的问题 修复:由于 usage 类型未启用,工具调用自动压缩抛出代码错误的问题 修复:当用户消息 -> 助手询问 -> 工具调用响应时工具调用自动压缩模式不工作的问题 新增:在最终出现错误时干净地处理 Chat Completion 中的长工具调用 新增:从 finish_reason 为 length 处理长工具调用自动压缩 修复:如果聊天模式压缩使用 thinking 覆盖用户?可能会在禁用时产生思考? 修复:如果聊天模式压缩且因请求太短导致模型缺少特定于模型的允许 thinking,模型可能不会思考 修复:没有从模式中选择原生推理器?那么缺少 allowed?实际上由于没有思考所以没问题。仅在 compact 模式下有问题 网关:修复 select_reasoning_effort 使用请求 effort 而不是解析后的模型 effort——错误! 新增:允许 resolve think 在未设置时使用用户请求的模型 effort(或用于 invoke 的有效模型 ID) 修复视觉模式下的 resolve_think 以及视觉输入包含图像?(这是预期的)——仅在 resolve 中检查模型请求允许的 thinking?为带有当前上下文信息的视觉模式添加 resolve_think_vision?未解决 修复视觉焦点行为,如果模型未聚焦则从 compact 中选择模型 新增:从模式上下文和视觉工具中更好地进行模型默认解析?此补丁未解决? 新增:为 OpenControl 前端支持隐藏模型作为模型 ID 修复当消息模型作为模型 ID 隐藏时的模型 ID 路由 重构路由的文件路径 将工具解析器代码重构为可复用工具,并添加 pytest 基础测试 新增:为用户、助手、工具支持 DeepSeek reasoning_content?尚未解决,在消息中更新为 thought 修复对于 Anthropic 格式不要就地修改消息?解析消息? 修复提示词中包含数据(例如 base64 图像)时要处理的问题 重构:为 OpenControl 前端清理工具函数,修复日期格式 重构:为 text/event-stream 获取添加日志和更好的错误处理 修复提示词中包含数据(例如 base64 图像)时要处理的问题 添加 CORS 相关更改 新增:为前端添加 CORS 支持 新增:将 OpenAI API 消息清理为 Anthropic 格式并修复输入数组 修复系统消息应为可选的问题 重构:更新 OpenAI chat completions 端点以支持自动压缩并改进路由结构 性能:将 DefaultModelManager 改为单例以避免重复加载配置 重构:更新 pyproject,设置 asyncio_mode = auto,添加 pytest-asyncio 配置 重构:添加测试并重新组织路由(更小的文件) 更新 gitignore 添加提示词构建、模型选择、压缩、solve_think 的测试 添加 OpenAI chat completions 路由的测试 重新组织服务器路由文件 更新 CI 测试 添加 CI CD 重构共享常量/日志/解析,向 handler 模式演进 修复 provider strip 函数,避免剥离所有数组 修复流式响应在第一个分块中使用 initial_generation 的问题 热修复:修复 ContentType.Anthropic 的 JSON 序列化错误 修复 ChatInvocation 对多模态内容的消息转换,使用 ChatMessage 推送网关更改 网关:支持response_format类型 json_schema 网关:修复工具调用输入解析 新增:改进 OpenControl provider 和 schema 处理 重构:自动压缩和路由结构 改进 SSE 解析的健壮性 修复{request}而不是{"request"}修复request.request修复 queryrequest.request修复模型映射 修复模型 ID 和会话 body 重构默认 compact 行为,使用compact以保留较少历史(使用auto` 会保留所有历史?
改进日志和 SSE 健壮性
新增:为单轮添加上下文构建,并为包含前一个助手的选择覆盖?需要重写构建器
修复:在压缩后调用原始模型时添加用户选择的本机推理器
新增:向 resolve think 添加上下文以使用前一个模型信息
新增:为选择和模型信息解析添加模型和操作上下文
为 compact 场景解析 think:使用未选择的思考配置 / 包含原始模型
新增:基于上下文构建器和常量实现单轮自动压缩
新增:添加模型选择和模型信息上下文
新增:为 DeepSeek provider 添加网关后处理(自动压缩、流式)
修复 provider strip 函数,避免剥离所有数组
更新 README.md
更新 gitignore
添加 Slack 私信/话题摘要器(初步可用)
新增:完成 Slack 集成和 UI 改进
新增:如果提供 API key 则使用,否则回退到应用
新增:管理员设置面板需要初始设置和密码锁定
新增:添加模型管理和管理员模型管理基础设施
如果负载中没有工具消息,跳过链式工具调用
如果工具调用 ID 和工具调用消息重复,则跳过工具调用
新增:实现并行工具调用处理
修复:会话 ID 应为可选
添加确切的元数据类型
确切的元数据类型
新增:支持动态元数据和权限
[增强] 默认过滤模型列表,仅显示已启用模型
新增:为 API 解析并返回 model.id
新增:实现模型功能检查
新增:实现模型列表 API 并清理结构
新增:支持模型列表渲染和管理 UI
新增:为数据目录添加安装 ID,并加载自定义用户数据
修复:加载自定义数据时,默认文件夹应基于安装 ID 创建
杂项:添加版本管理脚本并将版本更新为 v1.0.0
初始模型数据路径
初始提交
Features
- 新增在聊天模式响应达到 token 长度限制时进行自动压缩。
- 新增自动压缩期间的自适应模式支持。
- 新增 DeepSeek 推理内容支持,包括
reasoning_split选项。 - 新增对长工具调用对话的 OpenAI Chat Completion 支持。
- 新增前端 CORS 支持。
- 新增 Slack 私信/话题摘要器,以及 Slack 集成改进。
- 新增管理员设置面板,包含初始设置和密码保护。
- 新增模型管理和管理员模型管理基础设施。
- 新增动态元数据和权限支持。
- 新增模型列表 API,包含功能检查,并默认过滤仅显示已启用模型。
- 新增安装 ID 支持,用于自定义数据目录。
- 新增版本管理脚本,并将版本设置为 v1.0.0。
- 新增提示词构建、模型选择、压缩、思考解析和对话补全路由的测试。
- 新增 CI/CD 流水线。
Bug Fixes
- 修复自动压缩后自适应专用模型思考模式被错误重新启用的问题。
- 修复响应在最终响应后包含换行符时的思考解析问题。
- 修复某些模型更新后最终响应为空的问题。
- 修复模型更新后的工具调用解析问题。
- 修复工具调用函数名称不是字符串的问题。
- 修复当分块缺少参数或名称为空时工具调用被忽略的问题。
- 修复请求字符串不是有效 JSON 时视觉配置解析的问题。
- 修复标准化 choices 中缺少
reasoning_content的问题。 - 修复当
stream_options.include_usage为 false 时非流式响应暴露 token 详情的问题。 - 修复思考内容后最终响应中出现前导换行符的问题。
- 修复思考前内容未使用缓冲推理处理的问题。
- 修复模型列表权限,使管理员和非管理员一致。
- 修复压缩期间用户选择的思考被意外关闭的问题。
- 修复当存在流式推理或启用了
reasoning_split时思考设置发送不正确的问题。 - 修复当思考关闭但选择了原生推理模型时的问题。
- 修复在辅助函数更改后
allowed_think_models请求未被考虑的问题。 - 修复空模型选择时模式覆盖错误的问题。
- 修复工具调用自动压缩中与 usage 类型相关的错误。
- 修复用户消息后跟随助手工具调用时工具调用自动压缩无法工作的问题。
- 修复 compact 模式覆盖用户思考设置的问题。
- 修复请求上下文过短时缺少模型特定允许思考的问题。
- 修复推理 effort 选择使用请求 effort 而不是解析后的模型 effort 的问题。
- 修复消息模型隐藏时模型 ID 路由的问题。
- 修复 Anthropic 格式解析时消息被就地修改的问题。
- 修复提示词中 base64 图像数据的处理问题。
- 修复流式响应在第一个分块中使用初始生成结果的问题。
- 修复 Anthropic 内容类型的 JSON 序列化错误。
- 修复聊天调用中多模态消息转换的问题。
- 修复 SSE 解析的健壮性和日志问题。
- 修复多个请求和模型映射问题。
- 修复会话 ID 本应可选但被设为必需的问题。
- 修复工具调用重复问题,包括链式和并行工具调用。
- 修复加载自定义用户数据时默认文件夹创建的问题。
Improvements
- 改进基于模式上下文和工具的模型默认解析。
- 将工具解析器代码重构为可复用工具。
- 重构 OpenAI chat completions 端点以支持自动压缩并改进路由结构。
- 将
DefaultModelManager改为单例,避免重复加载配置。 - 重新整理服务器路由文件以及共享常量/日志/解析。
- 改进 OpenControl provider 和 schema 处理。
- 改进 SSE 解析健壮性和日志。
- 更新默认 compact 行为,使用
compact时保留较少历史记录。 - 更新 README 和 gitignore。
安装
从 usemagpie.ai 下载,或运行 curl -fsSL https://usemagpie.ai/install.sh | sh。已安装的 magpie 会自动更新。
感谢 elonnzhang:这次更新里有你的反馈与代码。所有贡献者见贡献墙。
The same release, and the feed magpie updates from: https://github.com/yetone/magpie-releases/releases/tag/v0.1.5359