fastapi-fullstack 0.1.7__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 (241) hide show
  1. fastapi_fullstack-0.1.7.dist-info/METADATA +739 -0
  2. fastapi_fullstack-0.1.7.dist-info/RECORD +241 -0
  3. fastapi_fullstack-0.1.7.dist-info/WHEEL +4 -0
  4. fastapi_fullstack-0.1.7.dist-info/entry_points.txt +2 -0
  5. fastapi_fullstack-0.1.7.dist-info/licenses/LICENSE +21 -0
  6. fastapi_gen/__init__.py +3 -0
  7. fastapi_gen/cli.py +442 -0
  8. fastapi_gen/config.py +356 -0
  9. fastapi_gen/generator.py +207 -0
  10. fastapi_gen/prompts.py +874 -0
  11. fastapi_gen/template/VARIABLES.md +276 -0
  12. fastapi_gen/template/cookiecutter.json +93 -0
  13. fastapi_gen/template/hooks/post_gen_project.py +355 -0
  14. fastapi_gen/template/{{cookiecutter.project_slug}}/.env.prod.example +56 -0
  15. fastapi_gen/template/{{cookiecutter.project_slug}}/.github/workflows/ci.yml +150 -0
  16. fastapi_gen/template/{{cookiecutter.project_slug}}/.gitignore +109 -0
  17. fastapi_gen/template/{{cookiecutter.project_slug}}/AGENTS.md +55 -0
  18. fastapi_gen/template/{{cookiecutter.project_slug}}/CLAUDE.md +99 -0
  19. fastapi_gen/template/{{cookiecutter.project_slug}}/Makefile +315 -0
  20. fastapi_gen/template/{{cookiecutter.project_slug}}/README.md +768 -0
  21. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.dockerignore +60 -0
  22. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.env.example +155 -0
  23. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/.pre-commit-config.yaml +32 -0
  24. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/Dockerfile +56 -0
  25. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/env.py +76 -0
  26. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/script.py.mako +30 -0
  27. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic/versions/.gitkeep +0 -0
  28. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/alembic.ini +48 -0
  29. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/__init__.py +3 -0
  30. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/admin.py +447 -0
  31. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/__init__.py +23 -0
  32. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/assistant.py +226 -0
  33. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/langchain_assistant.py +226 -0
  34. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/prompts.py +10 -0
  35. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/__init__.py +13 -0
  36. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/agents/tools/datetime_tool.py +17 -0
  37. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/__init__.py +1 -0
  38. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/deps.py +541 -0
  39. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/exception_handlers.py +98 -0
  40. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/router.py +10 -0
  41. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/__init__.py +9 -0
  42. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/__init__.py +87 -0
  43. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/agent.py +902 -0
  44. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/auth.py +395 -0
  45. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/conversations.py +498 -0
  46. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/health.py +227 -0
  47. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/items.py +275 -0
  48. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/oauth.py +205 -0
  49. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/sessions.py +168 -0
  50. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/users.py +333 -0
  51. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/webhooks.py +477 -0
  52. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/routes/v1/ws.py +46 -0
  53. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/api/versioning.py +221 -0
  54. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/__init__.py +14 -0
  55. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/clients/redis.py +88 -0
  56. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/__init__.py +117 -0
  57. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/cleanup.py +75 -0
  58. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/example.py +28 -0
  59. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/commands/seed.py +266 -0
  60. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/__init__.py +5 -0
  61. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/cache.py +23 -0
  62. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/config.py +267 -0
  63. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/csrf.py +153 -0
  64. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/exceptions.py +122 -0
  65. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/logfire_setup.py +101 -0
  66. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/middleware.py +99 -0
  67. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/oauth.py +23 -0
  68. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/rate_limit.py +58 -0
  69. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/sanitize.py +271 -0
  70. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/core/security.py +102 -0
  71. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/__init__.py +7 -0
  72. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/base.py +41 -0
  73. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/__init__.py +31 -0
  74. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/conversation.py +319 -0
  75. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/item.py +96 -0
  76. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/session.py +126 -0
  77. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/user.py +218 -0
  78. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/models/webhook.py +244 -0
  79. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/db/session.py +130 -0
  80. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/main.py +334 -0
  81. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/pipelines/__init__.py +9 -0
  82. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/pipelines/base.py +73 -0
  83. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/__init__.py +49 -0
  84. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/base.py +154 -0
  85. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/conversation.py +838 -0
  86. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/item.py +222 -0
  87. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/session.py +318 -0
  88. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/user.py +322 -0
  89. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/repositories/webhook.py +358 -0
  90. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/__init__.py +50 -0
  91. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/base.py +57 -0
  92. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/conversation.py +192 -0
  93. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/item.py +52 -0
  94. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/session.py +42 -0
  95. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/token.py +31 -0
  96. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/user.py +64 -0
  97. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/schemas/webhook.py +89 -0
  98. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/__init__.py +38 -0
  99. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/conversation.py +850 -0
  100. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/item.py +246 -0
  101. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/session.py +333 -0
  102. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/user.py +432 -0
  103. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/services/webhook.py +561 -0
  104. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/__init__.py +5 -0
  105. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/celery_app.py +64 -0
  106. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/taskiq_app.py +38 -0
  107. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/__init__.py +25 -0
  108. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/examples.py +106 -0
  109. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/schedules.py +29 -0
  110. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/app/worker/tasks/taskiq_examples.py +92 -0
  111. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/__init__.py +1 -0
  112. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/cli/commands.py +438 -0
  113. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/pyproject.toml +180 -0
  114. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/scripts/.gitkeep +0 -0
  115. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/__init__.py +1 -0
  116. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/__init__.py +1 -0
  117. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_auth.py +242 -0
  118. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_exceptions.py +151 -0
  119. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_health.py +113 -0
  120. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_items.py +310 -0
  121. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/api/test_users.py +253 -0
  122. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/conftest.py +151 -0
  123. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_admin.py +890 -0
  124. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_agents.py +261 -0
  125. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_clients.py +183 -0
  126. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_commands.py +173 -0
  127. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_core.py +143 -0
  128. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_pipelines.py +118 -0
  129. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_repositories.py +181 -0
  130. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_security.py +124 -0
  131. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_services.py +363 -0
  132. fastapi_gen/template/{{cookiecutter.project_slug}}/backend/tests/test_worker.py +85 -0
  133. fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.dev.yml +242 -0
  134. fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.frontend.yml +31 -0
  135. fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.prod.yml +435 -0
  136. fastapi_gen/template/{{cookiecutter.project_slug}}/docker-compose.yml +241 -0
  137. fastapi_gen/template/{{cookiecutter.project_slug}}/docs/adding_features.md +132 -0
  138. fastapi_gen/template/{{cookiecutter.project_slug}}/docs/architecture.md +63 -0
  139. fastapi_gen/template/{{cookiecutter.project_slug}}/docs/patterns.md +161 -0
  140. fastapi_gen/template/{{cookiecutter.project_slug}}/docs/testing.md +120 -0
  141. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.dockerignore +40 -0
  142. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.env.example +12 -0
  143. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.gitignore +45 -0
  144. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.prettierignore +19 -0
  145. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/.prettierrc +11 -0
  146. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/Dockerfile +44 -0
  147. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/README.md +648 -0
  148. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/auth.setup.ts +49 -0
  149. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/auth.spec.ts +134 -0
  150. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/chat.spec.ts +207 -0
  151. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/e2e/home.spec.ts +73 -0
  152. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/instrumentation.ts +14 -0
  153. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/messages/en.json +84 -0
  154. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/messages/pl.json +84 -0
  155. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/next.config.ts +76 -0
  156. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/package.json +69 -0
  157. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/playwright.config.ts +101 -0
  158. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/postcss.config.mjs +7 -0
  159. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(auth)/layout.tsx +11 -0
  160. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(auth)/login/page.tsx +5 -0
  161. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(auth)/register/page.tsx +5 -0
  162. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/chat/page.tsx +48 -0
  163. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/dashboard/page.tsx +99 -0
  164. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/layout.tsx +17 -0
  165. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/(dashboard)/profile/page.tsx +152 -0
  166. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/auth/callback/page.tsx +113 -0
  167. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/layout.tsx +46 -0
  168. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/[locale]/page.tsx +73 -0
  169. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/login/route.ts +58 -0
  170. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/logout/route.ts +24 -0
  171. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/me/route.ts +39 -0
  172. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/oauth-callback/route.ts +50 -0
  173. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/refresh/route.ts +54 -0
  174. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/auth/register/route.ts +26 -0
  175. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/[id]/messages/route.ts +41 -0
  176. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/[id]/route.ts +108 -0
  177. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/conversations/route.ts +73 -0
  178. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/api/health/route.ts +21 -0
  179. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/globals.css +323 -0
  180. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/layout.tsx +22 -0
  181. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/app/providers.tsx +29 -0
  182. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/index.ts +2 -0
  183. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/login-form.tsx +120 -0
  184. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/auth/register-form.tsx +153 -0
  185. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/chat-container.tsx +234 -0
  186. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/chat-input.tsx +72 -0
  187. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/conversation-sidebar.tsx +328 -0
  188. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/copy-button.tsx +46 -0
  189. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/index.ts +11 -0
  190. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/local-conversation-sidebar.tsx +295 -0
  191. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/markdown-content.tsx +167 -0
  192. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/message-item.tsx +79 -0
  193. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/message-list.tsx +18 -0
  194. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/chat/tool-call-card.tsx +79 -0
  195. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/icons/google-icon.tsx +32 -0
  196. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/icons/index.ts +3 -0
  197. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/language-switcher.tsx +97 -0
  198. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/header.tsx +65 -0
  199. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/index.ts +2 -0
  200. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/layout/sidebar.tsx +82 -0
  201. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/index.ts +7 -0
  202. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/theme-provider.tsx +53 -0
  203. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/theme/theme-toggle.tsx +105 -0
  204. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/badge.tsx +35 -0
  205. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/button.test.tsx +75 -0
  206. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/button.tsx +56 -0
  207. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/card.tsx +82 -0
  208. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/index.ts +13 -0
  209. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/input.tsx +21 -0
  210. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/label.tsx +21 -0
  211. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/components/ui/sheet.tsx +109 -0
  212. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/index.ts +7 -0
  213. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-auth.ts +97 -0
  214. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-chat.ts +203 -0
  215. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-conversations.ts +181 -0
  216. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-local-chat.ts +165 -0
  217. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/hooks/use-websocket.ts +105 -0
  218. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/i18n.ts +37 -0
  219. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/api-client.ts +90 -0
  220. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/constants.ts +39 -0
  221. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/server-api.ts +78 -0
  222. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/utils.test.ts +44 -0
  223. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/lib/utils.ts +44 -0
  224. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/middleware.ts +31 -0
  225. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/auth-store.test.ts +72 -0
  226. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/auth-store.ts +64 -0
  227. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/chat-sidebar-store.ts +17 -0
  228. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/chat-store.ts +65 -0
  229. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/conversation-store.ts +76 -0
  230. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/index.ts +9 -0
  231. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/local-chat-store.ts +255 -0
  232. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/sidebar-store.ts +17 -0
  233. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/stores/theme-store.ts +44 -0
  234. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/api.ts +27 -0
  235. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/auth.ts +52 -0
  236. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/chat.ts +83 -0
  237. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/conversation.ts +49 -0
  238. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/src/types/index.ts +10 -0
  239. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/tsconfig.json +28 -0
  240. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/vitest.config.ts +36 -0
  241. fastapi_gen/template/{{cookiecutter.project_slug}}/frontend/vitest.setup.ts +56 -0
@@ -0,0 +1,234 @@
1
+ "use client";
2
+
3
+ import { useEffect, useRef, useCallback } from "react";
4
+ import { useChat, useLocalChat } from "@/hooks";
5
+ import { MessageList } from "./message-list";
6
+ import { ChatInput } from "./chat-input";
7
+ import { Button } from "@/components/ui";
8
+ import { Wifi, WifiOff, RotateCcw, Bot } from "lucide-react";
9
+ {%- if cookiecutter.enable_conversation_persistence and cookiecutter.use_database %}
10
+ import { useConversationStore, useChatStore, useAuthStore } from "@/stores";
11
+ import { useConversations } from "@/hooks";
12
+ {%- endif %}
13
+
14
+ {%- if cookiecutter.enable_conversation_persistence and cookiecutter.use_database %}
15
+ interface ChatContainerProps {
16
+ useLocalStorage?: boolean;
17
+ }
18
+
19
+ export function ChatContainer({ useLocalStorage = false }: ChatContainerProps) {
20
+ const { isAuthenticated } = useAuthStore();
21
+
22
+ const shouldUseLocal = useLocalStorage || !isAuthenticated;
23
+
24
+ if (shouldUseLocal) {
25
+ return <LocalChatContainer />;
26
+ }
27
+
28
+ return <AuthenticatedChatContainer />;
29
+ }
30
+
31
+ function AuthenticatedChatContainer() {
32
+ const { currentConversationId, currentMessages } = useConversationStore();
33
+ const { addMessage: addChatMessage } = useChatStore();
34
+ const { fetchConversations } = useConversations();
35
+ const prevConversationIdRef = useRef<string | null | undefined>(undefined);
36
+
37
+ const handleConversationCreated = useCallback((conversationId: string) => {
38
+ fetchConversations();
39
+ }, [fetchConversations]);
40
+
41
+ const {
42
+ messages,
43
+ isConnected,
44
+ isProcessing,
45
+ connect,
46
+ disconnect,
47
+ sendMessage,
48
+ clearMessages,
49
+ } = useChat({
50
+ conversationId: currentConversationId,
51
+ onConversationCreated: handleConversationCreated,
52
+ });
53
+
54
+ const messagesEndRef = useRef<HTMLDivElement>(null);
55
+
56
+ // Clear messages when conversation changes, but NOT when going from null to a new ID
57
+ // (that happens when a new chat is saved - we want to keep the messages)
58
+ useEffect(() => {
59
+ const prevId = prevConversationIdRef.current;
60
+ const currId = currentConversationId;
61
+
62
+ // Skip initial mount
63
+ if (prevId === undefined) {
64
+ prevConversationIdRef.current = currId;
65
+ return;
66
+ }
67
+
68
+ // Clear messages when:
69
+ // 1. Going from a conversation to null (new chat)
70
+ // 2. Switching between two different conversations
71
+ // Do NOT clear when going from null to a conversation (new chat being saved)
72
+ const shouldClear =
73
+ currId === null || // Going to new chat
74
+ (prevId !== null && prevId !== currId); // Switching between conversations
75
+
76
+ if (shouldClear) {
77
+ clearMessages();
78
+ }
79
+
80
+ prevConversationIdRef.current = currId;
81
+ }, [currentConversationId, clearMessages]);
82
+
83
+ // Load messages from conversation store when switching to a saved conversation
84
+ useEffect(() => {
85
+ if (currentMessages.length > 0) {
86
+ currentMessages.forEach((msg) => {
87
+ addChatMessage({
88
+ id: msg.id,
89
+ role: msg.role,
90
+ content: msg.content,
91
+ timestamp: new Date(msg.created_at),
92
+ toolCalls: msg.tool_calls?.map((tc) => ({
93
+ id: tc.tool_call_id,
94
+ name: tc.tool_name,
95
+ args: tc.args,
96
+ result: tc.result,
97
+ status: tc.status === "failed" ? "error" : tc.status,
98
+ })),
99
+ });
100
+ });
101
+ }
102
+ }, [currentMessages, addChatMessage]);
103
+
104
+ useEffect(() => {
105
+ connect();
106
+ return () => disconnect();
107
+ }, [connect, disconnect]);
108
+
109
+ useEffect(() => {
110
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
111
+ }, [messages]);
112
+
113
+ return (
114
+ <ChatUI
115
+ messages={messages}
116
+ isConnected={isConnected}
117
+ isProcessing={isProcessing}
118
+ sendMessage={sendMessage}
119
+ clearMessages={clearMessages}
120
+ messagesEndRef={messagesEndRef}
121
+ />
122
+ );
123
+ }
124
+ {%- endif %}
125
+
126
+ function LocalChatContainer() {
127
+ const {
128
+ messages,
129
+ isConnected,
130
+ isProcessing,
131
+ connect,
132
+ disconnect,
133
+ sendMessage,
134
+ clearMessages,
135
+ } = useLocalChat();
136
+
137
+ const messagesEndRef = useRef<HTMLDivElement>(null);
138
+
139
+ useEffect(() => {
140
+ connect();
141
+ return () => disconnect();
142
+ }, [connect, disconnect]);
143
+
144
+ useEffect(() => {
145
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
146
+ }, [messages]);
147
+
148
+ return (
149
+ <ChatUI
150
+ messages={messages}
151
+ isConnected={isConnected}
152
+ isProcessing={isProcessing}
153
+ sendMessage={sendMessage}
154
+ clearMessages={clearMessages}
155
+ messagesEndRef={messagesEndRef}
156
+ />
157
+ );
158
+ }
159
+
160
+ {%- if not (cookiecutter.enable_conversation_persistence and cookiecutter.use_database) %}
161
+ export function ChatContainer() {
162
+ return <LocalChatContainer />;
163
+ }
164
+ {%- endif %}
165
+
166
+ interface ChatUIProps {
167
+ messages: import("@/types").ChatMessage[];
168
+ isConnected: boolean;
169
+ isProcessing: boolean;
170
+ sendMessage: (content: string) => void;
171
+ clearMessages: () => void;
172
+ messagesEndRef: React.RefObject<HTMLDivElement | null>;
173
+ }
174
+
175
+ function ChatUI({
176
+ messages,
177
+ isConnected,
178
+ isProcessing,
179
+ sendMessage,
180
+ clearMessages,
181
+ messagesEndRef,
182
+ }: ChatUIProps) {
183
+ return (
184
+ <div className="flex flex-col h-full max-w-4xl mx-auto w-full">
185
+ <div className="flex-1 overflow-y-auto px-2 py-4 sm:px-4 sm:py-6 scrollbar-thin">
186
+ {messages.length === 0 ? (
187
+ <div className="flex flex-col items-center justify-center h-full text-muted-foreground gap-4">
188
+ <div className="w-14 h-14 sm:w-16 sm:h-16 rounded-full bg-secondary flex items-center justify-center">
189
+ <Bot className="h-7 w-7 sm:h-8 sm:w-8" />
190
+ </div>
191
+ <div className="text-center px-4">
192
+ <p className="text-base sm:text-lg font-medium text-foreground">AI Assistant</p>
193
+ <p className="text-sm">Start a conversation to get help</p>
194
+ </div>
195
+ </div>
196
+ ) : (
197
+ <MessageList messages={messages} />
198
+ )}
199
+ <div ref={messagesEndRef} />
200
+ </div>
201
+
202
+ <div className="px-2 pb-2 sm:px-4 sm:pb-4">
203
+ <div className="rounded-xl border bg-card shadow-sm p-3 sm:p-4">
204
+ <ChatInput
205
+ onSend={sendMessage}
206
+ disabled={!isConnected || isProcessing}
207
+ isProcessing={isProcessing}
208
+ />
209
+ <div className="flex items-center justify-between mt-3 pt-3 border-t">
210
+ <div className="flex items-center gap-2">
211
+ {isConnected ? (
212
+ <Wifi className="h-3.5 w-3.5 text-green-500" />
213
+ ) : (
214
+ <WifiOff className="h-3.5 w-3.5 text-red-500" />
215
+ )}
216
+ <span className="text-xs text-muted-foreground">
217
+ {isConnected ? "Connected" : "Disconnected"}
218
+ </span>
219
+ </div>
220
+ <Button
221
+ variant="ghost"
222
+ size="sm"
223
+ onClick={clearMessages}
224
+ className="text-xs h-8 px-3"
225
+ >
226
+ <RotateCcw className="h-3.5 w-3.5 mr-1.5" />
227
+ Reset
228
+ </Button>
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </div>
233
+ );
234
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+
3
+ import { useState, useRef, useEffect } from "react";
4
+ import { Button } from "@/components/ui";
5
+ import { Send, Loader2 } from "lucide-react";
6
+
7
+ interface ChatInputProps {
8
+ onSend: (message: string) => void;
9
+ disabled?: boolean;
10
+ isProcessing?: boolean;
11
+ }
12
+
13
+ export function ChatInput({ onSend, disabled, isProcessing }: ChatInputProps) {
14
+ const [message, setMessage] = useState("");
15
+ const textareaRef = useRef<HTMLTextAreaElement>(null);
16
+
17
+ useEffect(() => {
18
+ if (!isProcessing && textareaRef.current) {
19
+ textareaRef.current.focus();
20
+ }
21
+ }, [isProcessing]);
22
+
23
+ useEffect(() => {
24
+ if (textareaRef.current) {
25
+ textareaRef.current.style.height = "auto";
26
+ textareaRef.current.style.height = `${Math.min(textareaRef.current.scrollHeight, 200)}px`;
27
+ }
28
+ }, [message]);
29
+
30
+ const handleSubmit = (e: React.FormEvent) => {
31
+ e.preventDefault();
32
+ if (message.trim() && !disabled) {
33
+ onSend(message.trim());
34
+ setMessage("");
35
+ }
36
+ };
37
+
38
+ const handleKeyDown = (e: React.KeyboardEvent) => {
39
+ if (e.key === "Enter" && !e.shiftKey) {
40
+ e.preventDefault();
41
+ handleSubmit(e);
42
+ }
43
+ };
44
+
45
+ return (
46
+ <form onSubmit={handleSubmit} className="relative">
47
+ <textarea
48
+ ref={textareaRef}
49
+ value={message}
50
+ onChange={(e) => setMessage(e.target.value)}
51
+ onKeyDown={handleKeyDown}
52
+ placeholder="Type a message..."
53
+ disabled={disabled}
54
+ rows={1}
55
+ className="w-full resize-none bg-transparent pr-14 text-sm sm:text-base placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
56
+ />
57
+ <Button
58
+ type="submit"
59
+ size="icon"
60
+ disabled={disabled || !message.trim()}
61
+ className="absolute right-0 top-0 h-10 w-10 rounded-lg"
62
+ >
63
+ {isProcessing ? (
64
+ <Loader2 className="h-5 w-5 animate-spin" />
65
+ ) : (
66
+ <Send className="h-5 w-5" />
67
+ )}
68
+ <span className="sr-only">Send message</span>
69
+ </Button>
70
+ </form>
71
+ );
72
+ }
@@ -0,0 +1,328 @@
1
+ {%- if cookiecutter.enable_conversation_persistence and cookiecutter.use_database %}
2
+ "use client";
3
+
4
+ import { useEffect, useState } from "react";
5
+ import { useConversations } from "@/hooks";
6
+ import { Button } from "@/components/ui";
7
+ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetClose } from "@/components/ui";
8
+ import { cn } from "@/lib/utils";
9
+ import { useChatSidebarStore } from "@/stores";
10
+ import {
11
+ MessageSquarePlus,
12
+ MessageSquare,
13
+ Trash2,
14
+ Archive,
15
+ MoreVertical,
16
+ Pencil,
17
+ ChevronLeft,
18
+ ChevronRight,
19
+ } from "lucide-react";
20
+ import type { Conversation } from "@/types";
21
+
22
+ interface ConversationItemProps {
23
+ conversation: Conversation;
24
+ isActive: boolean;
25
+ onSelect: () => void;
26
+ onDelete: () => void;
27
+ onArchive: () => void;
28
+ onRename: (title: string) => void;
29
+ }
30
+
31
+ function ConversationItem({
32
+ conversation,
33
+ isActive,
34
+ onSelect,
35
+ onDelete,
36
+ onArchive,
37
+ onRename,
38
+ }: ConversationItemProps) {
39
+ const [showMenu, setShowMenu] = useState(false);
40
+ const [isEditing, setIsEditing] = useState(false);
41
+ const [editTitle, setEditTitle] = useState(conversation.title || "");
42
+
43
+ const handleRename = () => {
44
+ if (editTitle.trim()) {
45
+ onRename(editTitle.trim());
46
+ }
47
+ setIsEditing(false);
48
+ };
49
+
50
+ const displayTitle =
51
+ conversation.title ||
52
+ `Chat ${new Date(conversation.created_at).toLocaleDateString()}`;
53
+
54
+ return (
55
+ <div
56
+ className={cn(
57
+ "group relative flex items-center gap-2 rounded-lg px-3 py-3 text-sm transition-colors cursor-pointer min-h-[44px]",
58
+ isActive
59
+ ? "bg-secondary text-secondary-foreground"
60
+ : "text-muted-foreground hover:bg-secondary/50 hover:text-secondary-foreground"
61
+ )}
62
+ onClick={onSelect}
63
+ >
64
+ <MessageSquare className="h-4 w-4 shrink-0" />
65
+ {isEditing ? (
66
+ <input
67
+ type="text"
68
+ value={editTitle}
69
+ onChange={(e) => setEditTitle(e.target.value)}
70
+ onBlur={handleRename}
71
+ onKeyDown={(e) => {
72
+ if (e.key === "Enter") handleRename();
73
+ if (e.key === "Escape") setIsEditing(false);
74
+ }}
75
+ className="flex-1 bg-transparent outline-none text-foreground"
76
+ autoFocus
77
+ onClick={(e) => e.stopPropagation()}
78
+ />
79
+ ) : (
80
+ <span className="flex-1 truncate">{displayTitle}</span>
81
+ )}
82
+
83
+ <div className="relative">
84
+ <Button
85
+ variant="ghost"
86
+ size="sm"
87
+ className={cn(
88
+ "h-8 w-8 p-0 opacity-0 group-hover:opacity-100 touch:opacity-100",
89
+ showMenu && "opacity-100"
90
+ )}
91
+ onClick={(e) => {
92
+ e.stopPropagation();
93
+ setShowMenu(!showMenu);
94
+ }}
95
+ >
96
+ <MoreVertical className="h-4 w-4" />
97
+ </Button>
98
+
99
+ {showMenu && (
100
+ <>
101
+ <div
102
+ className="fixed inset-0 z-10"
103
+ onClick={() => setShowMenu(false)}
104
+ />
105
+ <div className="absolute right-0 top-8 z-20 w-40 rounded-md border bg-popover shadow-lg">
106
+ <button
107
+ className="flex w-full items-center gap-2 px-3 py-3 text-sm hover:bg-secondary min-h-[44px]"
108
+ onClick={(e) => {
109
+ e.stopPropagation();
110
+ setIsEditing(true);
111
+ setShowMenu(false);
112
+ }}
113
+ >
114
+ <Pencil className="h-4 w-4" />
115
+ Rename
116
+ </button>
117
+ <button
118
+ className="flex w-full items-center gap-2 px-3 py-3 text-sm hover:bg-secondary min-h-[44px]"
119
+ onClick={(e) => {
120
+ e.stopPropagation();
121
+ onArchive();
122
+ setShowMenu(false);
123
+ }}
124
+ >
125
+ <Archive className="h-4 w-4" />
126
+ Archive
127
+ </button>
128
+ <button
129
+ className="flex w-full items-center gap-2 px-3 py-3 text-sm text-destructive hover:bg-destructive/10 min-h-[44px]"
130
+ onClick={(e) => {
131
+ e.stopPropagation();
132
+ onDelete();
133
+ setShowMenu(false);
134
+ }}
135
+ >
136
+ <Trash2 className="h-4 w-4" />
137
+ Delete
138
+ </button>
139
+ </div>
140
+ </>
141
+ )}
142
+ </div>
143
+ </div>
144
+ );
145
+ }
146
+
147
+ interface ConversationListProps {
148
+ conversations: Conversation[];
149
+ currentConversationId: string | null;
150
+ isLoading: boolean;
151
+ onSelect: (id: string) => void;
152
+ onDelete: (id: string) => void;
153
+ onArchive: (id: string) => void;
154
+ onRename: (id: string, title: string) => void;
155
+ onNewChat: () => void;
156
+ onNavigate?: () => void;
157
+ }
158
+
159
+ function ConversationList({
160
+ conversations = [],
161
+ currentConversationId,
162
+ isLoading,
163
+ onSelect,
164
+ onDelete,
165
+ onArchive,
166
+ onRename,
167
+ onNewChat,
168
+ onNavigate,
169
+ }: ConversationListProps) {
170
+ const activeConversations = (conversations ?? []).filter((c) => !c.is_archived);
171
+
172
+ const handleSelect = (id: string) => {
173
+ onSelect(id);
174
+ onNavigate?.();
175
+ };
176
+
177
+ const handleNewChat = () => {
178
+ onNewChat();
179
+ onNavigate?.();
180
+ };
181
+
182
+ return (
183
+ <>
184
+ <div className="p-3">
185
+ <Button
186
+ variant="outline"
187
+ size="sm"
188
+ className="w-full justify-start gap-2 h-10"
189
+ onClick={handleNewChat}
190
+ >
191
+ <MessageSquarePlus className="h-4 w-4" />
192
+ New Chat
193
+ </Button>
194
+ </div>
195
+
196
+ <div className="flex-1 overflow-y-auto px-3 pb-3 scrollbar-thin">
197
+ {isLoading && conversations.length === 0 ? (
198
+ <div className="flex items-center justify-center py-8 text-sm text-muted-foreground">
199
+ Loading...
200
+ </div>
201
+ ) : activeConversations.length === 0 ? (
202
+ <div className="flex flex-col items-center justify-center py-8 text-center text-sm text-muted-foreground">
203
+ <MessageSquare className="h-8 w-8 mb-2 opacity-50" />
204
+ <p>No conversations yet</p>
205
+ <p className="text-xs mt-1">Start a new chat to begin</p>
206
+ </div>
207
+ ) : (
208
+ <div className="space-y-1">
209
+ {activeConversations.map((conversation) => (
210
+ <ConversationItem
211
+ key={conversation.id}
212
+ conversation={conversation}
213
+ isActive={conversation.id === currentConversationId}
214
+ onSelect={() => handleSelect(conversation.id)}
215
+ onDelete={() => onDelete(conversation.id)}
216
+ onArchive={() => onArchive(conversation.id)}
217
+ onRename={(title) => onRename(conversation.id, title)}
218
+ />
219
+ ))}
220
+ </div>
221
+ )}
222
+ </div>
223
+ </>
224
+ );
225
+ }
226
+
227
+ interface ConversationSidebarProps {
228
+ className?: string;
229
+ }
230
+
231
+ export function ConversationSidebar({ className }: ConversationSidebarProps) {
232
+ const [isCollapsed, setIsCollapsed] = useState(false);
233
+ const { isOpen, close } = useChatSidebarStore();
234
+ const {
235
+ conversations,
236
+ currentConversationId,
237
+ isLoading,
238
+ fetchConversations,
239
+ selectConversation,
240
+ deleteConversation,
241
+ archiveConversation,
242
+ renameConversation,
243
+ startNewChat,
244
+ } = useConversations();
245
+
246
+ useEffect(() => {
247
+ fetchConversations();
248
+ }, [fetchConversations]);
249
+
250
+ const listProps = {
251
+ conversations,
252
+ currentConversationId,
253
+ isLoading,
254
+ onSelect: selectConversation,
255
+ onDelete: deleteConversation,
256
+ onArchive: archiveConversation,
257
+ onRename: renameConversation,
258
+ onNewChat: startNewChat,
259
+ };
260
+
261
+ if (isCollapsed) {
262
+ return (
263
+ <div
264
+ className={cn(
265
+ "hidden md:flex flex-col items-center border-r bg-background py-4 w-12",
266
+ className
267
+ )}
268
+ >
269
+ <Button
270
+ variant="ghost"
271
+ size="sm"
272
+ className="h-10 w-10 p-0 mb-4"
273
+ onClick={() => setIsCollapsed(false)}
274
+ >
275
+ <ChevronRight className="h-4 w-4" />
276
+ </Button>
277
+ <Button
278
+ variant="ghost"
279
+ size="sm"
280
+ className="h-10 w-10 p-0"
281
+ onClick={startNewChat}
282
+ title="New Chat"
283
+ >
284
+ <MessageSquarePlus className="h-4 w-4" />
285
+ </Button>
286
+ </div>
287
+ );
288
+ }
289
+
290
+ return (
291
+ <>
292
+ <aside
293
+ className={cn(
294
+ "hidden md:flex w-64 shrink-0 flex-col border-r bg-background",
295
+ className
296
+ )}
297
+ >
298
+ <div className="flex items-center justify-between border-b px-4 py-3 h-12">
299
+ <h2 className="font-semibold text-sm">Conversations</h2>
300
+ <Button
301
+ variant="ghost"
302
+ size="sm"
303
+ className="h-8 w-8 p-0"
304
+ onClick={() => setIsCollapsed(true)}
305
+ >
306
+ <ChevronLeft className="h-4 w-4" />
307
+ </Button>
308
+ </div>
309
+ <ConversationList {...listProps} />
310
+ </aside>
311
+
312
+ <Sheet open={isOpen} onOpenChange={close}>
313
+ <SheetContent side="left" className="w-80 p-0">
314
+ <SheetHeader className="h-12 px-4">
315
+ <SheetTitle>Conversations</SheetTitle>
316
+ <SheetClose onClick={close} />
317
+ </SheetHeader>
318
+ <div className="flex flex-col h-[calc(100%-48px)]">
319
+ <ConversationList {...listProps} onNavigate={close} />
320
+ </div>
321
+ </SheetContent>
322
+ </Sheet>
323
+ </>
324
+ );
325
+ }
326
+ {%- else %}
327
+ export {};
328
+ {%- endif %}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import { Button } from "@/components/ui";
5
+ import { Check, Copy } from "lucide-react";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ interface CopyButtonProps {
9
+ text: string;
10
+ className?: string;
11
+ size?: "sm" | "default";
12
+ }
13
+
14
+ export function CopyButton({ text, className, size = "sm" }: CopyButtonProps) {
15
+ const [copied, setCopied] = useState(false);
16
+
17
+ const handleCopy = async (e: React.MouseEvent) => {
18
+ e.stopPropagation();
19
+ try {
20
+ await navigator.clipboard.writeText(text);
21
+ setCopied(true);
22
+ setTimeout(() => setCopied(false), 2000);
23
+ } catch {
24
+ console.error("Failed to copy text");
25
+ }
26
+ };
27
+
28
+ return (
29
+ <Button
30
+ variant="ghost"
31
+ size={size}
32
+ className={cn(
33
+ "h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
34
+ className
35
+ )}
36
+ onClick={handleCopy}
37
+ title={copied ? "Copied!" : "Copy"}
38
+ >
39
+ {copied ? (
40
+ <Check className="h-3.5 w-3.5 text-green-500" />
41
+ ) : (
42
+ <Copy className="h-3.5 w-3.5" />
43
+ )}
44
+ </Button>
45
+ );
46
+ }
@@ -0,0 +1,11 @@
1
+ export { ChatContainer } from "./chat-container";
2
+ export { MessageList } from "./message-list";
3
+ export { MessageItem } from "./message-item";
4
+ export { ToolCallCard } from "./tool-call-card";
5
+ export { ChatInput } from "./chat-input";
6
+ export { LocalConversationSidebar, ChatSidebarToggle } from "./local-conversation-sidebar";
7
+ export { CopyButton } from "./copy-button";
8
+ export { MarkdownContent } from "./markdown-content";
9
+ {%- if cookiecutter.enable_conversation_persistence and cookiecutter.use_database %}
10
+ export { ConversationSidebar } from "./conversation-sidebar";
11
+ {%- endif %}