Rebuild profile router as secure recoverable v2
This commit is contained in:
@@ -58,6 +58,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self._json(404, {"error": {"message": "not found"}})
|
||||
|
||||
def _completion(self, body: dict) -> dict:
|
||||
delay = body.get("mock_delay", 0)
|
||||
if isinstance(delay, (int, float)) and 0 < delay <= 10:
|
||||
time.sleep(delay)
|
||||
model = body.get("model")
|
||||
if body.get("tools"):
|
||||
name = body["tools"][0]["function"]["name"]
|
||||
@@ -84,6 +87,8 @@ class Handler(BaseHTTPRequestHandler):
|
||||
"finish_reason": finish}],
|
||||
"usage": {"prompt_tokens": 10, "completion_tokens": 5,
|
||||
"total_tokens": 15},
|
||||
"mock_ctx": current_ctx(),
|
||||
"mock_authorization": self.headers.get("Authorization"),
|
||||
}
|
||||
|
||||
def _stream(self, body: dict) -> None:
|
||||
|
||||
Reference in New Issue
Block a user