Commit
·
d26352f
1
Parent(s):
4c4f184
stream debug
Browse files
main.py
CHANGED
|
@@ -142,6 +142,9 @@ async def proxy(request: Request, model_path: str, api_key: str = Security(get_a
|
|
| 142 |
|
| 143 |
print(request_body_to_send)
|
| 144 |
|
|
|
|
|
|
|
|
|
|
| 145 |
req = client.build_request(
|
| 146 |
method=request.method,
|
| 147 |
url=target_url,
|
|
@@ -151,11 +154,9 @@ async def proxy(request: Request, model_path: str, api_key: str = Security(get_a
|
|
| 151 |
response = await client.send(req, stream=True)
|
| 152 |
|
| 153 |
if "streamGenerateContent" in model_path:
|
| 154 |
-
target_url = target_url + "&alt=sse"
|
| 155 |
async def stream_generator():
|
| 156 |
try:
|
| 157 |
async for line in response.aiter_lines():
|
| 158 |
-
print("here~")
|
| 159 |
print(line)
|
| 160 |
yield f"{line}\n"
|
| 161 |
finally:
|
|
|
|
| 142 |
|
| 143 |
print(request_body_to_send)
|
| 144 |
|
| 145 |
+
if "streamGenerateContent" in model_path:
|
| 146 |
+
target_url = target_url + "&alt=sse"
|
| 147 |
+
|
| 148 |
req = client.build_request(
|
| 149 |
method=request.method,
|
| 150 |
url=target_url,
|
|
|
|
| 154 |
response = await client.send(req, stream=True)
|
| 155 |
|
| 156 |
if "streamGenerateContent" in model_path:
|
|
|
|
| 157 |
async def stream_generator():
|
| 158 |
try:
|
| 159 |
async for line in response.aiter_lines():
|
|
|
|
| 160 |
print(line)
|
| 161 |
yield f"{line}\n"
|
| 162 |
finally:
|