reverted to an earlier version
This commit is contained in:
18
Caddyfile
18
Caddyfile
@@ -7,23 +7,5 @@ ai-gateway.ldex.dev {
|
|||||||
output stdout
|
output stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove the server signature so Zscaler doesn't know it's a Python app
|
|
||||||
header {
|
|
||||||
-Server
|
|
||||||
Access-Control-Allow-Origin "{header.Origin}"
|
|
||||||
Access-Control-Allow-Methods "GET, POST, OPTIONS"
|
|
||||||
Access-Control-Allow-Headers "*"
|
|
||||||
Access-Control-Expose-Headers "*"
|
|
||||||
Access-Control-Allow-Credentials "true"
|
|
||||||
defer
|
|
||||||
}
|
|
||||||
|
|
||||||
@options {
|
|
||||||
method OPTIONS
|
|
||||||
}
|
|
||||||
handle @options {
|
|
||||||
respond "" 204
|
|
||||||
}
|
|
||||||
|
|
||||||
reverse_proxy ai-gateway:8000
|
reverse_proxy ai-gateway:8000
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,17 +140,13 @@ async def gemini_chat(
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import json
|
return {"status": "error", "detail": str(e)}
|
||||||
error_data = {"status": "error", "detail": str(e)}
|
|
||||||
return PlainTextResponse(content=json.dumps(error_data), media_type="text/plain")
|
|
||||||
|
|
||||||
# Final Response
|
# Final Response
|
||||||
import json
|
return {
|
||||||
response_data = {
|
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"model": "gemini",
|
"model": "gemini",
|
||||||
"response": response.text
|
"response": response.text
|
||||||
}
|
}
|
||||||
# We return PlainTextResponse to disguise the JSON from corporate firewalls
|
|
||||||
from fastapi.responses import JSONResponse, FileResponse, PlainTextResponse
|
|
||||||
return PlainTextResponse(content=json.dumps(response_data), media_type="text/plain")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user