mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
update
This commit is contained in:
parent
8a9fb30d0c
commit
923c7a0f69
15 changed files with 71 additions and 111 deletions
|
|
@ -27,14 +27,7 @@ So that toàn bộ nền tảng có thể khởi chạy môi trường phát tri
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
> This section maps directly to the original Product Requirements Document and Epics definition.
|
||||
|
||||
As a Người dùng,
|
||||
I want gọi API an toàn để tạo tài khoản, đăng nhập và lấy mã Token (JWT),
|
||||
So that hệ thống xác thực được danh tính của tôi và kích hoạt RLS (Row-level Security) bảo vệ dữ liệu trên Database Postgres.
|
||||
I want gọi API an toàn để tạo tài khoản, đăng nhập và lấy mã Token (JWT) theo chuẩn quy ước OAuth2,
|
||||
So that hệ thống xác thực được danh tính của tôi và định danh xử lý xác thực qua API backend.
|
||||
**Acceptance Criteria:**
|
||||
**Given** thông tin đăng nhập hợp lệ
|
||||
**When** gửi request tới endpoint liên quan `/api/v1/auth/login`
|
||||
**Then** hệ thống trả về mã JWT chứa userID hợp lệ, bọc trong cấu trúc Wrapper chuẩn `{ "data": {"token": "xxx"}, "error": null, "meta": null }`
|
||||
**And** Cấu hình Row-Level Security (RLS) cơ bản cho bảng dữ liệu (người này không query được dữ liệu của người kia).
|
||||
**When** gửi request form data tới endpoint `/auth/jwt/login`
|
||||
**Then** hệ thống trả về cấu trúc token dạng OAuth2 Bearer: `{"access_token": "xxx", "refresh_token": "xxx", "token_type": "bearer"}`
|
||||
**And** Định danh dữ liệu bảo mật được gắn kết thông qua ORM Filters và Zero-cache access rules thay vì Postgres RLS thuần túy.
|
||||
|
||||
## 🏗️ Architecture & Technical Guardrails
|
||||
> Critical instructions for the development agent based on the project's established architecture.
|
||||
|
|
@ -27,14 +27,7 @@ So that hệ thống xác thực được danh tính của tôi và kích hoạt
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -14,9 +14,8 @@ So that tôi nhận được Token và ngay lập tức kết nối tới hệ t
|
|||
**Given** tôi đang ở trạng thái khách (Guest) trên UI
|
||||
**When** tôi điền form đăng nhập thành công
|
||||
**Then** giao diện lưu token vào cục bộ và tự động khởi tạo instance `ZeroClient` để bắt đầu mở cầu nối WebSockets.
|
||||
**And** khi tôi nhấn nút "Đăng xuất" (Log Out), hàm `onLogout()` tự động thực thi dọn dẹp sạch (purge) toàn bộ IndexedDB, chặn bảo mật.
|
||||
**And** Giao diện (Form đăng nhập, nút bấm) ứng dụng quy chuẩn UX-DR1 (Màu Base Zinc/Accent Indigo, font Inter).
|
||||
Người dùng dễ dàng kéo thả các tệp PDF/TXT lên hệ thống; hệ thống tự động bóc tách dữ liệu mượt mà trong nền mà không làm gián đoạn công việc. Họ nắm rõ tiến độ nạp file và làm chủ khối lượng tài liệu của mình.
|
||||
**And** khi tôi nhấn nút "Đăng xuất" (Log Out), hàm `logout()` tự động thực thi dọn dẹp sạch token cục bộ (localStorage) và ngắt kết nối an toàn.
|
||||
**And** Giao diện (Form đăng nhập, nút bấm) ứng dụng quy chuẩn thiết kế của hệ thống.
|
||||
**FRs covered:** FR1, FR2, FR3, FR4, FR12, FR13
|
||||
|
||||
## 🏗️ Architecture & Technical Guardrails
|
||||
|
|
@ -30,14 +29,11 @@ Người dùng dễ dàng kéo thả các tệp PDF/TXT lên hệ thống; hệ
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
- `surfsense_web/app/(home)/login/LocalLoginForm.tsx`
|
||||
- `surfsense_web/components/UserDropdown.tsx`
|
||||
- `surfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx`
|
||||
- `surfsense_web/lib/auth-utils.ts`
|
||||
- `surfsense_web/components/providers/ZeroProvider.tsx`
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -27,14 +27,10 @@ So that hệ thống API chính không bị nghẽn khi người dùng upload fi
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
- `surfsense_backend/app/services/task_dispatcher.py`
|
||||
- `surfsense_backend/app/tasks/celery_tasks/document_tasks.py`
|
||||
- `surfsense_backend/app/services/docling_service.py`
|
||||
- `surfsense_backend/app/routes/documents_routes.py`
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ So that server tiếp nhận an toàn và ngăn chặn upload spam quá mức h
|
|||
**Acceptance Criteria:**
|
||||
**Given** người dùng đăng nhập hợp lệ
|
||||
**When** đính kèm file và gửi POST tới `/api/v1/documents`
|
||||
**Then** hệ thống check user token, lưu file vô Storage, tạo record ở DB với status 'Queue', và trigger đẩy task vào Celery
|
||||
**And** nếu user push liên tục quá mức quy định (token/hạn mức tải), API sẽ trả về lỗi `429 Too Many Requests` bọc trong error format chuẩn.
|
||||
**Then** hệ thống check bộ nhớ đệm, lưu file vô Storage, tạo record ở DB với status 'Queue', và trigger đẩy task vào Celery.
|
||||
*(Phần giới hạn Rate Limit (429) sẽ được triển khai chính thức ở Epic 5 - Usage Quota)*
|
||||
|
||||
## 🏗️ Architecture & Technical Guardrails
|
||||
> Critical instructions for the development agent based on the project's established architecture.
|
||||
|
|
@ -27,14 +27,7 @@ So that server tiếp nhận an toàn và ngăn chặn upload spam quá mức h
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@ So that tôi biết file nào đã sẵn sàng để chat, file nào đang chạ
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -29,14 +29,7 @@ Người dùng có trải nghiệm truy vấn kho tài liệu "không độ tr
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@ So that tôi có thể bắt đầu một định mức hội thoại mới, tá
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -28,14 +28,7 @@ So that AI có thể phản hồi từng chữ một (streaming) ngay khi lấy
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -26,14 +26,7 @@ So that tôi có thể đối chiếu thông tin AI "bịa" hay "thật" ngay l
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ so that tôi có thể dùng trực tiếp và chi phí sử dụng được tr
|
|||
## Tasks / Subtasks
|
||||
|
||||
- [ ] Task 1: Dọn dẹp Kiến trúc Client cũ (Frontend)
|
||||
- [ ] Subtask 1.1: Gỡ bỏ toàn bộ input fields `openAiKey` / `anthropicKey` khỏi Sidebar/Settings.
|
||||
- [ ] Subtask 1.2: Triển khai Component `ModelSelector` trên UI Chat (gồm ít nhất 2 tuỳ chọn: `GPT-4o-mini` (Rẻ) và `Claude-3.5-Sonnet` (Cao cấp)).
|
||||
- [ ] Subtask 1.1: Gỡ bỏ flow nhập `api_key` tự do ở giao diện LLM Configs (`surfsense_web/app/dashboard/[search_space_id]/llm-configs`), khoá cứng các tuỳ chọn chọn Provider.
|
||||
- [ ] Subtask 1.2: Triển khai Component `ModelSelector` trên UI Chat (hoặc sửa đổi UI chọn LLM Config cũ sang danh sách LLM thương mại).
|
||||
- [ ] Task 2: Cập nhật Schema & Table Quản lý Quota (Backend - `db.py`)
|
||||
- [ ] Subtask 2.1: Bổ sung column `token_balance` (Integer) vào model `User` (hoặc tạo table `UserSubscription`).
|
||||
- [ ] Subtask 2.2: Bổ sung ENUM `LLM_MODEL` vào config db.
|
||||
|
|
@ -43,7 +43,8 @@ so that tôi có thể dùng trực tiếp và chi phí sử dụng được tr
|
|||
- `surfsense_backend/app/db.py`
|
||||
- `surfsense_backend/app/routes/chat_routes.py` (hoặc nơi implement SSE)
|
||||
- `surfsense_web/src/components/chat/`
|
||||
- Phải đảm bảo DB schema migration khi có thuộc tính mới ở User (hoặc bảng rời). Hãy ưu tiên bảng User chung để truy vấn Rate Limit nhanh chóng thay vì join table phức tạp nếu không cần thiết.
|
||||
- Phải đảm bảo DB schema migration (bằng Alembic) khi có thuộc tính mới `token_balance` ở User.
|
||||
- Endpoint `/api/v1/chat/stream` hiện đang phụ thuộc vào `NewLLMConfig`. Cần chỉnh sửa kiến trúc để ánh xạ ID Model do người dùng chọn sang Backend Config cố định của hệ thống.
|
||||
|
||||
### References
|
||||
- [Epic 3 - RAG Engine Requirements]: Epic `3.5`.
|
||||
|
|
@ -56,6 +57,6 @@ Antigravity Claude 3.5 Sonnet Engine (Context: 120k)
|
|||
|
||||
### File List
|
||||
- `surfsense_backend/app/db.py`
|
||||
- `surfsense_backend/app/models/...` (nếu có chia module)
|
||||
- `surfsense_backend/app/routes/chat_routes.py`
|
||||
- `surfsense_web/src/components/chat/ModelSelector.tsx`
|
||||
- `surfsense_web/app/dashboard/[search_space_id]/llm-configs/...`
|
||||
- `surfsense_web/components/chat/...`
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@ So that tôi mở app lên là thấy ngay lập tức lịch sử cũ (FR8, FR9
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@ So that tôi không bị văng lỗi hay hiện màn hình đơ cứng, thay và
|
|||
### Code Organization
|
||||
This story is currently marked as `done`. Implementation should target the following components/files:
|
||||
|
||||
- `surfsense_backend/app/connectors/dropbox/client.py`
|
||||
- `surfsense_backend/app/schemas/incentive_tasks.py`
|
||||
- `surfsense_backend/app/utils/proxy_config.py`
|
||||
- `surfsense_web/components/chat-comments/comment-panel-container/comment-panel-container.tsx`
|
||||
- `surfsense_web/components/tool-ui/write-todos.tsx`
|
||||
- `surfsense_web/components/shared/image-config-dialog.tsx`
|
||||
- `surfsense_backend/app/users.py`
|
||||
- `surfsense_web/components/ui/dropdown-menu.tsx`
|
||||
*(Files to be determined during implementation)*
|
||||
|
||||
### Developer Agent Constraints
|
||||
1. **No Destructive Refactors**: Extend existing modules when possible.
|
||||
|
|
|
|||
19
be.log
Normal file
19
be.log
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
2026-04-13 11:08:51,512 | WARNING | chonkie.chunker.code:__init__:75 - The language is set to `auto`. This would adversely affect the performance of the chunker. Consider setting the `language` parameter to a specific language to improve performance.
|
||||
INFO: Will watch for changes in these directories: ['/Users/luisphan/Documents/GitHub/SurfSense/surfsense_backend/app']
|
||||
INFO: Started server process [56913]
|
||||
INFO: Waiting for application startup.
|
||||
2026-04-13 11:08:59 - app.agents.new_chat.checkpointer - INFO - [Checkpointer] Created AsyncPostgresSaver with connection pool
|
||||
2026-04-13 11:08:59 - app.agents.new_chat.checkpointer - INFO - [Checkpointer] PostgreSQL checkpoint tables ready
|
||||
2026-04-13 11:08:59 - app.tasks.surfsense_docs_indexer - INFO - Starting Surfsense docs indexing...
|
||||
2026-04-13 11:08:59 - app.tasks.surfsense_docs_indexer - INFO - Found 38 MDX files to index
|
||||
2026-04-13 11:08:59 - app.tasks.surfsense_docs_indexer - INFO - Indexing complete: 0 created, 0 updated, 38 skipped, 0 deleted
|
||||
2026-04-13 11:08:59 - app.tasks.surfsense_docs_indexer - INFO - Surfsense docs indexing complete: created=0, updated=0, skipped=38, deleted=0
|
||||
2026-04-13 11:08:59,503 [PERF] [startup_complete] rss=719.2MB cpu=0.0% threads=11 fds=22 asyncio_tasks=6 gc=(6, 0, 11)
|
||||
INFO: Application startup complete.
|
||||
ERROR: [Errno 48] error while attempting to bind on address ('0.0.0.0', 8000): address already in use
|
||||
INFO: Waiting for application shutdown.
|
||||
2026-04-13 11:08:59 - app.agents.new_chat.checkpointer - INFO - [Checkpointer] PostgreSQL connection pool closed
|
||||
INFO: Application shutdown complete.
|
||||
Info: No global LLM configs found, Auto mode will not be available
|
||||
Info: No global image generation configs found, Image Generation Auto mode will not be available
|
||||
Info: No global vision LLM configs found, Vision LLM Auto mode will not be available
|
||||
18
fe.log
Normal file
18
fe.log
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
> surfsense_web@0.0.15 dev
|
||||
> next dev --turbopack
|
||||
|
||||
▲ Next.js 16.1.6 (Turbopack)
|
||||
- Local: http://localhost:3000
|
||||
- Network: http://192.168.1.9:3000
|
||||
- Environments: .env
|
||||
- Experiments (use with caution):
|
||||
· optimizePackageImports
|
||||
|
||||
✓ Starting...
|
||||
[MDX] generated files in 7.297166999999945ms
|
||||
[MDX] started dev server
|
||||
⨯ Unable to acquire lock at /Users/luisphan/Documents/GitHub/SurfSense/surfsense_web/.next/dev/lock, is another instance of next dev running?
|
||||
Suggestion: If you intended to restart next dev, terminate the other process, and then try again.
|
||||
[MDX] closing dev server
|
||||
[?25h
|
||||
Loading…
Add table
Add a link
Reference in a new issue