- translateText/translateTexts call OpenRouter chat-completions; glossary terms are prompt-injected from config/glossaries.ts, generated from the translation repo's TSVs by scripts/build-glossaries.ts - model resolution: per-language override in config/languages.ts → translation.model site setting (new admin field) → TRANSLATION_MODEL env → anthropic/claude-opus-5, at low reasoning effort - blank fragments are held back from the model, which drops them and breaks the one-translation-per-fragment count the caller maps results back on - OpenRouter failures map to a typed error with a human-readable message; an unrecoverable one (no credits, bad key, rejected model) stops the run instead of repeating the same call for every remaining locale - machine translations record source 'auto-translate'; 'deepl' stays readable for snapshots written before the switch
122 lines
3.7 KiB
TypeScript
122 lines
3.7 KiB
TypeScript
import type { ColumnType, Generated } from 'kysely'
|
|
|
|
export interface UsersTable {
|
|
id: Generated<string>
|
|
created: ColumnType<Date, string | undefined, string>
|
|
updated: ColumnType<Date, string | undefined, string>
|
|
email: string
|
|
display_name: string
|
|
avatar: Generated<string>
|
|
password: ColumnType<string | null, string | null | undefined, string | null>
|
|
verified: Generated<boolean>
|
|
roles: Generated<string[]>
|
|
token_key: Generated<string>
|
|
token_expires_at: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>
|
|
pending_email: string | null
|
|
email_change_token: string | null
|
|
}
|
|
|
|
export interface SiteSettingsTable {
|
|
key: string
|
|
value: ColumnType<unknown, unknown, unknown>
|
|
updated: ColumnType<Date, string | undefined, string>
|
|
}
|
|
|
|
export interface PasswordResetRequestsTable {
|
|
id: Generated<string>
|
|
created: ColumnType<Date, Date | string | undefined, Date | string>
|
|
expires: ColumnType<Date, Date | string, Date | string>
|
|
user_id: string
|
|
token: string
|
|
used: Generated<boolean>
|
|
}
|
|
|
|
export interface ActivityLogsTable {
|
|
id: Generated<string>
|
|
timestamp: ColumnType<Date, Date | string | undefined, Date | string>
|
|
event_type: string
|
|
table_name: string | null
|
|
record_id: string | null
|
|
user_id: string | null
|
|
user_agent: string | null
|
|
metadata: Generated<Record<string, any>>
|
|
}
|
|
|
|
export type PageTheme = 'default' | 'green'
|
|
|
|
export interface PagesTable {
|
|
id: Generated<string>
|
|
slug: string
|
|
category_id: string | null
|
|
menu_order: Generated<number>
|
|
custom_css: string | null
|
|
theme: Generated<PageTheme>
|
|
created: ColumnType<Date, Date | string | undefined, Date | string>
|
|
updated: ColumnType<Date, Date | string | undefined, Date | string>
|
|
}
|
|
|
|
export interface CategoriesTable {
|
|
id: Generated<string>
|
|
slug: string
|
|
parent_id: string | null
|
|
menu_order: Generated<number>
|
|
created: ColumnType<Date, Date | string | undefined, Date | string>
|
|
updated: ColumnType<Date, Date | string | undefined, Date | string>
|
|
}
|
|
|
|
export interface CategoryTranslationsTable {
|
|
id: Generated<string>
|
|
category_id: string
|
|
locale: string
|
|
name: string
|
|
updated: ColumnType<Date, Date | string | undefined, Date | string>
|
|
}
|
|
|
|
export interface PageTranslationsTable {
|
|
id: Generated<string>
|
|
page_id: string
|
|
locale: string
|
|
title: string
|
|
body_json: Generated<Record<string, any>>
|
|
excerpt: string | null
|
|
featured_image: string | null
|
|
meta_title: string | null
|
|
meta_description: string | null
|
|
og_image: string | null
|
|
status: Generated<'draft' | 'published'>
|
|
updated: ColumnType<Date, Date | string | undefined, Date | string>
|
|
}
|
|
|
|
// 'deepl' is retained for snapshots written by the previous translation
|
|
// provider; new machine translations are recorded as 'auto-translate'.
|
|
export type PageTranslationVersionSource = 'admin-ui' | 'mcp' | 'auto-translate' | 'deepl'
|
|
|
|
export interface PageTranslationVersionsTable {
|
|
id: Generated<string>
|
|
page_id: string
|
|
locale: string
|
|
title: string
|
|
body_json: Generated<Record<string, any>>
|
|
excerpt: string | null
|
|
featured_image: string | null
|
|
meta_title: string | null
|
|
meta_description: string | null
|
|
og_image: string | null
|
|
status: 'draft' | 'published'
|
|
created_by_user_id: string | null
|
|
source: Generated<PageTranslationVersionSource>
|
|
user_agent: string | null
|
|
created: ColumnType<Date, Date | string | undefined, Date | string>
|
|
}
|
|
|
|
export interface Database {
|
|
users: UsersTable
|
|
site_settings: SiteSettingsTable
|
|
password_reset_requests: PasswordResetRequestsTable
|
|
activity_logs: ActivityLogsTable
|
|
pages: PagesTable
|
|
page_translations: PageTranslationsTable
|
|
page_translation_versions: PageTranslationVersionsTable
|
|
categories: CategoriesTable
|
|
category_translations: CategoryTranslationsTable
|
|
}
|