hoàn thành v 1.0.2 bản áp dụng thuật toán FSRS

This commit is contained in:
2026-04-29 09:27:46 +07:00
parent 8459801ca9
commit 7eabb9fed8
6 changed files with 86 additions and 69 deletions
+5 -2
View File
@@ -1,6 +1,9 @@
node_modules node_modules
docker
custom-images
.git .git
.env
dist dist
/data apps/*/dist
.env* packages/*/dist
.nx .nx
+1
View File
@@ -41,3 +41,4 @@ lerna-debug.log*
.nx .nx
.nx/installation .nx/installation
.nx/cache .nx/cache
*.rdb
@@ -1104,7 +1104,8 @@ export class PageService {
nextDifficulty = w[4] - w[5] * (quality - 3); nextDifficulty = w[4] - w[5] * (quality - 3);
nextState = quality === 1 ? 1 : 2; // If Again, move to Learning, else Review nextState = quality === 1 ? 1 : 2; // If Again, move to Learning, else Review
} else { } else {
const retrievability = Math.pow(0.9, elapsedDays / stability); // Avoid division by zero if stability is 0
const retrievability = stability > 0 ? Math.pow(0.9, elapsedDays / stability) : 0;
if (quality === 1) { if (quality === 1) {
// Failed // Failed
@@ -1123,8 +1124,9 @@ export class PageService {
} }
} }
// Constraints // Constraints & NaN guard
nextStability = Math.min(Math.max(nextStability, 0.1), 36500); nextStability = Math.min(Math.max(nextStability || 0.1, 0.1), 36500);
nextDifficulty = Math.min(Math.max(nextDifficulty || 5, 1), 10);
// FSRS interval formula: I = S * ln(target_recall) / ln(0.9) // FSRS interval formula: I = S * ln(target_recall) / ln(0.9)
// For default target_recall = 0.9, I = S // For default target_recall = 0.9, I = S
@@ -1147,6 +1149,15 @@ export class PageService {
pageId, pageId,
); );
console.log('FSRS CALCULATION:', {
pageId,
quality,
nextStability,
nextDifficulty,
nextReviewDate: nextReviewDate.toISOString(),
reviewInterval: Math.round(exactReviewInterval)
});
return this.pageRepo.findById(pageId); return this.pageRepo.findById(pageId);
} }
+1
View File
@@ -0,0 +1 @@
FROM postgres:18
+1
View File
@@ -0,0 +1 @@
FROM redis:8
+16 -16
View File
@@ -1,40 +1,40 @@
services: services:
docmost: docmost:
image: ghcr.io/victorphan03/docmost:v1.0.0 build: .
image: ghcr.io/victorphan03/docmost:v1.0.2
depends_on: depends_on:
- db - db
- redis - redis
environment: environment:
# THAY ĐỔI: Địa chỉ IP hoặc Domain của server mới APP_URL: 'http://localhost:3000'
APP_URL: 'http://your-server-ip:3000' APP_SECRET: '1a635aac7d7d6afb4c84291baa94ed43a7749d390a739f9e541e210d3dd33399'
# THAY ĐỔI: Một chuỗi ký tự ngẫu nhiên dài để bảo mật
APP_SECRET: '32_KY_TU_NGAU_NHIEN_BAT_KY'
DATABASE_URL: 'postgresql://docmost:STRONG_DB_PASSWORD@db:5432/docmost' DATABASE_URL: 'postgresql://docmost:STRONG_DB_PASSWORD@db:5432/docmost'
REDIS_URL: 'redis://redis:6379' REDIS_URL: 'redis://redis:6379'
ports: ports:
- "3000:3000" - "3000:3000"
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- docmost_data:/app/data/storage - ./data/docmost:/app/data/storage
db: db:
image: postgres:16-alpine build: ./custom-images/db
image: ghcr.io/victorphan03/db:v1.0.2
environment: environment:
POSTGRES_DB: docmost POSTGRES_DB: docmost
POSTGRES_USER: docmost POSTGRES_USER: docmost
POSTGRES_PASSWORD: STRONG_DB_PASSWORD POSTGRES_PASSWORD: STRONG_DB_PASSWORD
restart: unless-stopped restart: unless-stopped
ports:
- "5432:5432"
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - ./data/db_data:/var/lib/postgresql
redis: redis:
image: redis:7-alpine build: ./custom-images/redis
command: ["redis-server", "--appendonly", "yes"] image: ghcr.io/victorphan03/redis:v1.0.2
command: ["redis-server", "--appendonly", "yes", "--maxmemory-policy", "noeviction"]
restart: unless-stopped restart: unless-stopped
ports:
- "6379:6379"
volumes: volumes:
- redis_data:/data - ./data/redis_data:/data
volumes:
docmost_data:
postgres_data:
redis_data: