From 8720444d86aec1a07c3d019a150ebe329b3a6eb1 Mon Sep 17 00:00:00 2001 From: kelseye Date: Fri, 7 Nov 2025 16:18:02 +0000 Subject: [PATCH] Fix chat_template (#32) - Fix chat_template (41ba56e3cd1188531e34860a18aed92b0cdc42bc) - fix: fix if message.content is none (08db92364daa5f1a8e3939edd6ab2149c7bada46) --- README.md | 55 +++++++++++++++++++++++++-------------------- chat_template.jinja | 8 ++++++- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b88d2ca..51fb280 100644 --- a/README.md +++ b/README.md @@ -26,35 +26,42 @@ library_name: transformers
-
- - Homepage - - - Agent - - - API - - - MCP - +
+ Join Our + + 💬 WeChat + | + + 🧩 Discord + + community.
-
+
+ + MiniMax Agent + | + + ⚡️ API (Now Free for a limited time!) + | + + MCP + | + + MiniMax Website + +
+
- Hugging Face - + 🤗 Hugging Face + | - GitHub - + 🐙 GitHub + | - ModelScope - + 🤖️ ModelScope + | - License - - - WeChat + 📄 License: MIT
diff --git a/chat_template.jinja b/chat_template.jinja index 8ed2385..c5806f5 100644 --- a/chat_template.jinja +++ b/chat_template.jinja @@ -18,6 +18,8 @@ {{- item }} {%- endif -%} {%- endfor -%} + {%- elif content is none -%} + {{- '' }} {%- else -%} {{- content }} {%- endif -%} @@ -118,7 +120,11 @@ {%- endfor -%} {{- toolcall_end_token}} - {%- set last_tool_call.name = message.tool_calls[-1].name -%} + {%- if message.tool_calls[-1].function -%} + {%- set last_tool_call.name = message.tool_calls[-1].function.name -%} + {%- else -%} + {%- set last_tool_call.name = message.tool_calls[-1].name -%} + {%- endif -%} {%- else -%} {%- set last_tool_call.name = none -%} {%- endif -%}