fastapi-fullstack 0.2.22__py3-none-any.whl → 0.2.24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {fastapi_fullstack-0.2.22.dist-info → fastapi_fullstack-0.2.24.dist-info}/METADATA +1 -1
  2. {fastapi_fullstack-0.2.22.dist-info → fastapi_fullstack-0.2.24.dist-info}/RECORD +26 -21
  3. fastapi_gen/UPGRADES.yaml +12 -0
  4. fastapi_gen/template/hooks/post_gen_project.py +4 -0
  5. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/fetch_url.py +4 -9
  6. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/deps.py +3 -3
  7. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/knowledge_bases.py +43 -14
  8. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/rag.py +41 -9
  9. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/telegram_webhook.py +7 -6
  10. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/channel.py +15 -21
  11. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/public_http.py +34 -0
  12. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/sanitize.py +20 -33
  13. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/channel_bot.py +14 -3
  14. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/knowledge_base.py +52 -17
  15. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/rag_status.py +21 -15
  16. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/sync_source.py +22 -8
  17. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/webhook.py +5 -5
  18. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/rag_tasks.py +5 -2
  19. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_public_http.py +42 -0
  20. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_rag_permissions.py +75 -0
  21. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_telegram_webhook.py +57 -0
  22. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/rag/page.tsx +3 -3
  23. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/status/stream/route.ts +23 -0
  24. {fastapi_fullstack-0.2.22.dist-info → fastapi_fullstack-0.2.24.dist-info}/WHEEL +0 -0
  25. {fastapi_fullstack-0.2.22.dist-info → fastapi_fullstack-0.2.24.dist-info}/entry_points.txt +0 -0
  26. {fastapi_fullstack-0.2.22.dist-info → fastapi_fullstack-0.2.24.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fastapi-fullstack
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Full-stack FastAPI + Next.js template generator with Pydantic AI/LangChain agents, WebSocket streaming, 20+ enterprise integrations, and Logfire/LangSmith observability. Ship AI apps fast.
5
5
  Project-URL: Homepage, https://github.com/vstorm-co/full-stack-ai-agent-template
6
6
  Project-URL: Documentation, https://vstorm-co.github.io/full-stack-ai-agent-template/
@@ -17,10 +17,10 @@ fastapi_gen/upgrade/rename_guard.py,sha256=ap0ds5k93Hh6hhQhOxrDPsh-utTE1BeBYysrT
17
17
  fastapi_gen/upgrade/render.py,sha256=PmEm7BPmEfUK29RcVgPN9PttTX7oHeWnDgf_vgGja1s,5497
18
18
  fastapi_gen/upgrade/report.py,sha256=49v9kq2tkbeqqbdH-kRIM3kccaFfPVfjhi7Tm5cCVvE,3802
19
19
  fastapi_gen/upgrade/runner.py,sha256=msnj2RYii6low6gPeZ4TRMlL01Hq8a0zJyLBzPotxCI,19302
20
- fastapi_gen/UPGRADES.yaml,sha256=KWHs_vnhxjjsYXVNZkIGwLPxZsJlVkxIzTBlAXkcal0,5718
20
+ fastapi_gen/UPGRADES.yaml,sha256=BC7h7ej_PLfRTQy2k0mKIFDyCm2qjezDYKk_Vxmkuvw,6319
21
21
  fastapi_gen/template/VARIABLES.md,sha256=GEk5LqrItHC66PBYmmi5lokwzxDxGiLvnhlsZOw97JA,35410
22
22
  fastapi_gen/template/cookiecutter.json,sha256=e1xSqG9i-CTsux-nnCUWf6v7So67_jAp_puf_siHMWs,6397
23
- fastapi_gen/template/hooks/post_gen_project.py,sha256=_SYRmnOkaLtCSSbAkWl3MBokfC7brqMU3O7XICEdBi0,61696
23
+ fastapi_gen/template/hooks/post_gen_project.py,sha256=T9VmlC12ios_6Oq2SOiQrWrlBcGo7SRNef3cbNLJjAA,61905
24
24
  fastapi_gen/template/{{cookiecutter.project_slug}}/.gitignore,sha256=yC3ZUp8Txp_1TPDabDlz4pGa2p1cNwr49de0dCcctOw,1515
25
25
  fastapi_gen/template/{{cookiecutter.project_slug}}/.gitlab-ci.yml,sha256=SYDjmai3eKIiz4MbiEBHm4hBA_Ksu3Pk4Enr7cGk46Y,4659
26
26
  fastapi_gen/template/{{cookiecutter.project_slug}}/AGENTS.md,sha256=HqhXNdBq1ZXlFJCC4V3CY8DorTkZkwFJcvv2O77Pwk4,2454
@@ -111,12 +111,12 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/__in
111
111
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/ask_user_tool.py,sha256=zyuSStYw2ZvH20YuAn_VgFh8oR2Mcd8WKVoFEtfIJnA,1407
112
112
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/chart_tool.py,sha256=QJUq0_pk_3Wo4B7q-xYc4D34tpXE7PUJ5bR46xaXgMM,7971
113
113
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/code_execution.py,sha256=5e49wOJsPqfuApg1DpuxSmwiRyyKex4-THvdpHwgBCw,2223
114
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/fetch_url.py,sha256=3Ea-_F8u5eC0n7on8tDnR1S2Zj6IkyiveKWaMeMUmgU,4052
114
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/fetch_url.py,sha256=bjmL3UZ6t5YSRVOvIoMTSdWJN2tv6SnCNjq_aM0bdzU,3837
115
115
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/rag_tool.py,sha256=NFhP2dkt6s3G8Ryj4AhV4EctOHp_ktiGxburxRx4li8,6748
116
116
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/research.py,sha256=p3j5K5FdjJ3JyktyEHVRj_P0DQBV3KJAha7lDyLCrIk,168
117
117
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/web_search.py,sha256=CyRc7-rklcMl6s_9Cnl1xLDcBNm8Q3mMiEu3bYKagQk,3177
118
118
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/__init__.py,sha256=NeESK8RjcyjY9KL1c9H2jIw34RpWmtlHgd8rhPBuolo,18
119
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/deps.py,sha256=b8UO0ibDBCLWIfmVGD7Is5fWUB1rSfv9D69HVJ5fQDM,27814
119
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/deps.py,sha256=9PHbfc6_sM8U2UgcM5OPmK8GBZOcHX67x0tIv5O6NaA,27851
120
120
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/exception_handlers.py,sha256=FGDbVsO-UzvWZtcnLW6joZXPZahZc9O13p_tqzlhF6c,3453
121
121
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/router.py,sha256=8E0e0Oef6KrB6raDgrV0Lj-tPKRiQ-5UlGM3yGnz50Q,233
122
122
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/__init__.py,sha256=wIJD_xpViBStOBb4iWBX_hxdPfSKJyAGlcOw81NTWXo,207
@@ -135,7 +135,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/fil
135
135
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/health.py,sha256=rX30aqHgLXFK5GJsoNHuleJ8co5C3axDnZwRMTXlR28,8468
136
136
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/invitations.py,sha256=ZN4SKxzw14rIovpJAj9TkSbfpedo56zW2s9PfJq7FU4,2978
137
137
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/items.py,sha256=43S9OPXxAxrk_F10toYeLM0MRW_O37-w-0CQ8JAwDbo,2285
138
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/knowledge_bases.py,sha256=QQolJKIDUjqpVoBvdn1jrfnmBRKc7nRmoHiMMo2J6aI,14155
138
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/knowledge_bases.py,sha256=kQsE2v-08x_M1is57moctiX60TwpFpAnheneJVaVasU,15010
139
139
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/marketing.py,sha256=QG_CjH8_xk9Ii_D0Vjxu4li0y2pHvulUmB8X7n2l58o,750
140
140
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/me_mcp_connections.py,sha256=HTCzfTqkLTjYzfMzNFYlvXFAArJomTjZB93eMBBgx0w,4660
141
141
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/me_memory.py,sha256=CqJI0vu49l7rB7_wAhn9NrGaqa3TK-PYU-KTPAkjuQU,3759
@@ -146,16 +146,16 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/org
146
146
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/organizations.py,sha256=Zl3bJPy-RfpluSgadeStrp_KodVpLQKmUPkoFkXiXxU,4992
147
147
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/projects.py,sha256=d9l5HZ5wJl_MGnIvEJss_gXomxUR3XYLXB-grLV_81s,4565
148
148
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/public_demos.py,sha256=XP6KDu2U6LaJKydkuE5fYjO1PgggGrQVU9j1a9VRq9M,1538
149
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/rag.py,sha256=pZ-JmhZaa6sVz0Oy8lcF6XdhUJPZiIXly1ejvO-IUaA,16452
149
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/rag.py,sha256=leWXqTL6iUCoNf8Q2qyv_1wQFcTbHOJScKUlelCtcc4,17744
150
150
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/sessions.py,sha256=7LrDMVy8DYhriAAL4QTL8YtXDmOwhjltvjBOanYkkUk,1235
151
151
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/slack_webhook.py,sha256=PWRzZGD_zUOKf_BeYelQxl_G25hzoF3Dahs0-PtvFmY,2058
152
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/telegram_webhook.py,sha256=hBIf5xBfIP-8tPch1-xueRdAwuCclYtoEZm9x2V-kYU,1623
152
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/telegram_webhook.py,sha256=wItxoh3PVJtnm07iJZ5AJ7TOqDrbHZd7JgQlAdlFeSI,1735
153
153
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/users.py,sha256=maIccIgybZvB_54IaE9wrI8-TxdAoSb1ATWTDbk3sZU,3802
154
154
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/webhooks.py,sha256=1q3lkSy7cEr8KY2PNSbWYhOrJjqHKC3ujMbvxi4mkMs,5647
155
155
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/__init__.py,sha256=gA4EUVDQQoTzeaLzFHZEA6Ps0eO7eo8NYjhNUDkzwzs,281
156
156
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/redis.py,sha256=Q67nC1xl-ImX-oWh-Ii1QBsl9srd9IZt3v8-Pr0bwzw,3075
157
157
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/__init__.py,sha256=P912XHMGspKPltxdR7Ac7anC76a6DyDVXc_o-clV_94,3097
158
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/channel.py,sha256=l5tHqHirVT00g0kkPASvcYQANrsm-fq5_F2yTb-3De8,6182
158
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/channel.py,sha256=HymIOrLGZnXqmWLSUuvj9I_rF2EgZg_0J9Dgjedtyv4,5983
159
159
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/cleanup.py,sha256=ocirlds_LqKbzB-s0Jbz6n0CJdv3Uec34ysZHkm16rQ,2110
160
160
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/create_app_admin.py,sha256=kl25tXP9-bWzhqm5z8PtVy5ab09fMlkD-fsluYLk0rQ,1564
161
161
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/example.py,sha256=sx49u9oUIqvTfkurkIrFsZ4HFP1946kclkNVp6-zW28,733
@@ -173,7 +173,8 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/logfire_setu
173
173
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/logging.py,sha256=7TFYXXeNAa5UnNLff2K-kwZFqi_VJ4jILMtLpm8H6Sw,2651
174
174
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/middleware.py,sha256=hYEOf45mYc9PRrayiO3XOd0cdLM2GYYS76o1Jiv6tUQ,3570
175
175
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/oauth.py,sha256=YtyJBlHY6qsond8aKOrg0S7OyKA22LZ7RN8QWi8G8Tg,571
176
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/sanitize.py,sha256=VuvNiccu2gErxVDmVAJ04E_oy-KxAzTLyujVaO2XCag,11567
176
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/public_http.py,sha256=CG4BJVeo7qwt-cF4XU3TflO3-3o2cuWAi7ntPHCI2WI,1449
177
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/sanitize.py,sha256=AJCUqwXt5PMifCTAQoIKTr13IWqsVlS20md7_IQG91o,11152
177
178
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/security.py,sha256=nXjXx1MN3mR_mqZvBEZQbSOdFV8hM1oJyCx8FfJ2ofc,7661
178
179
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/__init__.py,sha256=VRbMV3VsQxDygLTek0L9_q1v1T_L9MjfGFobSUa2FHg,284
179
180
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/base.py,sha256=TWjarV2D4yIKC7w_e8gR0v6hUE94cBnl0bSa8GYp56s,2108
@@ -264,7 +265,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/agent.py
264
265
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/agent_invocation.py,sha256=kh3KQA1mKg1AKnpf70hCdUCblqs4x_zdNyfMH7NjmhU,18321
265
266
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/agent_session.py,sha256=-VOhjAGNJVZLKB0iozFac5WSOLz5o9nEwMT8eW-87ng,122375
266
267
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/anomaly_detection.py,sha256=uKPCzzdeyDSUbgkD7VwFIubEHhoU1LEoOp3R1_F0SlE,3112
267
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/channel_bot.py,sha256=R1tfQQcNxHKZ9C3yOD6Hh4TANY77FL4XNic4Rf40qWo,6383
268
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/channel_bot.py,sha256=wJWiL9sdOeiOKKJIMnwWvKEdGP-iKkGGo9O746rfyPM,6829
268
269
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/contact.py,sha256=AuML8RHIozZkchZlNMjHsZhLWpTMxukfy1xk6mak3Bk,1697
269
270
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/conversation.py,sha256=_-0K80UHx_FmF_b7XgkYg-_VXW15Sg3pic8ddVh9RkI,21974
270
271
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/conversation_share.py,sha256=JQHy636d7NI058yBlFyQ-17VQzau-Z6G2FIp4E0XOIg,6711
@@ -273,7 +274,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/file_upl
273
274
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/health.py,sha256=FLMt3mgCuXhZS077bxpUoxu_ruNFvYVOBEGXS6B1T3o,587
274
275
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/invitation.py,sha256=-kEZ5mIHYnvQOsQAr7_N-xa5Ce4nFsb9K07n3FlMINc,7700
275
276
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/item.py,sha256=9cEPv90_o2hpLpNFzT0gi7vEt6MuZ5qCbXOGplluzNg,2302
276
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/knowledge_base.py,sha256=qkrPAMeGdreKFyLh0yyYy75-B6E_a7fhAvH9kMcvJGI,11794
277
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/knowledge_base.py,sha256=8hco7Jy6PytiSjyu5eMNWfUIC9DX8VihQvtQPwtotdA,13436
277
278
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/mcp_connection.py,sha256=N1YBGXMhqyBhXNBu_gRWUfCT6xBAXB0xas7r6P1OxdQ,18886
278
279
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/member.py,sha256=BCjetJzFEfiudoXAz36ktJrritDIZBfWHUyP7K1Eeoc,7255
279
280
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/message_rating.py,sha256=2CWFqNDyaFTaXAgk1AIPS2gC_6AVFAwjfjUXY4IHCSI,13129
@@ -281,16 +282,16 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/newslett
281
282
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/organization.py,sha256=qAjP5CciI5_7b9YeqfZCrAkE5Ax37Xj9GAuVxdq_TZg,7348
282
283
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/project.py,sha256=jzHyoxbRJ9bKSHnSznKLjgul2m2bsKgERdDzQkG6xyk,11131
283
284
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/rag_document.py,sha256=0fXbrtZGnIz166Sbx-KKzQQyzDmG2HeLmrYu-qGgCnA,12844
284
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/rag_status.py,sha256=rdVLTuCtfHvrhq9p5qZpdyOfm7zzalW5lxvAzDCQapI,2435
285
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/rag_status.py,sha256=yhgOnzD-lpu8-L-Sfq8qSlXdibBJw8hNpHG7GBToeLM,2873
285
286
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/rag_sync.py,sha256=7SJvrszd-z7k1jMz67Ez6gfbS45oxxCePa9WHZh_EVw,5958
286
287
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/research.py,sha256=APGywGFljVcTi4D9LLBTmVYICe2VfyE2QnjKS2ppaHk,12154
287
288
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/session.py,sha256=mABDVV3lMvmJsprr-y_XSMQ8hTb4PIEnK_bn5jasUUw,4103
288
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/sync_source.py,sha256=geoKqmIjDgxAzS5Jmm2qW7fdAl9i_1ZgfiGFMNf951k,12199
289
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/sync_source.py,sha256=ueu3BOTz-mE_obHOnlsrQoKSzvsvi-WmPEakdum5R4c,12769
289
290
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/usage.py,sha256=SUNAEnnOZjXr_PXoFGjfkMjAw7aB5FvIHReeAVI4wx8,3756
290
291
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/user.py,sha256=LCQKKAfhMHvqKVqofF5MnPgN1JrpHQMvE2i8aqttyvg,15966
291
292
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/user_memory.py,sha256=Q-2qwUi945EMqmRrlRU4igwGd1M3cD0ZngQTgGldSlU,8198
292
293
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/user_slash_command.py,sha256=t1-IIExupr-pvhCt_JjmiLrWfzMEzR2cDcLfhfPVRCQ,5427
293
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/webhook.py,sha256=RCT96wAQDnr8CUG9_gzXYxi-Av3BXzjbl0BnxNY1qWw,7500
294
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/webhook.py,sha256=oEnD9udOLS3VfuLFZ0blLiaD5pdacKIZrH-iIIvz0_w,7542
294
295
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/billing/__init__.py,sha256=t953_p9xlo9jNiflpiQBBiht-wWXV-RJAHi75Dp7w-0,448
295
296
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/billing/checkout_service.py,sha256=Hf3PmflbMvptwnzyX3ZlVa-HdC1IZF1Pr2UPS3uFWNo,3643
296
297
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/billing/credit_service.py,sha256=UGCs-byA6wLm44x6lQD66DOnHepe3lm56U_ZVPfGq1w,5134
@@ -353,7 +354,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/__in
353
354
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/anomaly_tasks.py,sha256=A9ypPpRzTLXmlbJ6pOPpzkk9hHOKUOTtXBGoqzPsBJQ,1919
354
355
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/cleanup_tasks.py,sha256=D7QHn_sBIGI-4HxHE0l5Lb2FgdKw0wJRMyzqBonpOqY,3583
355
356
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/email_tasks.py,sha256=G6aA9LFJSXYjNyaBgLqdpLCwSV_AgRwayRYrePpLMRE,4398
356
- fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/rag_tasks.py,sha256=6BEnJQeqdZwgp9lxChBsnBNJpVXS-C15KlmVLPk8zDo,20712
357
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/rag_tasks.py,sha256=Q_yg5CmNkh1QThZTpB3NRWyOAc2E0hb7z4w1x5U4vg4,20805
357
358
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/schedules.py,sha256=ycZWAIlx0Ii5LTuJ8jo4nco-nOj98TGK-Y5nphGBZ0M,2070
358
359
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/__init__.py,sha256=Min6pv55Zp3DSWyXUNKNNE0KqrPNxCwMLDxfWrYtxK0,26
359
360
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/commands.py,sha256=T8GO9T32U5ceUMk-1kB8mu9884xQbfjlm_2fW7rvGUs,9349
@@ -379,7 +380,9 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_memory_cha
379
380
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_memory_postgres.py,sha256=aZcaCFkefQwqZiyioKF8Iot-TbC9IKu-ETZMeksGVsc,4868
380
381
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_migrations.py,sha256=wf0DEAT8-WIe9YT7PZ6zUUN68OjLC1D8vQJZrfkLJ8Y,3946
381
382
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_openai_compatible.py,sha256=B2lxdMq6jp8s6vWGBqlIm-ZT7fFR1nmuSFtWRMnt0ak,2123
383
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_public_http.py,sha256=fAvxrCkIQnNX1uSmhJm3LTUTUWurFADbSWN9lBm2xOA,1675
382
384
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_pydantic_deep_history.py,sha256=Vl9bkzbpBrX6D4NMU8ZOldvvDlwE4OabHZCeN-QVONU,6065
385
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_rag_permissions.py,sha256=ZWoc1QiTjbS1yyNE3Q4YyHytab0k7YRYnApqkNEaAtU,3151
383
386
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_rbac_teams.py,sha256=ryLOK_4YMtSBfRqeVFEnvcQXoGkQEpDrX0OAsCmm-v8,7037
384
387
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_repositories.py,sha256=uQHtc5I5OZpWnO7rC1Y8C7uw1WZWtG_HNWwxpI2OhtM,1286
385
388
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_repositories_teams.py,sha256=bIvtIATkynFWyvi81zXphiVyFf1cWu6qgRiB-EQzgMo,9675
@@ -390,6 +393,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_services_m
390
393
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_services_organizations.py,sha256=LqguSbJVPhzVq3bHQZC37CNVF4MbQ93iDll0Vx28nV4,6277
391
394
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_ssrf.py,sha256=3EQP8FbmoLgbe_mGlCFtkmX1P8ItVvVYlD_6jUbkeYg,5896
392
395
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_stripe_seats.py,sha256=vtm5JG_98plUykZK85KQIIKRpuyioAQcQcUGPxAQdVE,5080
396
+ fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_telegram_webhook.py,sha256=sI_mjN22Q_A0Y2Mt5ebq_skxIlIfrBIALvGjHnieKkQ,2139
393
397
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_tenant_isolation.py,sha256=8yl1YrmTewRREmWSBF8wU3StCSn4tFsitRMa_3fXQzs,4361
394
398
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_web_search.py,sha256=rGF8rftjC80Ujke0Ahw--3HfB7k2lJA5BkpPFKOKC2A,3119
395
399
  fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_worker_taskiq.py,sha256=1SsCCaZ-gBzakWdKvxRChl3PY0beocV17u8Rv1GPuUc,1557
@@ -537,7 +541,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(da
537
541
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/orgs/[id]/integrations/page.tsx,sha256=luUxOeUi-IjBn4UmOx0qlkcMN1IMu7mfBdROtzmHHKI,8532
538
542
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/orgs/[id]/members/page.tsx,sha256=a6ydq0KQn2XNdY6LoxUMRt3YwuYyLqZVkMbLOP0MjSs,12749
539
543
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/profile/page.tsx,sha256=Eq96ai1eSTRy44W0-NAO5jvefIU-PaU9EtBy8hVNeD4,124
540
- fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/rag/page.tsx,sha256=qxa-V3IMQUgtCNhvQWbVeEr9oO7Fr46b4e0YomsYzVE,38998
544
+ fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/rag/page.tsx,sha256=sjbnz93CSGuzmYeqkM0-yGwbmnTfw5CiMgdumRVfevg,38987
541
545
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/settings/layout.tsx,sha256=Co4-doQgvLIc7yAj6PcKbk1uFcuwlOBFAGShwOBuBoc,1501
542
546
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/settings/page.tsx,sha256=kvZJWioOIHo4Is_SR8RnzuRv2sqqja3QVZxsvSfJo9c,169
543
547
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/settings/account/page.tsx,sha256=WQBvycs3j-fBu4p0k-Sog3amjfYWthOIvckPSnx47Xo,7688
@@ -655,6 +659,7 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/d
655
659
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/documents/[docId]/route.ts,sha256=m2o9QJuE98nG8QAo5aQMEW0JJxoL3dHngwMbRZUi4z8,887
656
660
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/documents/[docId]/download/route.ts,sha256=FxR0dHGBXuPm0O_jHVTKhjxlKz3TygVAxkgyIP-hQQY,1244
657
661
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/search/route.ts,sha256=D4JjdQpsmZTcsVCs18NYgp_-elXvLZHs4KklFB7DTw4,939
662
+ fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/status/stream/route.ts,sha256=ONSv6CXYAd1d-YRiLXokjwKDprx9CzfpS7OJhOFTVZA,779
658
663
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/supported-formats/route.ts,sha256=-fSTkqLrGet0WSqwgW3xj9tJDs8HTsxLECDv6NQssuI,736
659
664
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/sync/[syncId]/route.ts,sha256=5wsEfpJINO7rONx5pVbk6B9C2I19k1BPubfBpc5x2jA,868
660
665
  fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/v1/rag/sync/connectors/route.ts,sha256=X--P3EemDMslL--NOtl2M_QrYf0c1V-_B77hLulEBUY,734
@@ -944,8 +949,8 @@ fastapi_gen/template/{{cookiecutter.project_slug}}/kubernetes/service.yaml,sha25
944
949
  fastapi_gen/template/{{cookiecutter.project_slug}}/nginx/nginx.conf,sha256=2bWaxnv_rN4driEdtWgVz9eVfoKhB_Ohd_G8eOC3P3M,7619
945
950
  fastapi_gen/template/{{cookiecutter.project_slug}}/nginx/ssl/.gitkeep,sha256=o_WQQOgVGOLttT48x0EXSC4BbbDFemApFpmwhybcVUU,617
946
951
  fastapi_gen/template/{{cookiecutter.project_slug}}/scripts/export_demo_html.py,sha256=H1tbIfr1xrh2pRuoy5NwvAOYEu0S2vgnw_XsKNMKXeM,10414
947
- fastapi_fullstack-0.2.22.dist-info/METADATA,sha256=00cqQL3JYJwB6sKNaDVPz1cWk9Visi_bR-wXfO9Cv8c,62330
948
- fastapi_fullstack-0.2.22.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
949
- fastapi_fullstack-0.2.22.dist-info/entry_points.txt,sha256=s9JXrISZp8LMYJGeVofOAd1wPTzpq-jwjSgSf4hWzjs,59
950
- fastapi_fullstack-0.2.22.dist-info/licenses/LICENSE,sha256=bL4JuK_rcA8y__Gg7PEuTs3g2Qf6VvSz2w2Jajd6nVU,1063
951
- fastapi_fullstack-0.2.22.dist-info/RECORD,,
952
+ fastapi_fullstack-0.2.24.dist-info/METADATA,sha256=F7GvyMtsIeh6OZT_AojG0Nih9sg1wqVwWDCRvc6eIpk,62330
953
+ fastapi_fullstack-0.2.24.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
954
+ fastapi_fullstack-0.2.24.dist-info/entry_points.txt,sha256=s9JXrISZp8LMYJGeVofOAd1wPTzpq-jwjSgSf4hWzjs,59
955
+ fastapi_fullstack-0.2.24.dist-info/licenses/LICENSE,sha256=bL4JuK_rcA8y__Gg7PEuTs3g2Qf6VvSz2w2Jajd6nVU,1063
956
+ fastapi_fullstack-0.2.24.dist-info/RECORD,,
fastapi_gen/UPGRADES.yaml CHANGED
@@ -18,6 +18,18 @@
18
18
  # manual_steps:
19
19
  # - "Run `alembic upgrade head` (new billing tables)."
20
20
 
21
+ - version: "0.2.24"
22
+
23
+ - version: "0.2.23"
24
+ breaking:
25
+ - "New knowledge bases receive server-assigned collection names. Remove collection_name from create requests. Read the assigned name from the response."
26
+ - "RAG status streams require admin authentication. The generated frontend sends it through its same-origin route."
27
+ manual_steps:
28
+ - "Re-register Telegram webhooks that were registered without a secret with `channel-webhook-register --bot-id <id>`."
29
+ - "Restart background workers and the backend together so RAG ingestion events include their collection."
30
+
31
+ - version: "0.2.22"
32
+
21
33
  - version: "0.2.21"
22
34
  manual_steps:
23
35
  - "Run `alembic upgrade head`. Since 0.2.19, projects without --mcp-client could not migrate past 0025 (`KeyError: '0026_create_mcp_connections'`); with the corrected chain the pending migrations apply, including 0027 (users.magic_link_epoch, which magic-link sign-in reads when --email is on)."
@@ -480,6 +480,10 @@ if not use_pydantic_deep:
480
480
  remove_file(os.path.join(backend_app, "repositories", "project.py"))
481
481
 
482
482
  backend_tests = os.path.join(os.getcwd(), "backend", "tests")
483
+ for test_filename in ("test_telegram_webhook.py", "test_rag_permissions.py"):
484
+ feature_test = os.path.join(backend_tests, test_filename)
485
+ if is_stub_file(feature_test):
486
+ remove_file(feature_test)
483
487
  if not enable_redis:
484
488
  remove_file(os.path.join(backend_tests, "test_clients.py"))
485
489
  if not (use_postgresql and use_sqlalchemy):
@@ -5,18 +5,14 @@ LangChain / LangGraph / DeepAgents don't have a model-native web-fetch
5
5
  capability (only PydanticAI/PydanticDeep do), so this gives them a portable,
6
6
  SSRF-safe "read this web page" tool.
7
7
 
8
- SSRF protection reuses ``app.core.sanitize.validate_webhook_url`` (scheme +
9
- userinfo + DNS-resolves-to-public-IP checks). Redirects are followed manually
10
- so every hop is re-validated — ``httpx``'s built-in redirect following would
11
- bypass the per-hop check.
8
+ The HTTP transport validates and pins the address for every redirect hop.
12
9
  """
13
10
 
14
- import asyncio
15
-
16
11
  import httpx
17
12
  from bs4 import BeautifulSoup
18
13
 
19
- from app.core.sanitize import SSRFBlockedError, validate_webhook_url
14
+ from app.core.public_http import PublicHTTPTransport
15
+ from app.core.sanitize import SSRFBlockedError
20
16
 
21
17
  # Keep tool output bounded so a huge page can't blow up the context window.
22
18
  DEFAULT_MAX_CHARS = 8000
@@ -52,7 +48,6 @@ async def _resolve_safe(client: httpx.AsyncClient, url: str) -> httpx.Response:
52
48
  """GET ``url``, validating SSRF safety on the initial URL and every redirect."""
53
49
  current = url
54
50
  for _ in range(MAX_REDIRECTS + 1):
55
- validate_webhook_url(current) # raises SSRFBlockedError / ValueError
56
51
  resp = await client.get(current, headers=_HEADERS, follow_redirects=False)
57
52
  if resp.is_redirect and "location" in resp.headers:
58
53
  current = str(resp.next_request.url) if resp.next_request else resp.headers["location"]
@@ -76,7 +71,7 @@ async def fetch_url(url: str, max_chars: int = DEFAULT_MAX_CHARS) -> str:
76
71
  The page's readable text, or a short error message the agent can act on.
77
72
  """
78
73
  try:
79
- async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT) as client:
74
+ async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT, transport=PublicHTTPTransport()) as client:
80
75
  resp = await _resolve_safe(client, url)
81
76
  except SSRFBlockedError as e:
82
77
  return f"Could not fetch URL — blocked for security reasons: {e}"
@@ -183,9 +183,9 @@ SyncSourceSvc = Annotated[SyncSourceService, Depends(get_sync_source_service)]
183
183
  from app.services.rag_status import RAGStatusService
184
184
 
185
185
 
186
- def get_rag_status_service() -> RAGStatusService:
187
- """Create RAGStatusService instance (no DB)."""
188
- return RAGStatusService()
186
+ def get_rag_status_service(redis: Redis) -> RAGStatusService:
187
+ """Use the Redis client managed by the application lifespan."""
188
+ return RAGStatusService(redis.raw)
189
189
 
190
190
 
191
191
  RAGStatusSvc = Annotated[RAGStatusService, Depends(get_rag_status_service)]
@@ -150,12 +150,15 @@ async def upload_kb_document(
150
150
  ) -> Any:
151
151
  """Upload a file into the KB's underlying vector collection.
152
152
 
153
- Auth is per-KB (owner / org member / admin) — unlike the bulk
153
+ Auth is per-KB (owner / organization admin / app admin) — unlike the bulk
154
154
  ``/rag/{collection}/documents`` endpoint which is admin-only — so a
155
155
  workspace user can manage their own KB without elevation.
156
156
  """
157
- kb = await service.get(
158
- kb_id, user_id=current_user.id, organization_id=active_org.id
157
+ kb = await service.get_for_write(
158
+ kb_id,
159
+ user_id=current_user.id,
160
+ organization_id=active_org.id,
161
+ is_app_admin=current_user.is_app_admin,
159
162
  )
160
163
  data = await file.read()
161
164
  return await rag_doc_service.dispatch_upload(
@@ -211,8 +214,11 @@ async def delete_kb_document(
211
214
  check a KB owner could pass any doc_id and remove docs from KBs they
212
215
  don't own.
213
216
  """
214
- kb = await service.get(
215
- kb_id, user_id=current_user.id, organization_id=active_org.id
217
+ kb = await service.get_for_write(
218
+ kb_id,
219
+ user_id=current_user.id,
220
+ organization_id=active_org.id,
221
+ is_app_admin=current_user.is_app_admin,
216
222
  )
217
223
  doc = await rag_doc_service.get_document(str(doc_id))
218
224
  if doc.collection_name != kb.collection_name:
@@ -295,7 +301,12 @@ async def create_kb_sync_source(
295
301
  The ``collection_name`` field on the request body is overridden with the
296
302
  KB's own collection — clients should not need to know that detail.
297
303
  """
298
- kb = await service.get(kb_id, user_id=current_user.id, organization_id=active_org.id)
304
+ kb = await service.get_for_write(
305
+ kb_id,
306
+ user_id=current_user.id,
307
+ organization_id=active_org.id,
308
+ is_app_admin=current_user.is_app_admin,
309
+ )
299
310
  payload = data.model_copy(update={"collection_name": kb.collection_name})
300
311
  return await sync_source_svc.create_source(payload, organization_id=active_org.id)
301
312
 
@@ -319,10 +330,22 @@ async def clone_kb_sync_source(
319
330
  Decrypts credentials from the source and re-encrypts them for the clone,
320
331
  pinning it to this KB's collection_name. The clone is independent.
321
332
  """
322
- kb = await service.get(kb_id, user_id=current_user.id, organization_id=active_org.id)
333
+ kb = await service.get_for_write(
334
+ kb_id,
335
+ user_id=current_user.id,
336
+ organization_id=active_org.id,
337
+ is_app_admin=current_user.is_app_admin,
338
+ )
323
339
  clone_data = data.model_copy(update={"collection_name": kb.collection_name})
324
340
  return await sync_source_svc.clone_source(
325
- str(source_id), clone_data, organization_id=active_org.id
341
+ str(source_id),
342
+ clone_data,
343
+ organization_id=active_org.id,
344
+ allowed_source_collections=await service.manageable_collection_names(
345
+ user_id=current_user.id, organization_id=active_org.id,
346
+ is_app_admin=current_user.is_app_admin,
347
+ ),
348
+ allow_org_integrations=await service.can_manage_org(current_user.id, active_org.id),
326
349
  )
327
350
 
328
351
 
@@ -339,10 +362,13 @@ async def trigger_kb_sync_source(
339
362
  active_org: ActiveOrg,
340
363
  ) -> Any:
341
364
  """Manually trigger a sync run for one of this KB's sources."""
342
- kb = await service.get(
343
- kb_id, user_id=current_user.id, organization_id=active_org.id
365
+ kb = await service.get_for_write(
366
+ kb_id,
367
+ user_id=current_user.id,
368
+ organization_id=active_org.id,
369
+ is_app_admin=current_user.is_app_admin,
344
370
  )
345
- source = await sync_source_svc.get_source(str(source_id))
371
+ source = await sync_source_svc.get_source_for_org(str(source_id), active_org.id)
346
372
  if source.collection_name != kb.collection_name:
347
373
  raise NotFoundError(
348
374
  message="Sync source not found in this knowledge base",
@@ -406,10 +432,13 @@ async def delete_kb_sync_source(
406
432
  active_org: ActiveOrg,
407
433
  ) -> None:
408
434
  """Remove a sync source from this KB."""
409
- kb = await service.get(
410
- kb_id, user_id=current_user.id, organization_id=active_org.id
435
+ kb = await service.get_for_write(
436
+ kb_id,
437
+ user_id=current_user.id,
438
+ organization_id=active_org.id,
439
+ is_app_admin=current_user.is_app_admin,
411
440
  )
412
- source = await sync_source_svc.get_source(str(source_id))
441
+ source = await sync_source_svc.get_source_for_org(str(source_id), active_org.id)
413
442
  if source.collection_name != kb.collection_name:
414
443
  raise NotFoundError(
415
444
  message="Sync source not found in this knowledge base",
@@ -188,27 +188,36 @@ async def list_documents(
188
188
  async def search_documents(
189
189
  request: RAGSearchRequest,
190
190
  retrieval_service: RetrievalSvc,
191
- {%- if cookiecutter.use_jwt %}
191
+ {%- if cookiecutter.enable_teams and cookiecutter.use_jwt %}
192
+ current_user: CurrentUser,
193
+ active_org: ActiveOrg,
194
+ kb_svc: KnowledgeBaseSvc,
195
+ {%- elif cookiecutter.use_jwt %}
192
196
  _: CurrentUser,
193
197
  {%- endif %}
194
198
  use_reranker: bool = Query(False, description="Whether to use reranking (if configured)"),
195
199
  ) -> Any:
196
200
  """Search for relevant document chunks. Supports multi-collection search."""
197
- if request.collection_names and len(request.collection_names) > 1:
201
+ collections = request.collection_names or [request.collection_name]
202
+ {%- if cookiecutter.enable_teams and cookiecutter.use_jwt %}
203
+ allowed = await kb_svc.list_accessible_collection_names(
204
+ user_id=current_user.id, organization_id=active_org.id
205
+ )
206
+ if not set(collections).issubset(allowed):
207
+ raise NotFoundError(message="Knowledge base not found")
208
+ {%- endif %}
209
+ if len(collections) > 1:
198
210
  results = await retrieval_service.retrieve_multi(
199
211
  query=request.query,
200
- collection_names=request.collection_names,
212
+ collection_names=collections,
201
213
  limit=request.limit,
202
214
  min_score=request.min_score,
203
215
  use_reranker=use_reranker,
204
216
  )
205
217
  else:
206
- collection = (
207
- request.collection_names[0] if request.collection_names else request.collection_name
208
- )
209
218
  results = await retrieval_service.retrieve(
210
219
  query=request.query,
211
- collection_name=collection,
220
+ collection_name=collections[0],
212
221
  limit=request.limit,
213
222
  min_score=request.min_score,
214
223
  filter=request.filter or "",
@@ -439,7 +448,8 @@ async def clone_sync_source(
439
448
  source_id: str,
440
449
  data: SyncSourceClone,
441
450
  sync_source_svc: SyncSourceSvc,
442
- _: CurrentAdmin,
451
+ admin: CurrentAdmin,
452
+ kb_svc: KnowledgeBaseSvc,
443
453
  active_org: ActiveOrg,
444
454
  ) -> Any:
445
455
  """Clone an existing integration into a different knowledge base.
@@ -447,7 +457,15 @@ async def clone_sync_source(
447
457
  Credentials are decrypted from the source and re-encrypted for the clone.
448
458
  The clone is independent — its own schedule and sync history.
449
459
  """
450
- return await sync_source_svc.clone_source(source_id, data, organization_id=active_org.id)
460
+ allowed = await kb_svc.manageable_collection_names(
461
+ user_id=admin.id, organization_id=active_org.id, is_app_admin=admin.is_app_admin
462
+ )
463
+ if data.collection_name not in allowed:
464
+ raise NotFoundError(message="Knowledge base not found")
465
+ return await sync_source_svc.clone_source(
466
+ source_id, data, organization_id=active_org.id, allowed_source_collections=allowed,
467
+ allow_org_integrations=await kb_svc.can_manage_org(admin.id, active_org.id),
468
+ )
451
469
  {%- endif %}
452
470
 
453
471
 
@@ -512,6 +530,13 @@ async def list_connectors(
512
530
 
513
531
  @router.get("/status/stream", response_class=EventSourceResponse)
514
532
  async def rag_status_stream(
533
+ {%- if cookiecutter.enable_teams and cookiecutter.use_jwt %}
534
+ admin: CurrentAdmin,
535
+ active_org: ActiveOrg,
536
+ kb_svc: KnowledgeBaseSvc,
537
+ {%- elif cookiecutter.use_jwt %}
538
+ _: CurrentAdmin,
539
+ {%- endif %}
515
540
  rag_status_svc: RAGStatusSvc,
516
541
  ) -> AsyncIterable[ServerSentEvent]:
517
542
  """SSE endpoint for real-time RAG ingestion status updates.
@@ -523,7 +548,14 @@ async def rag_status_stream(
523
548
  streams what it yields. Returning the generator object instead (with
524
549
  ``response_class``) makes the producer mis-iterate it → HTTP 500.
525
550
  """
551
+ {%- if cookiecutter.enable_teams and cookiecutter.use_jwt %}
552
+ collections = await kb_svc.list_accessible_collection_names(
553
+ user_id=admin.id, organization_id=active_org.id
554
+ )
555
+ async for event in rag_status_svc.stream_events(collections=set(collections)):
556
+ {%- else %}
526
557
  async for event in rag_status_svc.stream_events():
558
+ {%- endif %}
527
559
  yield event
528
560
  {%- endif %}
529
561
  {%- else %}
@@ -33,17 +33,18 @@ async def telegram_webhook(
33
33
  Immediately returns HTTP 200 to Telegram, then processes the update
34
34
  asynchronously in the background so Telegram does not time out.
35
35
  """
36
- adapter = get_adapter("telegram")
37
- headers: dict[str, str] = dict(request.headers)
38
- payload: dict[str, Any] = await request.json()
39
-
40
36
  bot = await bot_service.find_active(bot_id)
41
- if bot is None:
37
+ if bot is None or bot.platform != "telegram" or not bot.webhook_mode:
42
38
  return Response(status_code=200)
43
39
 
44
- if bot.webhook_secret and not adapter.verify_webhook_signature(headers, bot.webhook_secret):
40
+ secret = bot.webhook_secret
41
+ if not secret:
42
+ raise HTTPException(status_code=403, detail="Invalid webhook signature")
43
+ adapter = get_adapter("telegram")
44
+ if not adapter.verify_webhook_signature(dict(request.headers), secret):
45
45
  raise HTTPException(status_code=403, detail="Invalid webhook signature")
46
46
 
47
+ payload: dict[str, Any] = await request.json()
47
48
  incoming = adapter.parse_incoming(payload, str(bot_id))
48
49
  if incoming is None:
49
50
  return Response(status_code=200)
@@ -17,16 +17,23 @@ from uuid import UUID
17
17
  import click
18
18
 
19
19
  from app.commands import command, error, info, success
20
- from app.core.config import settings
20
+ from app.core.exceptions import NotFoundError
21
21
  from app.db.session import get_db_context
22
22
  from app.schemas.channel_bot import AccessPolicy, ChannelBotCreate
23
23
  from app.services.channel_bot import ChannelBotService
24
24
  from app.services.channels import get_adapter
25
25
  from app.services.channels.base import OutgoingMessage
26
+ {%- if cookiecutter.use_telegram %}
27
+ from app.services.channels import register_adapter
28
+ from app.services.channels.telegram import TelegramAdapter
29
+ {%- endif %}
26
30
 
27
31
  @asynccontextmanager
28
32
  async def _channel_service():
29
33
  """Open a DB session and yield a ChannelBotService bound to it."""
34
+ {%- if cookiecutter.use_telegram %}
35
+ register_adapter(TelegramAdapter())
36
+ {%- endif %}
30
37
  async with get_db_context() as db:
31
38
  yield ChannelBotService(db)
32
39
 
@@ -90,20 +97,11 @@ def channel_webhook_register(bot_id: str) -> None:
90
97
  async def _run() -> None:
91
98
  async with _channel_service() as svc:
92
99
  try:
93
- bot = await svc.get(_coerce_bot_id(bot_id))
94
- except Exception:
100
+ result = await svc.register_webhook(_coerce_bot_id(bot_id))
101
+ except NotFoundError:
95
102
  error(f"Bot not found: {bot_id}")
96
103
  return
97
- token = svc.get_decrypted_token(bot)
98
-
99
- adapter = get_adapter("telegram")
100
- webhook_url = (
101
- f"{settings.TELEGRAM_WEBHOOK_BASE_URL}/api/v1/channels/telegram/{bot_id}/webhook"
102
- )
103
-
104
- info(f"Registering webhook: {webhook_url}")
105
- ok = await adapter.register_webhook(token, url=webhook_url, secret=bot.webhook_secret)
106
- if ok:
104
+ if result["success"]:
107
105
  success("Webhook registered successfully.")
108
106
  else:
109
107
  error("Failed to register webhook. Check logs for details.")
@@ -118,16 +116,12 @@ def channel_webhook_delete(bot_id: str) -> None:
118
116
  async def _run() -> None:
119
117
  async with _channel_service() as svc:
120
118
  try:
121
- bot = await svc.get(_coerce_bot_id(bot_id))
122
- except Exception:
119
+ result = await svc.delete_webhook(_coerce_bot_id(bot_id))
120
+ except NotFoundError:
123
121
  error(f"Bot not found: {bot_id}")
124
122
  return
125
- token = svc.get_decrypted_token(bot)
126
-
127
- adapter = get_adapter("telegram")
128
- ok = await adapter.delete_webhook(token)
129
- if ok:
130
- success("Webhook removed. Bot is now in polling mode.")
123
+ if result["success"]:
124
+ success("Webhook removed successfully.")
131
125
  else:
132
126
  error("Failed to remove webhook. Check logs for details.")
133
127
 
@@ -0,0 +1,34 @@
1
+ """HTTP transport for outbound requests that may reach public networks only."""
2
+
3
+ import asyncio
4
+
5
+ import httpx
6
+
7
+ from app.core.sanitize import resolve_public_addresses
8
+
9
+
10
+ class PublicHTTPTransport(httpx.AsyncHTTPTransport):
11
+ """Connect to a validated address while verifying TLS for the original host."""
12
+
13
+ def __init__(self) -> None:
14
+ # The pool keys connections by IP after pinning. Avoid reusing a
15
+ # connection across hostnames that resolve to the same address.
16
+ super().__init__(limits=httpx.Limits(max_keepalive_connections=0))
17
+
18
+ async def handle_async_request(self, request: httpx.Request) -> httpx.Response:
19
+ addresses = await asyncio.to_thread(resolve_public_addresses, str(request.url))
20
+ extensions = {**request.extensions, "sni_hostname": request.url.raw_host.decode("ascii")}
21
+ for index, address in enumerate(addresses):
22
+ pinned_request = httpx.Request(
23
+ request.method,
24
+ request.url.copy_with(host=address),
25
+ headers=request.headers,
26
+ stream=request.stream,
27
+ extensions=extensions,
28
+ )
29
+ try:
30
+ return await super().handle_async_request(pinned_request)
31
+ except (httpx.ConnectError, httpx.ConnectTimeout):
32
+ if index == len(addresses) - 1:
33
+ raise
34
+ raise RuntimeError("Public address resolution returned no addresses")