diff --git a/server.js b/server.js
index b57e015..d64b4ad 100644
--- a/server.js
+++ b/server.js
@@ -6,7 +6,7 @@ const { ipKeyGenerator } = require('express-rate-limit');
const helmet = require('helmet');
const bcrypt = require('bcrypt');
const heicConvert = require('heic-convert');
-const { createEntryAutoChecker, createPhotoEnhanceWorker, createLessonReportChecker, createFeedbackWriter } = require('./worker');
+const { createEntryAutoChecker, createPhotoEnhanceWorker, createLessonReportChecker, createFeedbackWriter, createNoteTitleWorker } = require('./worker');
const { createZipWriter, renderStudentReport } = require('./student-report');
const { createStorage, mimeFor } = require('./storage');
@@ -24,6 +24,7 @@ const {
optInt,
reqStr,
optStr,
+ optText,
optTs,
reqTs,
optDate,
@@ -134,6 +135,7 @@ const AI_WAKE_CHANNEL = 'whatido:wake:ai';
const PHOTO_WAKE_CHANNEL = 'whatido:wake:photo';
const LESSON_AI_WAKE_CHANNEL = 'whatido:wake:lesson-ai';
const FEEDBACK_WAKE_CHANNEL = 'whatido:wake:feedback';
+const NOTE_AI_WAKE_CHANNEL = 'whatido:wake:note-ai';
function createWorkerBus(channel) {
return {
@@ -172,7 +174,7 @@ function dispatchEvent(payload) {
writeFrame('feedback_status', payload);
return;
}
- if (payload && (payload.type === 'entries_changed' || payload.type === 'lessons_changed' || payload.type === 'shorts_changed')) {
+ if (payload && (payload.type === 'entries_changed' || payload.type === 'lessons_changed' || payload.type === 'shorts_changed' || payload.type === 'notes_changed')) {
writeFrame(payload.type, { ts: Date.now() });
return;
}
@@ -206,6 +208,11 @@ function broadcastFeedbackChanged() {
.catch(err => console.error('Publish failed:', err.message));
}
+function broadcastNotesChanged() {
+ cache.publish(EVENTS_CHANNEL, { type: 'notes_changed' })
+ .catch(err => console.error('Publish failed:', err.message));
+}
+
function broadcastAiStatus(payload) {
cache.publish(EVENTS_CHANNEL, { type: 'ai_status', ...payload })
.catch(err => console.error('Publish failed:', err.message));
@@ -1747,11 +1754,15 @@ async function ensureUserNotesTable() {
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()
)`);
await pool.query('ALTER TABLE user_notes ADD COLUMN IF NOT EXISTS sort_order INT NOT NULL DEFAULT 0');
+ await pool.query("ALTER TABLE user_notes ADD COLUMN IF NOT EXISTS ai_status VARCHAR(20) NOT NULL DEFAULT 'none'");
await pool.query('CREATE INDEX IF NOT EXISTS idx_user_notes_user_id ON user_notes(user_id)');
+ await pool.query(`CREATE INDEX IF NOT EXISTS idx_user_notes_pending ON user_notes(ai_status, id) WHERE ai_status = 'pending'`);
+ await pool.query("INSERT INTO settings (key, value) VALUES ('notes_ai_enabled', 'true') ON CONFLICT (key) DO NOTHING");
}
async function ensureApiKeysTable() {
@@ -3288,15 +3299,22 @@ app.put('/api/users/:id', requireAuth, requireAdmin, async (req, res) => {
const NOTE_TITLE_MAX = 200;
const NOTE_TEXT_MAX = 100000;
const NOTE_TAGS_MAX = 10;
+const NOTES_AI_DEFAULT_PROMPT = 'Ты придумываешь короткий заголовок для личной заметки пользователя. Тебе дадут текст заметки и, возможно, теги.\n' +
+ 'Требования к заголовку:\n' +
+ '- 2–6 слов, максимум 60 символов\n' +
+ '- отражает суть заметки, без воды и общих слов\n' +
+ '- пишется с большой буквы, без кавычек, без точки в конце\n' +
+ '- язык заголовка совпадает с языком заметки\n' +
+ 'Верни только сам заголовок, ничего больше.';
async function findNote(user, id) {
const { rows } = await pool.query(
- `SELECT id, user_id, title, note, tags, color, created_at, updated_at
+ `SELECT id, user_id, title, note, tags, color, ai_status, created_at, updated_at
FROM user_notes WHERE id = $1`, [id]
);
const note = rows[0];
if (!note) return null;
- if (user.role !== 'admin' && note.user_id !== user.id) {
+ if (note.user_id !== user.id) {
const e = new Error('Forbidden');
e.forbidden = true;
throw e;
@@ -3306,14 +3324,12 @@ async function findNote(user, id) {
app.get('/api/notes', requireAuth, async (req, res) => {
try {
- const where = req.user.role === 'admin' ? '' : 'user_id = $1';
- const params = req.user.role === 'admin' ? [] : [req.user.id];
const { rows } = await pool.query(
- `SELECT id, user_id, title, note, tags, color, sort_order, created_at, updated_at
+ `SELECT id, user_id, title, note, tags, color, sort_order, ai_status, created_at, updated_at
FROM user_notes
- ${where ? `WHERE ${where}` : ''}
+ WHERE user_id = $1
ORDER BY sort_order ASC, updated_at DESC`,
- params
+ [req.user.id]
);
res.json({ items: rows });
} catch (e) {
@@ -3324,8 +3340,9 @@ app.get('/api/notes', requireAuth, async (req, res) => {
app.post('/api/notes', requireAuth, async (req, res) => {
try {
- const title = optStr(req.body?.title, NOTE_TITLE_MAX) || '';
- const note = optStr(req.body?.note, NOTE_TEXT_MAX) || '';
+ const title = optText(req.body?.title, NOTE_TITLE_MAX);
+ const note = optText(req.body?.note, NOTE_TEXT_MAX);
+ if (!title && !note) return res.status(400).json({ error: 'Заполните текст заметки' });
let tags = '';
if (req.body?.tags !== undefined && req.body.tags !== null) {
const list = String(req.body.tags).split(',').map(t => t.trim()).filter(Boolean);
@@ -3333,13 +3350,15 @@ app.post('/api/notes', requireAuth, async (req, res) => {
}
let color = String(req.body?.color || '#2563eb').trim();
if (!/^#[0-9a-fA-F]{6}$/.test(color)) color = '#2563eb';
+ const aiWanted = !title && (await getSetting('notes_ai_enabled', 'true')) !== 'false';
const { rows } = await pool.query(
- `INSERT INTO user_notes (user_id, title, note, tags, color, sort_order)
+ `INSERT INTO user_notes (user_id, title, note, tags, color, sort_order, ai_status)
VALUES ($1, $2, $3, $4, $5,
- COALESCE((SELECT MIN(sort_order) FROM user_notes WHERE user_id = $1), 1) - 1)
- RETURNING id, user_id, title, note, tags, color, sort_order, created_at, updated_at`,
- [req.user.id, title, note, tags, color]
+ COALESCE((SELECT MIN(sort_order) FROM user_notes WHERE user_id = $1), 1) - 1, $6)
+ RETURNING id, user_id, title, note, tags, color, sort_order, ai_status, created_at, updated_at`,
+ [req.user.id, title, note, tags, color, aiWanted ? 'pending' : 'none']
);
+ if (aiWanted) wakeNoteAiWorker();
res.json({ item: rows[0] });
} catch (e) {
if (e.message === 'Invalid string length') return res.status(400).json({ error: 'Неверная длина поля' });
@@ -3363,9 +3382,10 @@ app.put('/api/notes/reorder', requireAuth, async (req, res) => {
try {
await client.query('BEGIN');
for (let i = 0; i < ids.length; i++) {
- const { rowCount } = req.user.role === 'admin'
- ? await client.query('UPDATE user_notes SET sort_order = $1 WHERE id = $2', [i + 1, ids[i]])
- : await client.query('UPDATE user_notes SET sort_order = $1 WHERE id = $2 AND user_id = $3', [i + 1, ids[i], req.user.id]);
+ const { rowCount } = await client.query(
+ 'UPDATE user_notes SET sort_order = $1 WHERE id = $2 AND user_id = $3',
+ [i + 1, ids[i], req.user.id]
+ );
if (!rowCount) throw { http: 404, message: 'Заметка не найдена' };
}
await client.query('COMMIT');
@@ -3391,8 +3411,9 @@ app.put('/api/notes/:id', requireAuth, async (req, res) => {
const note = await findNote(req.user, id);
if (!note) return res.status(404).json({ error: 'Not found' });
if (note.forbidden) return res.status(403).json({ error: 'Нет доступа' });
- const title = optStr(req.body?.title, NOTE_TITLE_MAX) || '';
- const text = optStr(req.body?.note, NOTE_TEXT_MAX) || '';
+ const title = optText(req.body?.title, NOTE_TITLE_MAX);
+ const text = optText(req.body?.note, NOTE_TEXT_MAX);
+ if (!title && !text) return res.status(400).json({ error: 'Заполните текст заметки' });
let tags = '';
if (req.body?.tags !== undefined && req.body.tags !== null) {
const list = String(req.body.tags).split(',').map(t => t.trim()).filter(Boolean);
@@ -3400,12 +3421,14 @@ app.put('/api/notes/:id', requireAuth, async (req, res) => {
}
let color = String(req.body?.color || note.color).trim();
if (!/^#[0-9a-fA-F]{6}$/.test(color)) color = note.color;
+ const aiWanted = !title && (await getSetting('notes_ai_enabled', 'true')) !== 'false';
const { rows } = await pool.query(
- `UPDATE user_notes SET title=$1, note=$2, tags=$3, color=$4, updated_at=now()
- WHERE id=$5
- RETURNING id, user_id, title, note, tags, color, created_at, updated_at`,
- [title, text, tags, color, id]
+ `UPDATE user_notes SET title=$1, note=$2, tags=$3, color=$4, ai_status=$6, updated_at=now()
+ WHERE id=$5 AND user_id=$7
+ RETURNING id, user_id, title, note, tags, color, ai_status, created_at, updated_at`,
+ [title, text, tags, color, id, title ? 'none' : (aiWanted ? 'pending' : 'none'), req.user.id]
);
+ if (aiWanted) wakeNoteAiWorker();
res.json({ item: rows[0] });
} catch (e) {
if (e.message === 'Invalid string length') return res.status(400).json({ error: 'Неверная длина поля' });
@@ -3422,10 +3445,11 @@ app.delete('/api/notes/:id', requireAuth, async (req, res) => {
const note = await findNote(req.user, id);
if (!note) return res.status(404).json({ error: 'Not found' });
if (note.forbidden) return res.status(403).json({ error: 'Нет доступа' });
- await pool.query('DELETE FROM user_notes WHERE id = $1', [id]);
+ await pool.query('DELETE FROM user_notes WHERE id = $1 AND user_id = $2', [id, req.user.id]);
await logAudit(req, 'note.delete', { id });
res.json({ ok: true });
} catch (e) {
+ if (e.forbidden) return res.status(403).json({ error: 'Нет доступа' });
console.error('notes delete:', e);
res.status(500).json({ error: 'Не удалось удалить заметку' });
}
@@ -3859,6 +3883,9 @@ app.put('/api/settings', requireAdmin, async (req, res) => {
if (key === 'lesson_ai_enabled' && !['true', 'false'].includes(String(value))) {
return res.status(400).json({ error: 'lesson_ai_enabled должен быть true или false' });
}
+ if (key === 'notes_ai_enabled' && !['true', 'false'].includes(String(value))) {
+ return res.status(400).json({ error: 'notes_ai_enabled должен быть true или false' });
+ }
if (key === 'lesson_ai_prompt' && String(value).length > 8000) {
return res.status(400).json({ error: 'lesson_ai_prompt длиннее 8000 символов' });
}
@@ -4143,6 +4170,7 @@ let entryAutoChecker = null;
let photoWorker = null;
let lessonAiChecker = null;
let feedbackWorker = null;
+let noteAiWorker = null;
function wakeLessonAiWorker() {
if (lessonAiChecker) lessonAiChecker.notify();
@@ -4152,6 +4180,24 @@ function wakeFeedbackWorker() {
if (feedbackWorker) feedbackWorker.notify();
}
+function wakeNoteAiWorker() {
+ if (noteAiWorker) noteAiWorker.notify();
+}
+
+async function onNoteAiDone({ row, status, title, error }) {
+ try {
+ broadcastNotesChanged();
+ if (!logAudit) return;
+ if (status === 'done') {
+ await logAudit(null, 'note.ai.title', { id: row.id, title: String(title || '').slice(0, 200) });
+ } else if (status === 'error') {
+ await logAudit(null, 'note.ai.error', { id: row.id, error: String(error || '').slice(0, 500) });
+ }
+ } catch (e) {
+ console.error('Note AI onDone error:', e.message);
+ }
+}
+
async function onLessonAiDone({ row, status, text, aiText, error }) {
invalidateLessonReports();
cache.publish(EVENTS_CHANNEL, {
@@ -4603,8 +4649,8 @@ app.post('/api/restore', requireAdmin, uploadBackup.single('backup'), async (req
const okUser = (await client.query('SELECT 1 FROM users WHERE id = $1', [x.user_id])).rowCount;
if (!okUser) continue;
await client.query(
- 'INSERT INTO user_notes (id, user_id, title, note, tags, color, sort_order, created_at, updated_at) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)',
- [x.id, x.user_id, x.title, x.note, x.tags, x.color, x.sort_order, x.created_at || null, x.updated_at || null]
+ 'INSERT INTO user_notes (id, user_id, title, note, tags, color, sort_order, ai_status, created_at, updated_at) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)',
+ [x.id, x.user_id, x.title, x.note, x.tags, x.color, x.sort_order, x.ai_status || 'none', x.created_at || null, x.updated_at || null]
);
}
for (const x of ndata.user_branches) {
@@ -9853,4 +9899,15 @@ try { await ensureFeedbacksTable(); } catch (err) { console.error('Feedbacks tab
});
feedbackWorker.start();
console.log('Feedback AI worker started');
+ noteAiWorker = createNoteTitleWorker({
+ pool,
+ getSetting,
+ logAudit,
+ aiUrl: AI_URL,
+ defaultPrompt: NOTES_AI_DEFAULT_PROMPT,
+ bus: createWorkerBus(NOTE_AI_WAKE_CHANNEL),
+ onDone: onNoteAiDone,
+ });
+ noteAiWorker.start();
+ console.log('Note title AI worker started');
})();
diff --git a/worker.js b/worker.js
index 7fa9b70..e79c535 100644
--- a/worker.js
+++ b/worker.js
@@ -1449,4 +1449,263 @@ function createFeedbackWriter(opts) {
return { start, stop, notify, getInfo };
}
-module.exports = { createEntryAutoChecker, createPhotoEnhanceWorker, createLessonReportChecker, createFeedbackWriter, lessonTopicPosition };
+function createNoteTitleWorker({ pool, getSetting, logAudit, aiUrl, model, defaultPrompt, bus, onDone }) {
+ const AI_URL = aiUrl || process.env.AI_URL || 'http://text-corrector:8080';
+ const MODEL = model || process.env.AI_MODEL || 'qwen2.5-1.5b-instruct-q4_k_m.gguf';
+ const DEFAULT_PROMPT = defaultPrompt || '';
+ const TIMEOUT_MS = Math.max(5000, parseInt(process.env.NOTE_AI_TIMEOUT_MS || '60000', 10) || 60000);
+ const MIN_CHARS = 10;
+ const MAX_INPUT_CHARS = 2000;
+ const TITLE_MAX = 100;
+ const MAX_ATTEMPTS = 3;
+
+ let started = false;
+ let stopped = false;
+ let idleMs = IDLE_MIN_MS;
+ let wake = null;
+ let processing = false;
+ let currentId = null;
+ let startedAt = null;
+ const stats = { checks: 0, generated: 0, skipped: 0, errors: 0, last_at: null, last_error: null };
+ const attempts = new Map();
+
+ function sleep(ms) {
+ return new Promise((resolve) => {
+ const t = setTimeout(() => { wake = null; resolve(); }, ms);
+ wake = () => { clearTimeout(t); wake = null; resolve(); };
+ });
+ }
+
+ function notify() {
+ if (wake) wake();
+ if (bus) bus.publish();
+ }
+
+ if (bus) bus.subscribe(() => notify());
+
+ async function isEnabled() {
+ return String(await getSetting('notes_ai_enabled', 'true')) !== 'false';
+ }
+
+ async function claimNext() {
+ const client = await pool.connect();
+ try {
+ await client.query('BEGIN');
+ const { rows } = await client.query(
+ `SELECT id, user_id, note, tags
+ FROM user_notes
+ WHERE ai_status = 'pending' AND title = ''
+ ORDER BY id ASC LIMIT 1 FOR UPDATE SKIP LOCKED`
+ );
+ if (!rows.length) {
+ await client.query('COMMIT');
+ return null;
+ }
+ await client.query(`UPDATE user_notes SET ai_status = 'processing' WHERE id = $1`, [rows[0].id]);
+ await client.query('COMMIT');
+ return rows[0];
+ } catch (e) {
+ await client.query('ROLLBACK').catch(() => {});
+ throw e;
+ } finally {
+ client.release();
+ }
+ }
+
+ async function resolveActiveProfile() {
+ try {
+ const active = await getSetting('ai_active_profile', 'native');
+ if (active && active !== 'native') {
+ const raw = await getSetting('ai_profiles', '[]');
+ const list = JSON.parse(raw || '[]');
+ if (Array.isArray(list)) {
+ return list.find(p => p && p.id === active && p.base_url && p.model) || null;
+ }
+ }
+ } catch (e) {}
+ return null;
+ }
+
+ function normalizeOpenAiBase(base) {
+ const b = String(base || '').trim().replace(/\/+$/, '');
+ if (!/^https?:\/\//i.test(b)) return null;
+ if (!/\/v1$/i.test(b)) return b + '/v1';
+ return b;
+ }
+
+ async function callModel(userText, systemPrompt) {
+ const profile = await resolveActiveProfile();
+ const headers = { 'Content-Type': 'application/json' };
+ let url;
+ let modelName;
+ let maxTokens;
+ if (profile) {
+ const base = normalizeOpenAiBase(profile.base_url);
+ if (!base) throw new Error('Некорректный base_url профиля ИИ');
+ url = `${base}/chat/completions`;
+ modelName = profile.model;
+ if (profile.api_key) headers.Authorization = `Bearer ${profile.api_key}`;
+ maxTokens = parseInt(profile.max_tokens, 10) || Math.min(4096, Math.max(1024, userText.length * 2 + 512));
+ } else {
+ url = `${AI_URL.replace(/\/+$/, '')}/v1/chat/completions`;
+ modelName = MODEL;
+ maxTokens = Math.min(512, Math.max(128, userText.length + 256));
+ }
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
+ try {
+ const res = await fetch(url, {
+ method: 'POST',
+ headers,
+ signal: controller.signal,
+ body: JSON.stringify({
+ model: modelName,
+ messages: [
+ { role: 'system', content: systemPrompt },
+ { role: 'user', content: userText },
+ ],
+ temperature: 0.2,
+ max_tokens: maxTokens,
+ }),
+ });
+ if (!res.ok) throw new Error(`AI service error: ${res.status}`);
+ const data = await res.json();
+ const choice = data.choices && data.choices[0];
+ return (choice && choice.message && choice.message.content || '').trim();
+ } finally {
+ clearTimeout(timer);
+ }
+ }
+
+ function normalizeTitle(out) {
+ let s = String(out || '').trim();
+ if (!s) return '';
+ s = s.replace(/^```[a-zA-Z]*\s*/, '').replace(/```$/, '').trim();
+ s = s.split(/\r?\n/).map(l => l.trim()).filter(Boolean)[0] || '';
+ s = s.replace(/^(?:заголовок|title)\s*[:—-]\s*/i, '').trim();
+ s = s.replace(/^["'«”]+/, '').replace(/["'«»"]+$/, '').trim();
+ if (s.length > TITLE_MAX) s = s.slice(0, TITLE_MAX).trim();
+ return s;
+ }
+
+ async function finish(row, status, title, error) {
+ await pool.query(
+ `UPDATE user_notes SET
+ title = CASE WHEN $1 <> '' THEN $1 ELSE title END,
+ ai_status = $2, updated_at = now()
+ WHERE id = $3 AND ai_status = 'processing'`,
+ [title || '', status, row.id]
+ );
+ attempts.delete(row.id);
+ stats.last_at = new Date().toISOString();
+ stats.last_error = error || null;
+ if (onDone) await onDone({ row, status, title: title || '', error: error || null });
+ }
+
+ async function processOne(row) {
+ const text = String(row.note || '').trim();
+ if (text.length < MIN_CHARS) {
+ await finish(row, 'skipped', '', null);
+ stats.skipped++;
+ return true;
+ }
+ const prompt = DEFAULT_PROMPT;
+ const tags = String(row.tags || '').trim();
+ const input = text.length > MAX_INPUT_CHARS ? text.slice(0, MAX_INPUT_CHARS) : text;
+ const context = [tags ? `Теги: ${tags}` : '', 'Текст заметки:', input].filter(l => l !== '').join('\n');
+ try {
+ const title = normalizeTitle(await callModel(context, prompt));
+ if (!title) {
+ const reason = 'Модель вернула пустой ответ';
+ await finish(row, 'error', '', reason);
+ stats.errors++;
+ return true;
+ }
+ await finish(row, 'done', title, null);
+ stats.checks++;
+ stats.generated++;
+ return true;
+ } catch (e) {
+ const message = (e && e.message ? e.message : 'error').slice(0, 500);
+ const tries = (attempts.get(row.id) || 0) + 1;
+ if (tries < MAX_ATTEMPTS) {
+ attempts.set(row.id, tries);
+ await pool.query(`UPDATE user_notes SET ai_status = 'pending' WHERE id = $1`, [row.id]);
+ if (logAudit) await logAudit(null, 'note.ai.retry', { id: row.id, attempt: tries, error: message });
+ return false;
+ }
+ await finish(row, 'error', '', message);
+ stats.errors++;
+ if (logAudit) await logAudit(null, 'note.ai.error', { id: row.id, error: message });
+ return true;
+ }
+ }
+
+ async function loop() {
+ while (!stopped) {
+ let row = null;
+ try {
+ if (!(await isEnabled())) {
+ await sleep(IDLE_MAX_MS);
+ continue;
+ }
+ row = await claimNext();
+ } catch (e) {
+ console.error('Note title AI claim error:', e.message);
+ await sleep(IDLE_MAX_MS);
+ continue;
+ }
+ if (!row) {
+ await sleep(idleMs);
+ idleMs = Math.min(idleMs * 2, IDLE_MAX_MS);
+ continue;
+ }
+ idleMs = IDLE_MIN_MS;
+ processing = true;
+ currentId = row.id;
+ let ok = true;
+ try {
+ ok = await processOne(row);
+ } catch (e) {
+ console.error('Note title AI process error:', e.message);
+ } finally {
+ processing = false;
+ currentId = null;
+ }
+ if (!ok) await sleep(IDLE_MAX_MS);
+ }
+ }
+
+ function resetStale() {
+ return pool.query(`UPDATE user_notes SET ai_status = 'pending' WHERE ai_status = 'processing'`);
+ }
+
+ function start() {
+ if (started) return;
+ started = true;
+ startedAt = Date.now();
+ resetStale()
+ .catch((e) => console.error('Note title AI reset error:', e.message))
+ .finally(() => { loop().catch((e) => console.error('Note title AI loop error:', e.message)); });
+ }
+
+ function stop() {
+ stopped = true;
+ notify();
+ }
+
+ function getInfo() {
+ return {
+ started_at: startedAt ? new Date(startedAt).toISOString() : null,
+ uptime_ms: startedAt ? Date.now() - startedAt : 0,
+ processing,
+ current_id: currentId,
+ config: { idle_min_ms: IDLE_MIN_MS, idle_max_ms: IDLE_MAX_MS, timeout_ms: TIMEOUT_MS, model: MODEL, ai_url: AI_URL },
+ ...stats,
+ };
+ }
+
+ return { start, stop, notify, getInfo };
+}
+
+module.exports = { createEntryAutoChecker, createPhotoEnhanceWorker, createLessonReportChecker, createFeedbackWriter, createNoteTitleWorker, lessonTopicPosition };