Skip to content

Commit 10a7012

Browse files
authored
Merge pull request #74 from redreamality/main
Feat: add openrouter support; fix: add options for no-cache and max_abstraction_num
2 parents a5991a6 + 51b64f8 commit 10a7012

File tree

7 files changed

+482
-213
lines changed

7 files changed

+482
-213
lines changed

.env.sample

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
GEMINI_PROJECT_ID=<GEMINI_PROJECT_ID>
2-
GITHUB_TOKEN=<GITHUB_TOKEN>
2+
GEMINI_API_KEY=<GEMINI_API_KEY>
3+
GITHUB_TOKEN=<GITHUB_TOKEN>
4+
OPENROUTER_API_KEY = <OPENROUTER_API_KEY>
5+
OPENROUTER_MODEL = <OPENROUTER_MODEL>

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,11 @@ coverage/
9999
llm_cache.json
100100

101101
# Output files
102-
output/
102+
output/
103+
104+
# uv manage
105+
pyproject.toml
106+
uv.lock
107+
108+
docs/*.pdf
109+
docs/design-cn.md

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ This is a tutorial project of [Pocket Flow](https://github.com/The-Pocket/Pocket
112112
- `-e, --exclude` - Files to exclude (e.g., "tests/*" "docs/*")
113113
- `-s, --max-size` - Maximum file size in bytes (default: 100KB)
114114
- `--language` - Language for the generated tutorial (default: "english")
115+
- `--max-abstractions` - Maximum number of abstractions to identify (default: 10)
116+
- `--no-cache` - Disable LLM response caching (default: caching enabled)
115117

116118
The application will crawl the repository, analyze the codebase structure, generate tutorial content in the specified language, and save the output in the specified directory (default: ./output).
117119

main.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
}
1515

1616
DEFAULT_EXCLUDE_PATTERNS = {
17+
"assets/*", "data/*", "examples/*", "images/*", "public/*", "static/*", "temp/*",
18+
"docs/*",
1719
"venv/*", ".venv/*", "*test*", "tests/*", "docs/*", "examples/*", "v1/*",
18-
"dist/*", "build/*", "experimental/*", "deprecated/*",
20+
"dist/*", "build/*", "experimental/*", "deprecated/*", "misc/*",
1921
"legacy/*", ".git/*", ".github/*", ".next/*", ".vscode/*", "obj/*", "bin/*", "node_modules/*", "*.log"
2022
}
2123

@@ -36,6 +38,10 @@ def main():
3638
parser.add_argument("-s", "--max-size", type=int, default=100000, help="Maximum file size in bytes (default: 100000, about 100KB).")
3739
# Add language parameter for multi-language support
3840
parser.add_argument("--language", default="english", help="Language for the generated tutorial (default: english)")
41+
# Add use_cache parameter to control LLM caching
42+
parser.add_argument("--no-cache", action="store_true", help="Disable LLM response caching (default: caching enabled)")
43+
# Add max_abstraction_num parameter to control the number of abstractions
44+
parser.add_argument("--max-abstractions", type=int, default=10, help="Maximum number of abstractions to identify (default: 20)")
3945

4046
args = parser.parse_args()
4147

@@ -61,6 +67,12 @@ def main():
6167

6268
# Add language for multi-language support
6369
"language": args.language,
70+
71+
# Add use_cache flag (inverse of no-cache flag)
72+
"use_cache": not args.no_cache,
73+
74+
# Add max_abstraction_num parameter
75+
"max_abstraction_num": args.max_abstractions,
6476

6577
# Outputs will be populated by the nodes
6678
"files": [],
@@ -73,6 +85,7 @@ def main():
7385

7486
# Display starting message with repository/directory and language
7587
print(f"Starting tutorial generation for: {args.repo or args.dir} in {args.language.capitalize()} language")
88+
print(f"LLM caching: {'Disabled' if args.no_cache else 'Enabled'}")
7689

7790
# Create the flow instance
7891
tutorial_flow = create_tutorial_flow()

0 commit comments

Comments
 (0)