mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 17:22:38 +02:00
fix: register clone task and sanitize cloned content
This commit is contained in:
parent
271de96cce
commit
1c98ba989d
2 changed files with 3 additions and 1 deletions
|
|
@ -65,6 +65,7 @@ celery_app = Celery(
|
||||||
"app.tasks.celery_tasks.schedule_checker_task",
|
"app.tasks.celery_tasks.schedule_checker_task",
|
||||||
"app.tasks.celery_tasks.blocknote_migration_tasks",
|
"app.tasks.celery_tasks.blocknote_migration_tasks",
|
||||||
"app.tasks.celery_tasks.document_reindex_tasks",
|
"app.tasks.celery_tasks.document_reindex_tasks",
|
||||||
|
"app.tasks.celery_tasks.clone_chat_tasks",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,7 @@ async def clone_public_chat(
|
||||||
Clone a public chat to user's account.
|
Clone a public chat to user's account.
|
||||||
|
|
||||||
Creates a new private thread with all messages and podcasts.
|
Creates a new private thread with all messages and podcasts.
|
||||||
|
Citations are stripped since they reference the original user's documents.
|
||||||
"""
|
"""
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
|
@ -291,7 +292,7 @@ async def clone_public_chat(
|
||||||
podcast_id_map: dict[int, int] = {}
|
podcast_id_map: dict[int, int] = {}
|
||||||
|
|
||||||
for msg in sorted(source_thread.messages, key=lambda m: m.created_at):
|
for msg in sorted(source_thread.messages, key=lambda m: m.created_at):
|
||||||
new_content = copy.deepcopy(msg.content)
|
new_content = sanitize_content_for_public(msg.content)
|
||||||
|
|
||||||
if isinstance(new_content, list):
|
if isinstance(new_content, list):
|
||||||
for part in new_content:
|
for part in new_content:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue