add limits to info
This commit is contained in:
@@ -8,6 +8,7 @@ from typing import Any, Dict, List
|
||||
from flask import Blueprint, Response, current_app, jsonify, make_response, request, stream_with_context
|
||||
|
||||
from .config import BASE_INSTRUCTIONS, GPT5_CODEX_INSTRUCTIONS
|
||||
from .limits import record_rate_limits_from_response
|
||||
from .http import build_cors_headers
|
||||
from .reasoning import build_reasoning_param, extract_reasoning_from_model_name
|
||||
from .transform import convert_ollama_messages, normalize_ollama_tools
|
||||
@@ -206,6 +207,8 @@ def ollama_chat() -> Response:
|
||||
if error_resp is not None:
|
||||
return error_resp
|
||||
|
||||
record_rate_limits_from_response(upstream)
|
||||
|
||||
if upstream.status_code >= 400:
|
||||
try:
|
||||
err_body = json.loads(upstream.content.decode("utf-8", errors="ignore")) if upstream.content else {"raw": upstream.text}
|
||||
@@ -225,6 +228,7 @@ def ollama_chat() -> Response:
|
||||
parallel_tool_calls=parallel_tool_calls,
|
||||
reasoning_param=build_reasoning_param(reasoning_effort, reasoning_summary, model_reasoning),
|
||||
)
|
||||
record_rate_limits_from_response(upstream2)
|
||||
if err2 is None and upstream2 is not None and upstream2.status_code < 400:
|
||||
upstream = upstream2
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user