mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-10 21:09:51 +02:00
improved dict score update
This commit is contained in:
parent
6b84332f1b
commit
838160e660
@ -38,12 +38,11 @@ def update_chunk_boost_components__no_commit(
|
||||
continue
|
||||
|
||||
score = data["boost_score"]
|
||||
# this will be the only boost component for now
|
||||
boost_components = {"information_content_boost": score}
|
||||
|
||||
if chunk_stats:
|
||||
# Update existing record
|
||||
chunk_stats.chunk_boost_components = boost_components
|
||||
chunk_boost_components = dict(chunk_stats.chunk_boost_components)
|
||||
chunk_boost_components["information_content_boost"] = score
|
||||
chunk_stats.chunk_boost_components = chunk_boost_components
|
||||
chunk_stats.last_modified = datetime.now(timezone.utc)
|
||||
db_session.add(chunk_stats)
|
||||
else:
|
||||
@ -51,10 +50,13 @@ def update_chunk_boost_components__no_commit(
|
||||
if score == 1.0:
|
||||
continue
|
||||
# Create new record
|
||||
# this will be the only boost component for now
|
||||
chunk_boost_components = {"information_content_boost": score}
|
||||
|
||||
chunk_stats = ChunkStats(
|
||||
document_id=data["document_id"],
|
||||
chunk_in_doc_id=chunk_in_doc_id,
|
||||
chunk_boost_components=boost_components,
|
||||
chunk_boost_components=chunk_boost_components,
|
||||
)
|
||||
db_session.add(chunk_stats)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user