A
aliraza2025/ask-ali
Portfolio assistant that answers only from the site's own pages and cites them
View on GitHub ↗Link checked 2026-11-12 · HTTP 200 · opens the vendor's own site
- Star count
- 0 ★ · aliraza2025/ask-ali · read from the GitHub search API · (checked 2026-11-13 20:00:50)
- Source
- read directly from its GitHub page · type: open-source project
- Harvest history
- first seen 2026-11-04 · last seen 2026-11-14 · seen 11× · listed by 2 sources
- Score
- score 203 · 2 sources · repo
FAQ (answers come from our records)
Who is it for?
We filed it under these tags: 开源项目. The tags come from the entry itself, not a taxonomy we imposed.
Who maintains it?
repository
aliraza2025/ask-ali;first catalogued 2026-11-04;last seen 2026-11-14。There is no official certification or quality rating here — we record sources and dates only.# Ask Ali
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A small assistant for my portfolio that answers visitors' questions
using only the site's own pages and my CV, and links to the page each answer comes from. When the site doesn't
cover something, it says so instead of guessing.
## How it works
1. scripts/build-knowledge.mjs reads the portfolio's HTML pages and the CV text, strips navigation and scripts,
and splits the content into about 100 sections, each with a link to its page and heading.
2. api/ask.js is a Vercel serverless function. For each question it ranks those sections with BM25 keyword
search and sends the top few to a free model on OpenRouter, numbered as sources.
3. The system prompt in lib/answer.js limits the model to those sources, asks for a citation like [2] after each
fact, and tells it to decline questions the sources don't answer.
4. The response returns the answer plus only the sources it cited, so the website can link them.
No database and no npm dependencies. Retrieval runs in memory at cold start.
## Limits
Keyword search, not embeddings: questions phrased very differently from the site's wording can miss. A small
synonym list in lib/answer.js covers common cases like "grad school" for education.
Free OpenRouter models can be slow or rate limited. The function tries three models in order and returns a
friendly "busy" message when all fail.
Rate limits (8 questions per visitor per 5 minutes, 300 a day) are kept in memory, so they reset when the
serverless instance restarts. They deter casual abuse, not a determined attacker.
Answers can still be wrong. The widget says so and always shows its sources.
## Run it
bash
# 1. Rebuild the knowledge file from a local copy of the portfolio
node scripts/build-knowledge.mjs "/path/to/portfolio website"
# 2. Check retrieval (no API key needed)
node scripts/eval-retrieval.mjs
# 3. Deploy
vercel --prod
Set these in the Vercel project's environment variables, never in code:
| Variable | Required | Purpose |
| OPENROUTERAPIKEY | Yes | OpenRouter API key |
| ALLOWEDORIGINS | No | Comma-separated sites allowed to call the API |
using only the site's own pages and my CV, and links to the page each answer comes from. When the site doesn't
cover something, it says so instead of guessing.
## How it works
1. scripts/build-knowledge.mjs reads the portfolio's HTML pages and the CV text, strips navigation and scripts,
and splits the content into about 100 sections, each with a link to its page and heading.
2. api/ask.js is a Vercel serverless function. For each question it ranks those sections with BM25 keyword
search and sends the top few to a free model on OpenRouter, numbered as sources.
3. The system prompt in lib/answer.js limits the model to those sources, asks for a citation like [2] after each
fact, and tells it to decline questions the sources don't answer.
4. The response returns the answer plus only the sources it cited, so the website can link them.
No database and no npm dependencies. Retrieval runs in memory at cold start.
## Limits
Keyword search, not embeddings: questions phrased very differently from the site's wording can miss. A small
synonym list in lib/answer.js covers common cases like "grad school" for education.
Free OpenRouter models can be slow or rate limited. The function tries three models in order and returns a
friendly "busy" message when all fail.
Rate limits (8 questions per visitor per 5 minutes, 300 a day) are kept in memory, so they reset when the
serverless instance restarts. They deter casual abuse, not a determined attacker.
Answers can still be wrong. The widget says so and always shows its sources.
## Run it
bash
# 1. Rebuild the knowledge file from a local copy of the portfolio
node scripts/build-knowledge.mjs "/path/to/portfolio website"
# 2. Check retrieval (no API key needed)
node scripts/eval-retrieval.mjs
# 3. Deploy
vercel --prod
Set these in the Vercel project's environment variables, never in code:
| Variable | Required | Purpose |
| OPENROUTERAPIKEY | Yes | OpenRouter API key |
| ALLOWEDORIGINS | No | Comma-separated sites allowed to call the API |
Listed badge (optional)
Copy this line into the README if you want the listing mark. Optional, and it does not affect being listed.
[](https://anclum.com/en/s/aliraza2025-ask-ali/)
- Source
- github · https://github.com/aliraza2025/ask-ali
- Browse by field
- Open source
- Listed by
- 2 independent sources
- added
- today
More like this
Filed under
Every tag opens the full list for that filter. Counts are the live catalogue figures.