| 1116 | if (!strcmp(key, "effort")) { |
| 1117 | if (!parse_reasoning_effort_value(p, effort)) { |
| 1118 | free(key); |
| 1119 | return false; |
| 1120 | } |
| 1121 | } else if (!json_skip_value(p)) { |
| 1122 | free(key); |
| 1123 | return false; |
| 1124 | } |
| 1125 | free(key); |
| 1126 | json_ws(p); |
| 1127 | if (**p == ',') (*p)++; |
| 1128 | json_ws(p); |
| 1129 | } |
| 1130 | if (**p != '}') return false; |
| 1131 | (*p)++; |
| 1132 | return true; |
| 1133 | } |
| 1134 | |
| 1135 | static bool model_alias_disables_thinking(const char *model) { |
| 1136 | return model && |
| 1137 | (!strcmp(model, "deepseek-chat") || |
| 1138 | !strcmp(model, "glm-5.2-chat") || |
| 1139 | !strcmp(model, "glm-5.2-no-think") || |
| 1140 | !strcmp(model, "glm-5.2-nothink") || |
| 1141 | !strcmp(model, "zai/glm-5.2-chat") || |
| 1142 | !strcmp(model, "glm-5.3-flash-chat") || |
| 1143 | !strcmp(model, "glm-5.3-flash-no-think") || |
| 1144 | !strcmp(model, "glm-5.3-flash-nothink") || |
| 1145 | !strcmp(model, "zai/glm-5.3-flash-chat")); |
| 1146 | } |
| 1147 | |
| 1148 | static bool model_alias_enables_thinking(const char *model) { |
| 1149 | return model && |
| 1150 | (!strcmp(model, "deepseek-reasoner") || |
| 1151 | !strcmp(model, "glm-5.2-reasoner") || |
| 1152 | !strcmp(model, "zai/glm-5.2-reasoner") || |
| 1153 | !strcmp(model, "glm-5.3-flash-reasoner") || |
| 1154 | !strcmp(model, "zai/glm-5.3-flash-reasoner")); |
| 1155 | } |
| 1156 | |
| 1157 | static server_model_syntax server_model_syntax_for_engine(ds4_engine *engine) { |
| 1158 | return ds4_engine_is_glm_dsa(engine) ? |
| 1159 | SERVER_MODEL_SYNTAX_GLM : ds4_engine_is_deepseek41(engine) ? |
| 1160 | SERVER_MODEL_SYNTAX_DEEPSEEK41 : SERVER_MODEL_SYNTAX_DEEPSEEK; |
| 1161 | } |
| 1162 | |
| 1163 | static const char *server_model_id_from_engine(ds4_engine *engine) { |
| 1164 | if (ds4_engine_is_deepseek41(engine)) return "deepseek-v4.1-flash"; |
| 1165 | if (ds4_engine_is_glm53(engine)) return "glm-5.3-flash"; |
| 1166 | if (ds4_engine_is_glm_dsa(engine)) return "glm-5.2"; |
| 1167 | return ds4_engine_model_id(engine) == 1 ? |
| 1168 | "deepseek-v4-pro" : "deepseek-v4-flash"; |
| 1169 | } |
| 1170 | |
| 1171 | static bool server_model_alias_known(const char *id) { |
| 1172 | return id && |
| 1173 | (!strcmp(id, "deepseek-v4-flash") || |
| 1174 | !strcmp(id, "deepseek-v4.1-flash") || |
| 1175 | !strcmp(id, "deepseek-v4-pro") || |
no test coverage detected