Add demo directory creation and content generation functions#30
Open
behrrad wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Introduce functionality to copy demo files to the user's current working directory if they don't already exist. Implement content generation methods, including `create_outline()` and `expand_to_content()`, utilizing the OpenAI API for improved content creation based on provided topics.
e3c8861 to
cd837b8
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the handling of demo files by introducing logic to copy a demo directory to the user’s current working directory with a fallback mechanism. It replaces the previous hardcoded demo entrypoint logic and adds an import for file operations using shutil.
- Implements copying of demo files from a packaged source to the current working directory.
- Falls back to using the packaged demo if copying fails.
- Adds the necessary import for file operations.
| f"📁 Using existing demo directory at {target_examples_dir}", | ||
| fg=typer.colors.YELLOW, | ||
| ) | ||
| except Exception as exc: # noqa: BLE001 – non-critical failure |
There was a problem hiding this comment.
Consider catching more specific exceptions (e.g. shutil.Error) instead of a generic Exception to narrow down error handling and avoid potentially masking unexpected errors.
Suggested change
| except Exception as exc: # noqa: BLE001 – non-critical failure | |
| except (FileNotFoundError, PermissionError, shutil.Error) as exc: # noqa: BLE001 – non-critical failure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a mechanism to copy demo files to the user's current working directory, improving usability and flexibility for running examples. It also includes a minor import addition for file operations. Below are the key changes:
Enhancements to demo file handling:
aiai_demo) to the user's current working directory. If the directory already exists, it uses the existing files; if copying fails, it falls back to the packaged version. This improves user experience by making the demo setup more intuitive and resilient.Minor additions:
shutilmodule import to support file operations for copying the demo directory.