Skip to content

Enhance prompt.txt parsing: Path resolution fix and @file@ syntax support#277

Merged
yangbobo2021 merged 2 commits into
mainfrom
feature/path-resolution-and-file-tag-#276
Feb 26, 2024
Merged

Enhance prompt.txt parsing: Path resolution fix and @file@ syntax support#277
yangbobo2021 merged 2 commits into
mainfrom
feature/path-resolution-and-file-tag-#276

Conversation

@yangbobo2021

Copy link
Copy Markdown
Contributor

This pull request introduces two key enhancements to the parsing of prompt.txt files used in our workflow processes. It addresses the issues outlined in #276 by improving path resolution and adding support for the @file@ syntax within the content of prompt.txt.

Improvements:

  • Path Resolution: We've fixed the issue where the parser was failing to accurately locate prompt.txt. The use of os.path.expanduser ensures that user directories are correctly resolved, enhancing the reliability of path access across different environments.

  • @file@ Syntax Support: The new parsing logic recognizes and substitutes the @file@ tags with the content of the actual files referenced. This allows for more dynamic and flexible workflow scripting, as files can be directly embedded into the context provided by prompt.txt.

Notes:

  • Special attention has been paid to ensuring that, if a referenced file does not exist or cannot be accessed, the @file@ tag remains unaltered, preserving the original intent.

  • A thorough testing strategy was followed to validate these improvements across various environments.

  • The documentation will need to be updated to reflect the new features and the modifications to the parsing process.

Closes #276.

- Use os.path.expanduser to correctly resolve user directory
- Wrap command prompts return value in a list for consistency
- Address issues with finding `prompt.txt`
- Added import statements for re and os modules
- Implemented logic to replace @file@ syntax with actual file content
@yangbobo2021 yangbobo2021 merged commit 8d3c002 into main Feb 26, 2024
@yangbobo2021 yangbobo2021 deleted the feature/path-resolution-and-file-tag-#276 branch February 26, 2024 05:54
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.

Enhancements to workflow prompt.txt parsing: Path resolution and @file@ syntax support

1 participant