notes: AI titles for new notes, personal-only access, modal polish
- new note created without a title gets one generated by a background worker (createNoteTitleWorker, ai_status column, wake channel, notes_changed SSE event, settings toggle notes_ai_enabled) - notes are strictly personal: list/update/delete/reorder always scoped to req.user.id, admin no longer sees other users' notes (403) - notes modal: focus goes to the text body, random color for new notes, ctrl+enter hint, tags hint styling, empty-title 400 fix (optText) - backup/restore: user_notes.ai_status normalized and restored
This commit is contained in:
@@ -232,9 +232,11 @@ CREATE TABLE IF NOT EXISTS user_notes (
|
||||
tags TEXT NOT NULL DEFAULT '',
|
||||
color VARCHAR(7) NOT NULL DEFAULT '#2563eb',
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
ai_status VARCHAR(20) NOT NULL DEFAULT 'none',
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ DEFAULT now()
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_notes_pending ON user_notes(ai_status, id) WHERE ai_status = 'pending';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
@@ -432,6 +434,8 @@ ON CONFLICT (key) DO NOTHING;
|
||||
|
||||
INSERT INTO settings (key, value) VALUES ('lesson_ai_enabled', 'true')
|
||||
ON CONFLICT (key) DO NOTHING;
|
||||
INSERT INTO settings (key, value) VALUES ('notes_ai_enabled', 'true')
|
||||
ON CONFLICT (key) DO NOTHING;
|
||||
INSERT INTO settings (key, value) VALUES ('lesson_ai_prompt', 'Ты — редактор сообщений тьютора детской IT-школы.
|
||||
|
||||
Переработай исходный текст занятия так, чтобы он звучал естественно и грамотно, как будто его написал живой тьютор родителю, а не нейросеть.
|
||||
|
||||
Reference in New Issue
Block a user