我构建了 FriendMind:一个为朋友打造的私有 AI 学习伴侣
I Built FriendMind: A Private AI Study Companion for a Friend
FriendMind 是一个本地优先的 AI 学习伴侣,可将学生自己的 PDF 笔记转化为问答、测验与薄弱知识点检测的完整学习流程。它通过 Ollama 在本地运行 Gemma 3,结合 ChromaDB 与 Sentence Transformers 实现 RAG 检索和语义答案验证,支持 5 或 10 题、Easy/Medium/Hard 三档难度的 AI 生成测验。
🧠 I Built FriendMind: A Private AI Study Companion for a Friend
A document-grounded AI study companion that helps students learn from their own notes, test their understanding, and discover what they need to revise.
Built for the Hacktoberfest 2026 DEV Weekend Challenge — “Build for a Friend.”
🤝 The Problem
I started this project with a simple question:
What could I build that would actually make studying easier for someone I know?
One problem kept coming up: having notes isn't the same as knowing what you actually understand.
A student can read a PDF, revise a chapter, and still not know:
- Which concepts they truly understand
- Whether they can explain something without looking at their notes
- Where they're making mistakes
- What they should revise next
A generic chatbot could answer questions, but I wanted something more personal.
Something that could work with the student's own study material and then help them test themselves.
That's how FriendMind started.
🧠 What is FriendMind?
FriendMind is a local-first AI study companion that turns a student's PDFs into an interactive learning workflow.
Upload Notes
↓
Index & Embed
↓
Semantic Search
↓
Ask Questions
↓
Generate Quiz
↓
Evaluate Answers
↓
Find Weak Topics
Instead of simply chatting with an AI, the student can study from their own material, test their understanding, and identify what needs more revision.
✨ Current Features
- 📄 PDF upload and processing
- 🔎 Semantic search over uploaded notes
- 🧠 Retrieval-Augmented Generation (RAG)
- 🤖 Local AI with Gemma 3
- 🛡️ Protection against unsupported answers
- 📝 AI-generated quizzes
- 🎚️ Easy / Medium / Hard difficulty
- 🔢 5 or 10 question quizzes
- ✅ Semantic answer verification
- 📊 Weak-topic detection
- 💾 Persistent document storage
- ♻️ Duplicate upload protection
- 🌙 Responsive light/dark interface
- 🔒 Local-first architecture
🔎 Asking Questions From My Own Notes
One of the main ideas behind FriendMind is document-grounded question answering.
When a student asks a question, FriendMind doesn't simply send that question to an LLM.
It first searches the student's uploaded material for relevant information.
The simplified flow is:
Student Question
↓
Semantic Search
↓
Relevant Note Chunks
↓
Retrieved Context
↓
Gemma 3
↓
Grounded Answer
This allows the assistant to answer questions based on the material the student is actually studying.
📝 Turning Notes Into a Quiz
After studying, the student can generate a quiz from their uploaded material.
They can choose:
- 5 or 10 questions
- Easy, Medium, or Hard
But generating questions was only half of the problem.
I also wanted FriendMind to evaluate answers in a way that reflects understanding, rather than simply matching exact words.
That led to one of the most important parts of the project.
🧩 Semantic Answer Verification
Consider these two answers:
Expected answer:
Binary search has logarithmic time complexity.
Student answer:
Binary search runs in O(log n).
The wording is different, but the concept is the same.
A strict text comparison could fail to recognize that.
FriendMind therefore uses semantic similarity to evaluate natural-language answers.
The goal is to ask:
“Does the student's answer communicate the expected concept?”
rather than:
“Did the student use exactly the same words?”
This makes the quiz evaluation more flexible for natural student responses.
🎯 Finding Weak Topics
FriendMind doesn't stop at marking an answer right or wrong.
It can use incorrect answers to identify areas where the student may need more revision.
The learning loop becomes:
Study
↓
Ask Questions
↓
Take Quiz
↓
Evaluate Understanding
↓
Identify Weak Topics
↓
Revise
↓
Try Again
The idea is simple:
Don't just tell the student what they got wrong. Help them understand what to work on next.
🔓 Why Open-Source AI Matters
Open-source AI isn't just a technology choice in this project.
It directly affects privacy and control.
FriendMind uses Gemma 3, an open-weight model, through Ollama for local inference.
The core architecture is:
Student PDF
↓
Local Processing
↓
Local Embeddings
↓
ChromaDB
↓
Semantic Retrieval
↓
Ollama
↓
Gemma 3
↓
Answer / Quiz
A student's study material can contain lecture notes, assignments, personal notes, and exam preparation material.
I didn't want the core workflow to require sending all of that material to a closed cloud AI service.
With the local-first approach, the core AI workflow can run on the student's own computer.
It also gives the project more control over the model layer: the application isn't permanently tied to a single hosted AI API.
For a tool designed around personal study material, privacy, ownership, and control matter.
🏗️ How I Built It
The architecture is intentionally straightforward:
┌─────────────────┐
│ FriendMind UI │
│ HTML/CSS/JS │
└────────┬────────┘
│
▼
┌─────────────────┐
│ FastAPI │
│ app.py │
└────────┬────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
PDF Processing RAG Engine Quiz Engine
│ │
▼ ▼
Sentence Transformers
│
▼
ChromaDB
│
▼
Ollama
│
▼
Gemma 3
🛠️ Tech Stack
Backend: Python, FastAPI, Uvicorn
AI/ML: Sentence Transformers, RAG, Semantic Similarity
LLM: Ollama, Gemma 3
Vector Database: ChromaDB
Document Processing: pypdf
Frontend: HTML, CSS, Vanilla JavaScript
Development: Git, GitHub, VS Code, PowerShell
🎥 Demo
FriendMind currently runs locally using Ollama and Gemma 3.
The demo shows the complete workflow:
Upload PDF → Ask a question → Generate quiz → Answer → Semantic evaluation → Weak-topic detection
▶️ FriendMind Demo
https://www.youtube.com/watch?v=pd66-1qTa40
The screen recording demonstrates the actual working application rather than a mockup.
📸 Screenshots
The repository contains screenshots of the working application in docs/screenshots/.
Upload Study Material
Show the FriendMind PDF upload interface here.
Ask a Question
Show a grounded question and response here.
Take a Quiz
Show the generated quiz here.
Review Results
Show semantic evaluation and weak-topic results here.
🔐 Privacy by Design
FriendMind follows a local-first approach:
PDF
↓
Your Computer
↓
ChromaDB
↓
Local Embeddings
↓
Ollama / Gemma 3
The core AI workflow can run locally without requiring study material to be sent to a cloud LLM provider.
🧪 What I Learned
Building FriendMind taught me that building an AI application isn't just about connecting an LLM to a frontend.
The interesting problems appeared around the model:
- How do I keep answers grounded in the user's documents?
- How do I avoid unsupported answers?
- How do I generate useful questions from context?
- How do I evaluate answers when wording differs?
- How do I turn quiz mistakes into useful revision feedback?
The semantic verification layer was particularly interesting.
It changed the problem from:
“Are these two strings similar?”
to:
“Do these two answers express the same concept?”
That distinction becomes especially important when AI is being used for learning.
🚀 What's Next?
FriendMind is still a starting point.
Some improvements I'd like to explore are:
- Topic-wise quizzes
- More document formats
- Improved citations
- Learning analytics
- Personalized revision plans
- Conversation history
- Hybrid retrieval
- Streaming responses
For this challenge, however, I wanted to keep the scope focused on solving one real problem.
❤️ Why I Built It
I didn't start with:
“What AI application can I build?”
I started with:
“What could actually make studying easier for someone I know?”
That changed the direction of the project.
Instead of building another general-purpose chatbot, I built something around a student's actual workflow:
their notes → their questions → their quiz → their mistakes → their revision.
That's what Build for a Friend meant to me.
💻 Source Code
The complete source code is available on GitHub:
sanchalitorpe13/FriendMind
The repository contains the application source code, setup instructions, architecture, and screenshots.
🛠️ Built for a Friend. Built for Learning. Built with AI.
FriendMind is my submission for the Hacktoberfest 2026 DEV Weekend Challenge — Build for a Friend.
Thanks for reading. 💙
Challenge
Hacktoberfest 2026 DEV Weekend Challenge — Build for a Friend
Partner Category
Best Use of Gemma
FriendMind uses Gemma 3 as its local AI model through Ollama.
devchallenge #weekendchallenge #hf26challenge #gemma
来源:Google AI:DEV 作者专属(RSS) · dev.to