Skip to content

Persistable history and Context Integration#22

Merged
ndayiemile merged 3 commits intomainfrom
persistable_history
Oct 6, 2025
Merged

Persistable history and Context Integration#22
ndayiemile merged 3 commits intomainfrom
persistable_history

Conversation

@Shen0000
Copy link
Collaborator

@Shen0000 Shen0000 commented Sep 29, 2025

Added Chat Session tracking through dictionary and threading, as well as uploading Loeb Center context documents on chat creation.

Description by Korbit AI

What change is being made?

Persist chat sessions per user with persistent history, add context integration from base knowledge files, optimize history retrieval and file uploads, and wire user-aware session handling into the API.

Why are these changes being made?

To enable long-running, context-aware conversations per user while avoiding repeated uploads and reducing latency, by caching base knowledge, organizing session state, and improving performance and reliability in chat generation.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@coveralls
Copy link

coveralls commented Sep 29, 2025

Pull Request Test Coverage Report for Build 18267397354

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 96 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-4.9%) to 80.122%

Files with Coverage Reduction New Missed Lines %
resumax_algo/gemini_model.py 96 20.61%
Totals Coverage Status
Change from base Build 18263162820: -4.9%
Covered Lines: 657
Relevant Lines: 820

💛 - Coveralls

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Redundant file uploads without caching ▹ view ✅ Fix detected
Error Handling Missing directory existence check in upload_base_knowledge_files ▹ view
Readability Unclear Comment Purpose ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
resumax_backend/resumax_api/views.py
resumax_backend/resumax_algo/gemini_model.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +181 to +194
def upload_base_knowledge_files():
"""Upload all files in the base_knowledge folder to Gemini and return their URIs."""
base_knowledge_dir = os.path.join(settings.BASE_DIR, 'base_knowledge')
client = _get_genai_client()
context_file_uris = []
for filename in os.listdir(base_knowledge_dir):
file_path = os.path.join(base_knowledge_dir, filename)
if os.path.isfile(file_path):
try:
uploaded = client.files.upload(file=pathlib.Path(file_path))
context_file_uris.append(uploaded.uri)
except Exception as e:
print(f"Error uploading {filename}: {e}")
return context_file_uris

This comment was marked as resolved.

Comment on lines +54 to +55
# You can add a clarifying text part if you want
context_parts.append(types.Part.from_text(text="These are reference documents for best practices. Use them as guidelines."))

This comment was marked as resolved.

Comment on lines +183 to +186
base_knowledge_dir = os.path.join(settings.BASE_DIR, 'base_knowledge')
client = _get_genai_client()
context_file_uris = []
for filename in os.listdir(base_knowledge_dir):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing directory existence check in upload_base_knowledge_files category Error Handling

Tell me more
What is the issue?

The function attempts to list directory contents without checking if the base_knowledge directory exists first.

Why this matters

This will raise a FileNotFoundError when the base_knowledge directory doesn't exist, causing the chat session creation to fail and preventing users from having conversations.

Suggested change ∙ Feature Preview

Add directory existence check:

base_knowledge_dir = os.path.join(settings.BASE_DIR, 'base_knowledge')
if not os.path.exists(base_knowledge_dir):
    return []
client = _get_genai_client()
context_file_uris = []
for filename in os.listdir(base_knowledge_dir):
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

@liamjdavis liamjdavis requested a review from ndayiemile October 4, 2025 17:18
@ndayiemile
Copy link
Collaborator

Great job! Work on the suggestions from Korbit, then I'll merge the changes.

@ndayiemile ndayiemile merged commit 409357e into main Oct 6, 2025
1 check passed
@ndayiemile ndayiemile deleted the persistable_history branch October 6, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants