Skip to content

Commit

Permalink
feat:web add reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Aries-ckt committed Nov 3, 2023
1 parent 3111760 commit 3ea85a6
Show file tree
Hide file tree
Showing 25 changed files with 28 additions and 26 deletions.
12 changes: 7 additions & 5 deletions pilot/scene/chat_knowledge/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,21 @@ def parse_source_view(self, sources: List):
build knowledge reference view message to web
{
"title":"References",
"reference":{
"references":[{
"name":"aa.pdf",
"pages":["1","2","3"]
},
}]
}
"""
references = {"title": "References", "reference": {}}
references = {"title": "References", "references": []}
for item in sources:
reference = {}
source = item["source"] if "source" in item else ""
references["reference"]["name"] = source
reference["name"] = source
pages = item["pages"] if "pages" in item else []
if len(pages) > 0:
references["reference"]["pages"] = pages
reference["pages"] = pages
references["references"].append(reference)
html = (
f"""<references>{json.dumps(references, ensure_ascii=False)}</references>"""
)
Expand Down
2 changes: 1 addition & 1 deletion pilot/server/static/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pilot/server/static/404/index.html

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3ea85a6

Please sign in to comment.