Ensure relevance functions for selected docs (#2063)

* ensure relevance functions for selected docs

* remove logs

* remove log
This commit is contained in:
pablodanswer 2024-08-06 14:06:44 -07:00 committed by GitHub
parent 57aec7d02a
commit e0f0cfd92e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 13 deletions

View File

@ -10,6 +10,7 @@ from danswer.chat.chat_utils import llm_doc_from_inference_section
from danswer.chat.models import DanswerContext
from danswer.chat.models import DanswerContexts
from danswer.chat.models import LlmDoc
from danswer.chat.models import SectionRelevancePiece
from danswer.db.models import Persona
from danswer.db.models import User
from danswer.dynamic_configs.interface import JSON_ro
@ -193,9 +194,20 @@ class SearchTool(Tool):
recency_bias_multiplier=1.0,
),
)
# Build selected sections for specified documents
selected_sections = [
SectionRelevancePiece(
relevant=True,
document_id=section.center_chunk.document_id,
chunk_id=section.center_chunk.chunk_id,
)
for section in self.selected_sections
]
yield ToolResponse(
id=SECTION_RELEVANCE_LIST_ID,
response=[i for i in range(len(self.selected_sections))],
response=selected_sections,
)
final_context_sections = prune_and_merge_sections(

View File

@ -1531,18 +1531,18 @@ export function ChatPage({
!isFetchingChatMessages && (
<div
className={`
mx-auto
px-4
w-searchbar-xs
2xl:w-searchbar-sm
3xl:w-searchbar
grid
gap-4
grid-cols-1
grid-rows-1
mt-4
md:grid-cols-2
mb-6`}
mx-auto
px-4
w-searchbar-xs
2xl:w-searchbar-sm
3xl:w-searchbar
grid
gap-4
grid-cols-1
grid-rows-1
mt-4
md:grid-cols-2
mb-6`}
>
{currentPersona.starter_messages.map(
(starterMessage, i) => (