Skip to content

Commit 2247e16

Browse files
Type Check
1 parent cccc225 commit 2247e16

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/api/plugins/chat_with_data_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ def get_answers_from_calltranscripts(
198198
]
199199
}
200200
)
201-
answer = copy.deepcopy(completion.choices[0])
201+
answer = completion.choices[0]
202202

203203
# Limit the content inside citations to 300 characters to minimize load
204-
if 'citations' in answer.message.context:
205-
for citation in answer.message.context['citations']:
206-
if 'content' in citation:
204+
if hasattr(answer.message, 'context') and 'citations' in answer.message.context:
205+
for citation in answer.message.context.get('citations', []):
206+
if isinstance(citation, dict) and 'content' in citation:
207207
citation['content'] = citation['content'][:300] + '...' if len(citation['content']) > 300 else citation['content']
208208
except BaseException:
209209
answer = 'Details could not be retrieved. Please try again later.'

0 commit comments

Comments
 (0)