Commit
·
6a2ef16
1
Parent(s):
acb7304
change safety score
Browse files
main.py
CHANGED
|
@@ -168,6 +168,7 @@ async def proxy(request: Request, model_path: str, api_key: str = Security(get_a
|
|
| 168 |
async def stream_generator():
|
| 169 |
try:
|
| 170 |
async for line in response.aiter_lines():
|
|
|
|
| 171 |
yield f"{line}\n"
|
| 172 |
finally:
|
| 173 |
await response.aclose()
|
|
@@ -179,6 +180,8 @@ async def proxy(request: Request, model_path: str, api_key: str = Security(get_a
|
|
| 179 |
response_data = await response.aread()
|
| 180 |
response_json = json.loads(response_data)
|
| 181 |
|
|
|
|
|
|
|
| 182 |
if 'candidates' in response_json:
|
| 183 |
for candidate in response_json.get('candidates', []):
|
| 184 |
if 'content' in candidate and 'parts' in candidate.get('content', {}):
|
|
|
|
| 168 |
async def stream_generator():
|
| 169 |
try:
|
| 170 |
async for line in response.aiter_lines():
|
| 171 |
+
print(line)
|
| 172 |
yield f"{line}\n"
|
| 173 |
finally:
|
| 174 |
await response.aclose()
|
|
|
|
| 180 |
response_data = await response.aread()
|
| 181 |
response_json = json.loads(response_data)
|
| 182 |
|
| 183 |
+
print(response_json)
|
| 184 |
+
|
| 185 |
if 'candidates' in response_json:
|
| 186 |
for candidate in response_json.get('candidates', []):
|
| 187 |
if 'content' in candidate and 'parts' in candidate.get('content', {}):
|