-
-
Notifications
You must be signed in to change notification settings - Fork 569
Generate RAG index for HarmonyBot #727
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/usr/bin/env python3 | ||
| from pathlib import Path | ||
| import json | ||
|
|
||
| import yaml | ||
|
|
||
| OUT_DIR = Path('docs', 'llm-pack') | ||
| OUT_DIR.mkdir(parents=True, exist_ok=True) | ||
| OUT_FILE = OUT_DIR / 'harmony.cards.jsonl' | ||
|
|
||
| cards = [] | ||
|
|
||
| # API | ||
| for path in Path('Documentation/api').rglob('*.yml'): | ||
| with path.open(encoding='utf-8') as f: | ||
| data = yaml.safe_load(f) | ||
| for item in data.get('items', []): | ||
| uid = item.get('uid') | ||
| kind = (item.get('type') or '').lower() | ||
| if not uid or not kind: | ||
| continue | ||
| summary = item.get('summary') | ||
| signature = item.get('syntax', {}).get('content') | ||
| remarks = item.get('remarks') | ||
| parent = item.get('parent') | ||
| doc_page = uid if not parent or parent == 'HarmonyLib' else parent | ||
| doc_url = f'https://harmony.pardeike.net/docs/api/{doc_page}.html' | ||
| cards.append({ | ||
|
Comment on lines
+13
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Generated API URLs break for generic types The LLM pack builds API URLs by concatenating the raw Useful? React with 👍 / 👎. |
||
| 'id': uid, | ||
| 'kind': kind, | ||
| 'summary': summary, | ||
| 'signature': signature, | ||
| 'remarks': remarks, | ||
| 'doc_url': doc_url, | ||
| 'examples': None | ||
| }) | ||
|
|
||
| # Articles | ||
| for path in Path('Documentation/articles').rglob('*.md'): | ||
| with path.open(encoding='utf-8') as f: | ||
| lines = [line.strip() for line in f] | ||
| lines = [l for l in lines if l] | ||
| if not lines: | ||
| continue | ||
| summary = lines[0] | ||
| remarks = '\n'.join(lines[1:5]) if len(lines) > 1 else None | ||
| rel = path.relative_to('Documentation') | ||
| slug = rel.with_suffix('').as_posix() | ||
| doc_url = f'https://harmony.pardeike.net/docs/{slug}.html' | ||
| cards.append({ | ||
| 'id': slug, | ||
| 'kind': 'article', | ||
| 'summary': summary, | ||
| 'signature': None, | ||
| 'remarks': remarks, | ||
| 'doc_url': doc_url, | ||
| 'examples': None | ||
| }) | ||
|
|
||
| with OUT_FILE.open('w', encoding='utf-8') as out: | ||
| for card in cards: | ||
| out.write(json.dumps(card, ensure_ascii=False) + '\n') | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Restore docs workflow trigger for Lib.Harmony changes
The docs workflow no longer runs when files under
Lib.Harmony/change. The previous configuration explicitly listed that folder, but the new path filter only coversHarmony/**plus the new generator script. API metadata is produced fromLib.Harmony/bin/Debug/net35/0Harmony.dll, so any API changes applied solely inLib.Harmonywill now bypass the workflow and leave both the documentation and the llm-pack stale. Consider reintroducingLib.Harmony/**to the trigger list.Useful? React with 👍 / 👎.