mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-09-20 02:28:21 +00:00
Update ui.py
add a setting named USE_HYPERLINKS_FOR_SOURCES
This commit is contained in:
@@ -59,6 +59,7 @@ class Source(BaseModel):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
frozen = True
|
frozen = True
|
||||||
|
USE_HYPERLINKS_FOR_SOURCES: bool = True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def curate_sources(sources: list[Chunk]) -> list["Source"]:
|
def curate_sources(sources: list[Chunk]) -> list["Source"]:
|
||||||
@@ -128,10 +129,10 @@ class PrivateGptUi:
|
|||||||
used_files = set()
|
used_files = set()
|
||||||
for index, source in enumerate(cur_sources, start=1):
|
for index, source in enumerate(cur_sources, start=1):
|
||||||
if f"{source.file}-{source.page}" not in used_files:
|
if f"{source.file}-{source.page}" not in used_files:
|
||||||
sources_text = (
|
if settings().USE_HYPERLINKS_FOR_SOURCES:
|
||||||
sources_text
|
sources_text += f"{index}. {source.to_hyperlink()} \n\n"
|
||||||
+ f"{index}. {source.to_hyperlink()} \n\n"
|
else:
|
||||||
)
|
sources_text += f"{index}. {source.to_text()} \n\n"
|
||||||
used_files.add(f"{source.file}-{source.page}")
|
used_files.add(f"{source.file}-{source.page}")
|
||||||
sources_text += "<hr>\n\n"
|
sources_text += "<hr>\n\n"
|
||||||
full_response += sources_text
|
full_response += sources_text
|
||||||
|
Reference in New Issue
Block a user