Closed kanak8278 closed 1 month ago
JBSession.user
: JBSession doesn't have user
but if you change it to user_id
it crashes in jointload
as user_id
is a column only.Ways to Solve:
jointload
on user_id
and then change the get_chat_history
.@kanak8278 I'm going to work on this issue.
@code-with-om Any update?
This is done. Fixed the issue on PR-157
The crud operations are fixed. But the messages are still not rendering in the UI.
Fix required:
create_message
calls appropriately.loadMessage
function in chat.tsx.@code-with-om Please consider the following message objects as arguments while doing changes in loadMessage
:
{
"id": "example_message",
"message_type": "text",
"turn_id": "example_turn",
"message": {
"body": "Hi"
},
"is_user_sent": true
}
{
"id": "example_message",
"message_type": "audio",
"turn_id": "example_turn",
"message": {
"media_url": "example_media_url_here"
},
"is_user_sent": false
}
{
"id": "example_message",
"message_type": "option_list",
"turn_id": "example_turn",
"message": {
"header": "",
"body": "Would you like to buy a car, service your car, test drive, buy accessories or parts, or get a warranty and protection plan?",
"footer": "",
"button_text": "Service Select",
"list_title": "Service Select",
"options": [
{
"option_id": "1",
"option_text": "Buy a Car"
},
{
"option_id": "2",
"option_text": "Service Car"
},
{
"option_id": "3",
"option_text": "Test Drive"
},
{
"option_id": "4",
"option_text": "Buy Accessories or Parts"
},
{
"option_id": "5",
"option_text": "Warranty and Protection Plan"
}
]
},
"is_user_sent": false
}
{
"id": "example_message",
"message_type": "button",
"turn_id": "example_turn",
"message": {
"header": "",
"body": "What time of day would you prefer? Morning, afternoon, or evening?",
"footer": "",
"options": [
{
"option_id": "1",
"option_text": "Morning"
},
{
"option_id": "2",
"option_text": "Afternoon"
},
{
"option_id": "3",
"option_text": "Evening"
}
]
},
"is_user_sent": false
}
{
"id": "example_msg",
"message_type": "interactive_reply",
"turn_id": "example_turn",
"message": {
"options": [
{
"option_id": "1",
"option_text": "Morning"
}
]
},
"is_user_sent": true
}
Fixed in PR -162
Describe the bug
AttributeError: type object 'JBSession' has no attribute 'user'
Endpoint:
The chats section is empty.
http://localhost:4173/chat
Error in
api
service. The error is due to the change in the column/table.Steps to reproduce
Up the JBManager and go to
http://localhost:4173/chat
Expected Behavior
Should return all the chats in the ChatBot.
Screenshots and logs
api-1 | INFO: 172.18.0.1:47506 - "GET /v1/bots HTTP/1.1" 200 OK api-1 | INFO: 172.18.0.1:47520 - "GET /v1/chats/6f5371a3-424a-43d4-811c-5c3e40516e29 HTTP/1.1" 500 Internal Server Error api-1 | ERROR: Exception in ASGI application api-1 | Traceback (most recent call last): api-1 | File "/app/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi api-1 | result = await app( # type: ignore[func-returns-value] api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__ api-1 | return await self.app(scope, receive, send) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ api-1 | await super().__call__(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/applications.py", line 116, in __call__ api-1 | await self.middleware_stack(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ api-1 | raise exc api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ api-1 | await self.app(scope, receive, _send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__ api-1 | await self.simple_response(scope, receive, send, request_headers=headers) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response api-1 | await self.app(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ api-1 | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app api-1 | raise exc api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app api-1 | await app(scope, receive, sender) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 746, in __call__ api-1 | await route.handle(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle api-1 | await self.app(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 75, in app api-1 | await wrap_app_handling_exceptions(app, request)(scope, receive, send) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app api-1 | raise exc api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app api-1 | await app(scope, receive, sender) api-1 | File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 70, in app api-1 | response = await func(request) api-1 | ^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app api-1 | raise e api-1 | File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app api-1 | raw_response = await run_endpoint_function( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function api-1 | return await dependant.call(**values) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/app/routers/v1/__init__.py", line 104, in get_chats api-1 | chats = await get_chat_history(bot_id, skip, limit) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/app/crud.py", line 79, in get_chat_history api-1 | .options(joinedload(JBSession.user)) api-1 | ^^^^^^^^^^^^^^ api-1 | AttributeError: type object 'JBSession' has no attribute 'user'
Additional Information
No response