Commit f55b71f
committed
server: add minimax-m2 reasoning format override for MiniMax-M2 compatibility
MiniMax-M2 models require the complete <think>...</think> block including tags
to be present in the context for proper reasoning. This mode injects a synthetic
opening <think> tag in the stream while keeping all reasoning tags inline in
message.content, ensuring the model receives the full reasoning block it needs.
Changes:
- Add COMMON_REASONING_FORMAT_MINIMAX_M2 enum value to common_reasoning_format
- Implement minimax-m2 format parsing that bypasses reasoning extraction
- Inject synthetic <think>\n chunk at slot start when minimax-m2 is active
- Track injection state with minimax_reasoning_prefix_injected slot flag
- Prepend <think>\n to generated_text for final response and chat parsing
- Prevent client reasoning_format=auto from overriding server CLI setting
- Add minimax-m2 to CLI help, README.md, and code documentation
- Handle LLAMA_TOKEN_NULL in send_partial_response to skip token recording
- Update process_token to preserve delta_to_send for streaming correctness1 parent 7db35a7 commit f55b71f
File tree
6 files changed
+61
-13
lines changed- common
- tools/server
6 files changed
+61
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3442 | 3442 | | |
3443 | 3443 | | |
3444 | 3444 | | |
| 3445 | + | |
3445 | 3446 | | |
3446 | 3447 | | |
3447 | 3448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
| |||
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
| 673 | + | |
| 674 | + | |
672 | 675 | | |
673 | 676 | | |
674 | 677 | | |
| |||
1790 | 1793 | | |
1791 | 1794 | | |
1792 | 1795 | | |
1793 | | - | |
| 1796 | + | |
| 1797 | + | |
1794 | 1798 | | |
1795 | 1799 | | |
1796 | 1800 | | |
| |||
2001 | 2005 | | |
2002 | 2006 | | |
2003 | 2007 | | |
2004 | | - | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
2005 | 2011 | | |
2006 | 2012 | | |
2007 | 2013 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
447 | 450 | | |
448 | 451 | | |
449 | 452 | | |
| |||
1660 | 1663 | | |
1661 | 1664 | | |
1662 | 1665 | | |
| 1666 | + | |
1663 | 1667 | | |
1664 | 1668 | | |
1665 | 1669 | | |
| |||
1730 | 1734 | | |
1731 | 1735 | | |
1732 | 1736 | | |
| 1737 | + | |
1733 | 1738 | | |
1734 | 1739 | | |
1735 | 1740 | | |
| |||
1856 | 1861 | | |
1857 | 1862 | | |
1858 | 1863 | | |
1859 | | - | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
1860 | 1869 | | |
1861 | | - | |
| 1870 | + | |
1862 | 1871 | | |
1863 | 1872 | | |
1864 | 1873 | | |
| |||
2793 | 2802 | | |
2794 | 2803 | | |
2795 | 2804 | | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
2796 | 2818 | | |
2797 | 2819 | | |
2798 | 2820 | | |
| |||
2848 | 2870 | | |
2849 | 2871 | | |
2850 | 2872 | | |
| 2873 | + | |
| 2874 | + | |
2851 | 2875 | | |
| 2876 | + | |
2852 | 2877 | | |
2853 | 2878 | | |
2854 | 2879 | | |
| |||
3021 | 3046 | | |
3022 | 3047 | | |
3023 | 3048 | | |
3024 | | - | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
3025 | 3054 | | |
3026 | 3055 | | |
3027 | 3056 | | |
| |||
3035 | 3064 | | |
3036 | 3065 | | |
3037 | 3066 | | |
3038 | | - | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
3039 | 3070 | | |
3040 | | - | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
3041 | 3076 | | |
3042 | 3077 | | |
3043 | 3078 | | |
| |||
3050 | 3085 | | |
3051 | 3086 | | |
3052 | 3087 | | |
3053 | | - | |
| 3088 | + | |
3054 | 3089 | | |
3055 | 3090 | | |
3056 | 3091 | | |
| |||
3068 | 3103 | | |
3069 | 3104 | | |
3070 | 3105 | | |
3071 | | - | |
3072 | | - | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
3073 | 3112 | | |
3074 | 3113 | | |
3075 | 3114 | | |
| |||
0 commit comments