[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116940":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":11,"contributorsCount":11,"subscribersCount":11,"size":11,"stars1d":13,"stars7d":14,"stars30d":14,"stars90d":11,"forks30d":11,"starsTrendScore":15,"compositeScore":16,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":8,"pushedAt":21,"updatedAt":22,"readmeContent":23,"aiSummary":8,"trendingCount":11,"starSnapshotCount":11,"syncStatus":13,"lastSyncTime":24,"discoverSource":25},116940,"RAG_Customer_Service","YYL857\u002FRAG_Customer_Service","YYL857",null,"Python",123,0,54,2,49,53,62.9,false,"main",true,[],"2026-11-11 06:44:25","2026-11-23 13:58:02","# RAG Agent\n\nIntelligent Q&A and customer-service agent for **Douyin shop buyers**, combining **crm_agent** (unified API) and **RAG_mode** (Streamlit console + knowledge-base retrieval).\nTarget reply latency: about 15 seconds.\n\n## Quick Start\n\n```bash\ncd crm_agent\u002Fcrm_agent\nvenv\\Scripts\\activate\npython main.py\n```\n\n- **IM console (recommended)**: http:\u002F\u002Flocalhost:7120\u002Fconsole\u002F\n- Interactive docs: http:\u002F\u002Flocalhost:7120\u002Fdocs\n- API reference: [API.md](.\u002FAPI.md)\n\n## Restart Streamlit Manually (Optional)\n\n```bash\ncd RAG_mode\u002Fmode\npython -m streamlit run app.py --server.port 7121 --server.headless true\n```\n\n## Unified API (Recommended)\n\nAll capabilities go through the unified agent endpoint **`POST \u002Fapi\u002Fv1\u002Fchat`**:\n\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:7120\u002Fapi\u002Fv1\u002Fchat \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"message\": \"How soon will this ship? Is there shipping insurance?\",\n    \"user_id\": \"buyer_001\",\n    \"session_key\": \"dy_session_001\",\n    \"buyer_name\": \"Buyer Li\"\n  }'\n```\n\nFlow: **intent detection → routing → (consultative) RAG retrieval → read chat history → build context → LLM generation** (`reply_mode`: `rag` \u002F `no_hit`, etc.; `mode` \u002F `user_tag` are deprecated).\n\nLegacy field aliases: `talent_id` ↔ `buyer_name`, `contact_username` ↔ `session_key`.\n\n### Endpoints\n\n| Method | Path | Description |\n|------|------|------|\n| POST | `\u002Fapi\u002Fv1\u002Fchat` | **Primary entry** — unified chat |\n| GET | `\u002Fapi\u002Fv1\u002Fhealth` | Health check |\n| GET | `\u002Fapi\u002Fv1\u002Fmeta` | Service metadata |\n| GET | `\u002Fconsole\u002F` | IM console (Douyin-style customer-service UI) |\n| GET | `\u002Fdocs` | Swagger interactive docs |\n| GET | `\u002Fredoc` | ReDoc documentation |\n\n### Response Format\n\n```json\n{\n  \"data\": {\n    \"mode\": \"agent\",\n    \"route\": \"unified_agent\",\n    \"answer\": \"...\",\n    \"reply_mode\": \"rag\",\n    \"rag_hit\": true,\n    \"sources\": [],\n    \"history_count\": 0,\n    \"tag_upgrade\": null\n  },\n  \"state\": {\"code\": 0, \"message\": \"ok\"}\n}\n```\n\nFull field reference: [API.md](.\u002FAPI.md) (v2.1.0).\n\n## Project Structure\n\n```\nRAG_Agent\u002F\n├── API.md                   # API documentation\n├── services\u002F                # [shared] RAG retrieval, intent routing, core business logic\n├── rag\u002F                     # [shared] Knowledge-base ingest pipeline (chunk \u002F load \u002F embed)\n├── data\u002F                    # [shared] Knowledge-base documents\n├── scripts\u002F                 # [shared] Ingest \u002F test \u002F simulation scripts\n├── embedding.py             # [shared] BGE-M3 embedding\n├── vectorstore.py           # [shared] Milvus hybrid vector search\n├── reranker.py              # [shared] BGE-Reranker re-ranking\n├── shared_config\u002F           # [shared] Redis\u002FMySQL session config\n├── web\u002F                     # IM console frontend (mounted at \u002Fconsole\u002F)\n├── crm_agent\u002Fcrm_agent\u002F\n│   ├── main.py              # API entry :7120\n│   ├── settings.py          # System settings\n│   ├── app\u002F                 # FastAPI app layer (routes \u002F agent orchestration)\n│   ├── config.yaml          # LLM config\n│   └── agents.yaml          # Agent definitions\n├── RAG_mode\u002Fmode\u002F\n│   ├── app.py               # Streamlit console (port 7121)\n│   └── settings.py          # System settings\n└── start_api.bat\n```\n\nAfter starting the API, open **http:\u002F\u002Flocalhost:7120\u002Fconsole\u002F** for local integration. When opening the static page alone, pass `?api=http:\u002F\u002Flocalhost:7120` to point at the backend.\n\n## Streamlit Console (RAG_mode, Optional)\n\n```bash\ncd RAG_mode\u002Fmode\nstreamlit run app.py\n```\n\n- URL: http:\u002F\u002Flocalhost:7121\n\n## Dependencies\n\n- `D:\\Milvus` — Milvus Lite vector store (`rag_collection`, dense + sparse hybrid search)\n- `D:\\BGE-M3` — Local BGE-M3 embedding model\n- `D:\\BGE-Reranker-v2-m3` — BGE-Reranker (GPU re-ranking)\n- Redis + MySQL — session state (**shared by RAG_mode and crm_agent**)\n  - Copy repo-root `.env.session.example` → `.env.session` and edit that one file\n  - Code entry: `shared_config\u002Fsession_store.py`\n- API key: set env var `DEEPSEEK_KEY` (see each subproject’s `.env.example`)\n\n## Knowledge-Base Ingest\n\n```bash\n# Run from the repository root\npython scripts\u002Fingest_bd_docx.py --file \"path\u002Fto\u002Fyour_kb.docx\"\n# Or rebuild the index\npython scripts\u002Fingest_documents.py --rebuild\n```\n","2026-11-24 04:54:38","CREATED_QUERY"]