@@ -206,6 +206,39 @@ export const providerSpeakerIndexSchema = z.object({
206206 channel : z . number ( ) . optional ( ) ,
207207} ) ;
208208
209+ export const generalSchema = z . object ( {
210+ user_id : z . string ( ) ,
211+ autostart : z . boolean ( ) . default ( false ) ,
212+ telemetry_consent : z . boolean ( ) . default ( true ) ,
213+ save_recordings : z . boolean ( ) . default ( true ) ,
214+ notification_event : z . boolean ( ) . default ( true ) ,
215+ notification_detect : z . boolean ( ) . default ( true ) ,
216+ respect_dnd : z . boolean ( ) . default ( false ) ,
217+ quit_intercept : z . boolean ( ) . default ( false ) ,
218+ ai_language : z . string ( ) . default ( "en" ) ,
219+ spoken_languages : jsonObject ( z . array ( z . string ( ) ) . default ( [ "en" ] ) ) ,
220+ ignored_platforms : jsonObject ( z . array ( z . string ( ) ) . default ( [ ] ) ) ,
221+ ignored_recurring_series : jsonObject ( z . array ( z . string ( ) ) . default ( [ ] ) ) ,
222+ current_llm_provider : z . string ( ) . optional ( ) ,
223+ current_llm_model : z . string ( ) . optional ( ) ,
224+ current_stt_provider : z . string ( ) . optional ( ) ,
225+ current_stt_model : z . string ( ) . optional ( ) ,
226+ } ) ;
227+
228+ export const aiProviderSchema = z
229+ . object ( {
230+ type : z . enum ( [ "stt" , "llm" ] ) ,
231+ base_url : z . url ( ) . min ( 1 ) ,
232+ api_key : z . string ( ) ,
233+ } )
234+ . refine (
235+ ( data ) => ! data . base_url . startsWith ( "https:" ) || data . api_key . length > 0 ,
236+ {
237+ message : "API key is required for HTTPS URLs" ,
238+ path : [ "api_key" ] ,
239+ } ,
240+ ) ;
241+
209242export type ProviderSpeakerIndexHint = z . infer <
210243 typeof providerSpeakerIndexSchema
211244> ;
@@ -233,6 +266,8 @@ export type Memory = z.infer<typeof memorySchema>;
233266export type ChatShortcut = z . infer < typeof chatShortcutSchema > ;
234267export type EnhancedNote = z . infer < typeof enhancedNoteSchema > ;
235268export type Prompt = z . infer < typeof promptSchema > ;
269+ export type AIProvider = z . infer < typeof aiProviderSchema > ;
270+ export type General = z . infer < typeof generalSchema > ;
236271
237272export type SessionStorage = ToStorageType < typeof sessionSchema > ;
238273export type TranscriptStorage = ToStorageType < typeof transcriptSchema > ;
@@ -251,8 +286,10 @@ export type EventStorage = ToStorageType<typeof eventSchema>;
251286export type MappingSessionParticipantStorage = ToStorageType <
252287 typeof mappingSessionParticipantSchema
253288> ;
289+ export type AIProviderStorage = ToStorageType < typeof aiProviderSchema > ;
290+ export type GeneralStorage = ToStorageType < typeof generalSchema > ;
254291
255- export const externalTableSchemaForTinybase = {
292+ export const tableSchemaForTinybase = {
256293 folders : {
257294 user_id : { type : "string" } ,
258295 created_at : { type : "string" } ,
@@ -402,4 +439,32 @@ export const externalTableSchemaForTinybase = {
402439 title : { type : "string" } ,
403440 content : { type : "string" } ,
404441 } as const satisfies InferTinyBaseSchema < typeof chatShortcutSchema > ,
442+ ai_providers : {
443+ type : { type : "string" } ,
444+ base_url : { type : "string" } ,
445+ api_key : { type : "string" } ,
446+ } as const satisfies InferTinyBaseSchema < typeof aiProviderSchema > ,
447+ extension_state : {
448+ counter : { type : "number" } ,
449+ last_updated : { type : "string" } ,
450+ } as const ,
405451} as const satisfies TablesSchema ;
452+
453+ export const valueSchemaForTinybase = {
454+ user_id : { type : "string" } ,
455+ autostart : { type : "boolean" } ,
456+ save_recordings : { type : "boolean" } ,
457+ notification_event : { type : "boolean" } ,
458+ notification_detect : { type : "boolean" } ,
459+ respect_dnd : { type : "boolean" } ,
460+ quit_intercept : { type : "boolean" } ,
461+ telemetry_consent : { type : "boolean" } ,
462+ ai_language : { type : "string" } ,
463+ spoken_languages : { type : "string" } ,
464+ ignored_platforms : { type : "string" } ,
465+ ignored_recurring_series : { type : "string" } ,
466+ current_llm_provider : { type : "string" } ,
467+ current_llm_model : { type : "string" } ,
468+ current_stt_provider : { type : "string" } ,
469+ current_stt_model : { type : "string" } ,
470+ } as const satisfies InferTinyBaseSchema < typeof generalSchema > ;
0 commit comments