Skip to content

feat: add Buddhist master persona mode to AI chat#360

Merged
xr843 merged 3 commits intomasterfrom
feat/master-mode
Apr 6, 2026
Merged

feat: add Buddhist master persona mode to AI chat#360
xr843 merged 3 commits intomasterfrom
feat/master-mode

Conversation

@xr843
Copy link
Copy Markdown
Owner

@xr843 xr843 commented Apr 6, 2026

Summary

  • Add master persona mode to FoJin AI chat — users can select a specific Buddhist master (智顗/慧能/玄奘/法藏/鸠摩罗什/印光/蕅益/虚云) for personalized Q&A
  • When a master is selected: system prompt switches to that master's teaching style; RAG is scoped to their core scriptures via scope_text_ids
  • New endpoint GET /api/chat/masters lists available personas
  • Frontend dropdown selector above chat input

Changes

  • backend/app/services/master_profiles.py (new): 8 master profiles with prompts + RAG scope
  • backend/app/api/chat.py: masters list endpoint + master_id passthrough
  • backend/app/schemas/chat.py: master_id field in ChatRequest
  • backend/app/services/chat.py: full chain master_id support
  • backend/app/services/embedding.py: scope_text_ids filtering in similarity_search
  • backend/app/services/rag_retrieval.py: passthrough scope_text_ids
  • frontend/src/pages/ChatPage.tsx: master selector UI
  • frontend/src/api/client.ts: master_id in stream request

Powered by Master-skill v0.3.

Test plan

  • Select a master → verify system prompt changes (check LLM request logs)
  • Ask "什么是一念三千" with 智顗 selected → verify RAG only returns 摩诃止观/法华玄义 chunks
  • Clear master selection → verify default mode works unchanged
  • GET /api/chat/masters returns 8 masters
  • Anonymous + logged-in users both see the selector

xr843 added 3 commits April 6, 2026 08:11
Users can now select a specific Buddhist master (智顗/慧能/玄奘/法藏/鸠摩罗什/印光/蕅益/虚云) in the chat UI. When selected:

- System prompt switches to that master's teaching style and doctrine
- RAG retrieval is scoped to the master's core scriptures (via text_id filtering)
- Citations follow the master's tradition-specific format

New files:
- backend/app/services/master_profiles.py: 8 master profiles with system prompts
- GET /api/chat/masters: list available masters for frontend selector

Modified:
- ChatRequest schema: added optional master_id field
- chat service: _prepare_chat/_build_llm_messages accept master_id
- similarity_search: scope_text_ids filtering for master-specific RAG
- Frontend: master selector dropdown above chat input

Powered by https://github.com/xr843/Master-skill v0.3 architecture.
@xr843 xr843 merged commit 05ea105 into master Apr 6, 2026
7 checks passed
@xr843 xr843 deleted the feat/master-mode branch April 6, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant