mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
refactor: simplify document title assignment across various connectors by removing prefix formatting
This commit is contained in:
parent
e615a6478c
commit
04884caeef
18 changed files with 44 additions and 50 deletions
|
|
@ -327,9 +327,7 @@ async def index_airtable_records(
|
|||
)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = (
|
||||
f"Airtable Record: {record_id}"
|
||||
)
|
||||
existing_document.title = record_id
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -405,7 +403,7 @@ async def index_airtable_records(
|
|||
)
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Airtable Record: {record_id}",
|
||||
title=record_id,
|
||||
document_type=DocumentType.AIRTABLE_CONNECTOR,
|
||||
document_metadata={
|
||||
"record_id": record_id,
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ async def index_bookstack_pages(
|
|||
chunks = await create_document_chunks(full_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"BookStack - {page_name}"
|
||||
existing_document.title = page_name
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -387,7 +387,7 @@ async def index_bookstack_pages(
|
|||
logger.info(f"Creating new document for page {page_name}")
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"BookStack - {page_name}",
|
||||
title=page_name,
|
||||
document_type=DocumentType.BOOKSTACK_CONNECTOR,
|
||||
document_metadata=doc_metadata,
|
||||
content=summary_content,
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ async def index_clickup_tasks(
|
|||
chunks = await create_document_chunks(task_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Task - {task_name}"
|
||||
existing_document.title = task_name
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -376,7 +376,7 @@ async def index_clickup_tasks(
|
|||
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Task - {task_name}",
|
||||
title=task_name,
|
||||
document_type=DocumentType.CLICKUP_CONNECTOR,
|
||||
document_metadata={
|
||||
"task_id": task_id,
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ async def index_confluence_pages(
|
|||
chunks = await create_document_chunks(full_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Confluence - {page_title}"
|
||||
existing_document.title = page_title
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -387,7 +387,7 @@ async def index_confluence_pages(
|
|||
logger.info(f"Creating new document for page {page_title}")
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Confluence - {page_title}",
|
||||
title=page_title,
|
||||
document_type=DocumentType.CONFLUENCE_CONNECTOR,
|
||||
document_metadata={
|
||||
"page_id": page_id,
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ async def index_discord_messages(
|
|||
# Create and store new document
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Discord - {guild_name}#{channel_name}",
|
||||
title=f"{guild_name}#{channel_name}",
|
||||
document_type=DocumentType.DISCORD_CONNECTOR,
|
||||
document_metadata={
|
||||
"guild_name": guild_name,
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ async def _process_repository_digest(
|
|||
}
|
||||
|
||||
document = Document(
|
||||
title=f"GitHub Repository: {repo_full_name}",
|
||||
title=repo_full_name,
|
||||
document_type=DocumentType.GITHUB_CONNECTOR,
|
||||
document_metadata=doc_metadata,
|
||||
content=summary_text,
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ async def index_google_calendar_events(
|
|||
chunks = await create_document_chunks(event_markdown)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Calendar Event - {event_summary}"
|
||||
existing_document.title = event_summary
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -482,7 +482,7 @@ async def index_google_calendar_events(
|
|||
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Calendar Event - {event_summary}",
|
||||
title=event_summary,
|
||||
document_type=DocumentType.GOOGLE_CALENDAR_CONNECTOR,
|
||||
document_metadata={
|
||||
"event_id": event_id,
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ async def index_google_gmail_messages(
|
|||
chunks = await create_document_chunks(markdown_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Gmail: {subject}"
|
||||
existing_document.title = subject
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -405,7 +405,7 @@ async def index_google_gmail_messages(
|
|||
logger.info(f"Creating new document for Gmail message: {subject}")
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Gmail: {subject}",
|
||||
title=subject,
|
||||
document_type=DocumentType.GOOGLE_GMAIL_CONNECTOR,
|
||||
document_metadata={
|
||||
"message_id": message_id,
|
||||
|
|
|
|||
|
|
@ -282,9 +282,7 @@ async def index_jira_issues(
|
|||
chunks = await create_document_chunks(issue_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = (
|
||||
f"Jira - {issue_identifier}: {issue_title}"
|
||||
)
|
||||
existing_document.title = f"{issue_identifier}: {issue_title}"
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -364,7 +362,7 @@ async def index_jira_issues(
|
|||
)
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Jira - {issue_identifier}: {issue_title}",
|
||||
title=f"{issue_identifier}: {issue_title}",
|
||||
document_type=DocumentType.JIRA_CONNECTOR,
|
||||
document_metadata={
|
||||
"issue_id": issue_id,
|
||||
|
|
|
|||
|
|
@ -314,9 +314,7 @@ async def index_linear_issues(
|
|||
chunks = await create_document_chunks(issue_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = (
|
||||
f"Linear - {issue_identifier}: {issue_title}"
|
||||
)
|
||||
existing_document.title = f"{issue_identifier}: {issue_title}"
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -397,7 +395,7 @@ async def index_linear_issues(
|
|||
)
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Linear - {issue_identifier}: {issue_title}",
|
||||
title=f"{issue_identifier}: {issue_title}",
|
||||
document_type=DocumentType.LINEAR_CONNECTOR,
|
||||
document_metadata={
|
||||
"issue_id": issue_id,
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ async def index_luma_events(
|
|||
chunks = await create_document_chunks(event_markdown)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Luma Event - {event_name}"
|
||||
existing_document.title = event_name
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -455,7 +455,7 @@ async def index_luma_events(
|
|||
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Luma Event - {event_name}",
|
||||
title=event_name,
|
||||
document_type=DocumentType.LUMA_CONNECTOR,
|
||||
document_metadata={
|
||||
"event_id": event_id,
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ async def index_notion_pages(
|
|||
chunks = await create_document_chunks(markdown_content)
|
||||
|
||||
# Update existing document
|
||||
existing_document.title = f"Notion - {page_title}"
|
||||
existing_document.title = page_title
|
||||
existing_document.content = summary_content
|
||||
existing_document.content_hash = content_hash
|
||||
existing_document.embedding = summary_embedding
|
||||
|
|
@ -458,7 +458,7 @@ async def index_notion_pages(
|
|||
# Create and store new document
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Notion - {page_title}",
|
||||
title=page_title,
|
||||
document_type=DocumentType.NOTION_CONNECTOR,
|
||||
document_metadata={
|
||||
"page_title": page_title,
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ async def index_slack_messages(
|
|||
# Create and store new document
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Slack - {channel_name}",
|
||||
title=channel_name,
|
||||
document_type=DocumentType.SLACK_CONNECTOR,
|
||||
document_metadata={
|
||||
"channel_name": channel_name,
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ async def index_teams_messages(
|
|||
# Create and store new document
|
||||
document = Document(
|
||||
search_space_id=search_space_id,
|
||||
title=f"Teams - {team_name} - {channel_name}",
|
||||
title=f"{team_name} - {channel_name}",
|
||||
document_type=DocumentType.TEAMS_CONNECTOR,
|
||||
document_metadata={
|
||||
"team_name": team_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue