mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 14:33:57 +01:00
Handle TypeError in message content retrieval
This commit is contained in:
parent
b79ebc05b8
commit
8f920f478f
|
@ -118,7 +118,10 @@ async def handle(incoming_request: fastapi.Request):
|
||||||
|
|
||||||
for message in payload.get('messages', []):
|
for message in payload.get('messages', []):
|
||||||
if message.get('role') == 'user':
|
if message.get('role') == 'user':
|
||||||
inp += message.get('content', '') + '\n'
|
try:
|
||||||
|
inp += message.get('content', '') + '\n'
|
||||||
|
except TypeError:
|
||||||
|
inp += message['content'][0]['text'] + '\n'
|
||||||
|
|
||||||
if 'functions' in payload:
|
if 'functions' in payload:
|
||||||
inp += '\n'.join([function.get('description', '') for function in payload.get('functions', [])])
|
inp += '\n'.join([function.get('description', '') for function in payload.get('functions', [])])
|
||||||
|
|
Loading…
Reference in a new issue