Add interactive file read option to fulfill variables#13
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new interactive file read option for variable collection, allowing users to read variable values from files in addition to providing direct values or using MCP tools.
- Adds file selection option to interactive variable collection
- Implements file reading functionality with UTF-8 encoding and error handling
- Updates version from 0.1.1 to 0.2.1 to reflect the new feature
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Version bump from 0.1.1 to 0.2.1 |
| prompt/prompt_helper.py | Adds file reading option to interactive variable collection with validation and error handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| :param var_name: Name of the variable to collect | ||
| :return: String content of the selected file | ||
| """ | ||
| import os |
There was a problem hiding this comment.
The import statement should be moved to the top of the file with other imports rather than inside the function. This follows Python import conventions and improves code organization.
|
|
||
| try: | ||
| # Try to read the file as UTF-8 | ||
| with open(file_path, encoding='utf-8') as f: |
There was a problem hiding this comment.
[nitpick] Consider using 'r' mode explicitly for better clarity: open(file_path, 'r', encoding='utf-8')
| with open(file_path, encoding='utf-8') as f: | |
| with open(file_path, 'r', encoding='utf-8') as f: |
No description provided.