remove redundant changes

This commit is contained in:
9qeklajc
2025-08-07 00:10:45 +02:00
parent 632857b52a
commit 477c67ebeb
2 changed files with 11 additions and 15 deletions
+7 -9
View File
@@ -8,10 +8,14 @@ from fastapi.responses import Response, StreamingResponse
from ..core import get_logger
from ..wallet import CurrencyUnit, recieve_token, send_token
from .cost_caculation import CostData, CostDataError, MaxCostData, calculate_cost
from .cost_caculation import (
CostData,
CostDataError,
MaxCostData,
calculate_cost,
)
from .helpers import (
UPSTREAM_BASE_URL,
check_token_balance,
create_error_response,
get_max_cost_for_model,
prepare_upstream_headers,
@@ -21,12 +25,7 @@ logger = get_logger(__name__)
async def x_cashu_handler(
headers: dict,
request: Request,
x_cashu_token: str,
path: str,
max_cost_for_model: int,
request_body_dict: dict,
request: Request, x_cashu_token: str, path: str
) -> Response | StreamingResponse:
"""Handle X-Cashu token payment requests."""
logger.info(
@@ -41,7 +40,6 @@ async def x_cashu_handler(
)
try:
check_token_balance(headers, request_body_dict, max_cost_for_model)
headers = dict(request.headers)
amount, unit, mint = await recieve_token(x_cashu_token)
headers = prepare_upstream_headers(dict(request.headers))
+4 -6
View File
@@ -494,6 +494,8 @@ async def proxy(
max_cost_for_model = get_cost_per_request(
model=request_body_dict.get("model", None)
)
check_token_balance(headers, request_body_dict, max_cost_for_model)
# Handle authentication
if x_cashu := headers.get("x-cashu", None):
logger.info(
@@ -503,13 +505,9 @@ async def proxy(
"token_preview": x_cashu[:20] + "..." if len(x_cashu) > 20 else x_cashu,
},
)
return await x_cashu_handler(
headers, request, x_cashu, path, max_cost_for_model, request_body_dict
)
return await x_cashu_handler(request, x_cashu, path)
check_token_balance(headers, request_body_dict, max_cost_for_model)
if auth := headers.get("authorization", None):
elif auth := headers.get("authorization", None):
logger.debug(
"Processing bearer token authentication",
extra={