mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
If text to image config isn't set, send back an error message to the client
This commit is contained in:
parent
fefaa2271d
commit
61dde8ed89
1 changed files with 7 additions and 0 deletions
|
@ -715,6 +715,13 @@ async def chat(
|
|||
)
|
||||
elif conversation_command == ConversationCommand.Image:
|
||||
image, status_code = await text_to_image(q)
|
||||
if image is None:
|
||||
content_obj = {
|
||||
"image": image,
|
||||
"intentType": "text-to-image",
|
||||
"detail": "Failed to generate image. Make sure your image generation configuration is set.",
|
||||
}
|
||||
return Response(content=json.dumps(content_obj), media_type="application/json", status_code=status_code)
|
||||
await sync_to_async(save_to_conversation_log)(q, image, user, meta_log, intent_type="text-to-image")
|
||||
content_obj = {"image": image, "intentType": "text-to-image"}
|
||||
return Response(content=json.dumps(content_obj), media_type="application/json", status_code=status_code)
|
||||
|
|
Loading…
Add table
Reference in a new issue