Skip to content

Commit

Permalink
[fix] TypeError: 'ChatCitation' object is not subscriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
interimblue committed Sep 3, 2024
1 parent ea241bf commit d8d1a80
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def insert_citations(text: str, citations: list[dict]):
# Process citations in the order they were provided
for citation in citations:
# Adjust start/end with offset
start, end = citation['start'] + offset, citation['end'] + offset
cited_docs = [str(int(doc[4:]) + 1) for doc in citation["document_ids"]]
start, end = citation.start + offset, citation.end + offset
cited_docs = [str(int(doc[4:]) + 1) for doc in citation.document_ids]
# Shorten citations if they're too long for convenience
if len(cited_docs) > 3:
placeholder = "[" + ", ".join(cited_docs[:3]) + "...]"
Expand Down

0 comments on commit d8d1a80

Please sign in to comment.