Add QuillSense support with settings and integration

- Introduced new "QuillSense" feature for AI-assisted book creation.
- Added QuillSense settings panel with advanced options and disable/enable functionality.
- Updated GhostWriter and TextEditor components to respect QuillSense settings.
- Extended models and repositories to track and manage QuillSense state per book.
- Localized new strings for English and French.
This commit is contained in:
natreex
2026-01-13 19:52:31 -05:00
parent 8bad6159cf
commit 306262caba
12 changed files with 106 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
import { Database, QueryResult, RunResult, SQLiteValue } from "node-sqlite3-wasm";
import {Database, QueryResult, RunResult, SQLiteValue} from "node-sqlite3-wasm";
import System from "../System.js";
export interface ChapterContentQueryResult extends Record<string, SQLiteValue> {
@@ -244,8 +244,7 @@ export default class ChapterContentRepository {
const db: Database = System.getDb();
const query: string = 'SELECT content_id, chapter_id, author_id, version, content, words_count, time_on_it, last_update FROM book_chapter_content WHERE author_id=? AND chapter_id=?';
const params: SQLiteValue[] = [userId, chapterId];
const bookChapterContents: BookChapterContentTable[] = db.all(query, params) as BookChapterContentTable[];
return bookChapterContents;
return db.all(query, params) as BookChapterContentTable[];
} catch (error: unknown) {
if (error instanceof Error) {
console.error(`DB Error: ${error.message}`);
@@ -267,8 +266,7 @@ export default class ChapterContentRepository {
const db: Database = System.getDb();
const query: string = 'SELECT content_id, chapter_id, last_update FROM book_chapter_content WHERE author_id = ?';
const params: SQLiteValue[] = [userId];
const syncedChapterContents: SyncedChapterContentResult[] = db.all(query, params) as SyncedChapterContentResult[];
return syncedChapterContents;
return db.all(query, params) as SyncedChapterContentResult[];
} catch (error: unknown) {
if (error instanceof Error) {
console.error(`DB Error: ${error.message}`);
@@ -296,10 +294,7 @@ export default class ChapterContentRepository {
static insertSyncChapterContent(contentId: string, chapterId: string, authorId: string, version: number, content: string | null, wordsCount: number, timeOnIt: number, lastUpdate: number, lang: 'fr' | 'en'): boolean {
try {
const db: Database = System.getDb();
const query: string = `
INSERT INTO book_chapter_content (content_id, chapter_id, author_id, version, content, words_count, time_on_it, last_update)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`;
const query: string = `INSERT INTO book_chapter_content (content_id, chapter_id, author_id, version, content, words_count, time_on_it, last_update) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`;
const params: SQLiteValue[] = [contentId, chapterId, authorId, version, content, wordsCount, timeOnIt, lastUpdate];
const insertResult: RunResult = db.run(query, params);
return insertResult.changes > 0;
@@ -324,8 +319,7 @@ export default class ChapterContentRepository {
const db: Database = System.getDb();
const query: string = 'SELECT content_id, chapter_id, author_id, version, content, words_count, time_on_it, last_update FROM book_chapter_content WHERE content_id = ?';
const params: SQLiteValue[] = [contentId];
const completeChapterContent: BookChapterContentTable[] = db.all(query, params) as BookChapterContentTable[];
return completeChapterContent;
return db.all(query, params) as BookChapterContentTable[];
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(lang === 'fr' ? `Impossible de récupérer le contenu de chapitre complet.` : `Unable to retrieve complete chapter content.`);