Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force output URLs to use existing files if local #1413

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

Josh-XT
Copy link
Owner

@Josh-XT Josh-XT commented Mar 10, 2025

Fixes #1412

This pull request introduces a significant enhancement to the run method in the agixt/Interactions.py file. The main change is the addition of a mechanism to handle broken file references in the response by searching for and replacing them with the most similar or recently modified files in the directory.

Enhancements to file reference handling:

  • Added logic to detect broken file references in the response and attempt to replace them with the most similar or recently modified files in the working directory.
  • Implemented a similarity check using SequenceMatcher to find the best matching file when the exact file is not found.
  • Added a fallback mechanism to prefer recently created files (within the last 5 minutes) over similar names if available.
  • Updated the response to replace broken links with the found files and logged the replacements for traceability.

@Josh-XT Josh-XT marked this pull request as ready for review March 10, 2025 19:31
@Josh-XT Josh-XT merged commit 592bcdd into main Mar 10, 2025
7 checks passed
@Josh-XT Josh-XT deleted the Force-output-URLs-to-use-existing-files-if-local branch March 10, 2025 19:31
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.

Output URLs are sometimes files that do not exist
1 participant