refactor: 简化智能路由中间件,优化混合格式URL处理

- 重构智能路由逻辑,在保证聊天的同时尽量简化
- 只会修改常见错误,其余的透传(方便以后维护或者不用维护)
- 常见错误都能正常聊天
- 统一前端样式
This commit is contained in:
chinrain
2025-07-03 03:01:10 +08:00
parent e18aa73456
commit ada32d526a
2 changed files with 89 additions and 143 deletions
+22 -6
View File
@@ -937,13 +937,29 @@ endblock %} {% block head_extra_styles %}
</div>
<!-- 智能路由配置 -->
<div class="mb-6">
<label class="flex items-center">
<input type="checkbox" id="URL_NORMALIZATION_ENABLED" name="URL_NORMALIZATION_ENABLED"
class="mr-2 rounded" />
<span class="font-semibold text-gray-700">启用智能路由映射</span>
</label>
<div class="flex items-center justify-between">
<label
for="URL_NORMALIZATION_ENABLED"
class="font-semibold text-gray-700"
>启用智能路由映射</label
>
<div
class="relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in"
>
<input
type="checkbox"
name="URL_NORMALIZATION_ENABLED"
id="URL_NORMALIZATION_ENABLED"
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
/>
<label
for="URL_NORMALIZATION_ENABLED"
class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"
></label>
</div>
</div>
<small class="text-gray-500 mt-1 block">
自动客户端的各种URL格式映射到正确的API端点
自动客户端请求的url拼接为正确格式(仅保证正常聊天,出现问题请关闭)
</small>
</div>
<!-- 最大失败次数 -->