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
docker
custom-images
.git
.env
dist
/data
.env*
apps/*/dist
packages/*/dist
.nx
+1
View File
@@ -41,3 +41,4 @@ lerna-debug.log*
.nx
.nx/installation
.nx/cache
*.rdb
@@ -1104,7 +1104,8 @@ export class PageService {
nextDifficulty = w[4] - w[5] * (quality - 3);
nextState = quality === 1 ? 1 : 2; // If Again, move to Learning, else Review
} 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) {
// Failed
@@ -1123,8 +1124,9 @@ export class PageService {
}
}
// Constraints
nextStability = Math.min(Math.max(nextStability, 0.1), 36500);
// Constraints & NaN guard
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)
// For default target_recall = 0.9, I = S
@@ -1147,6 +1149,15 @@ export class PageService {
pageId,
);
console.log('FSRS CALCULATION:', {
pageId,
quality,
nextStability,
nextDifficulty,
nextReviewDate: nextReviewDate.toISOString(),
reviewInterval: Math.round(exactReviewInterval)
});
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:
docmost:
image: ghcr.io/victorphan03/docmost:v1.0.0
build: .
image: ghcr.io/victorphan03/docmost:v1.0.2
depends_on:
- db
- redis
environment:
# THAY ĐỔI: Địa chỉ IP hoặc Domain của server mới
APP_URL: 'http://your-server-ip:3000'
# 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'
APP_URL: 'http://localhost:3000'
APP_SECRET: '1a635aac7d7d6afb4c84291baa94ed43a7749d390a739f9e541e210d3dd33399'
DATABASE_URL: 'postgresql://docmost:STRONG_DB_PASSWORD@db:5432/docmost'
REDIS_URL: 'redis://redis:6379'
ports:
- "3000:3000"
restart: unless-stopped
volumes:
- docmost_data:/app/data/storage
- ./data/docmost:/app/data/storage
db:
image: postgres:16-alpine
build: ./custom-images/db
image: ghcr.io/victorphan03/db:v1.0.2
environment:
POSTGRES_DB: docmost
POSTGRES_USER: docmost
POSTGRES_PASSWORD: STRONG_DB_PASSWORD
restart: unless-stopped
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./data/db_data:/var/lib/postgresql
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
build: ./custom-images/redis
image: ghcr.io/victorphan03/redis:v1.0.2
command: ["redis-server", "--appendonly", "yes", "--maxmemory-policy", "noeviction"]
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
volumes:
docmost_data:
postgres_data:
redis_data:
- ./data/redis_data:/data