Files
TaxHacker_s23/forms/settings.ts
Dmitrii Anfimov dee915ffd6 feat: more llm provider options (google, mistral) (#28)
* feat: add google provider

* fix: default for google model

* feat: multiple providers

* fix: defaults from env for login form

* fix: add mistral to env files

* chore: delete unused code

* chore: revert database url to original

* fix: render default value for api key from env on server

* fix: type errors during compilation

---------

Co-authored-by: Vasily Zubarev <me@vas3k.ru>
2025-07-22 21:49:54 +02:00

45 lines
1.6 KiB
TypeScript

import { randomHexColor } from "@/lib/utils"
import { z } from "zod"
export const settingsFormSchema = z.object({
default_currency: z.string().max(5).optional(),
default_type: z.string().optional(),
default_category: z.string().optional(),
default_project: z.string().optional(),
openai_api_key: z.string().optional(),
openai_model_name: z.string().default('gpt-4o-mini'),
google_api_key: z.string().optional(),
google_model_name: z.string().default("gemini-2.5-flash"),
mistral_api_key: z.string().optional(),
mistral_model_name: z.string().default("mistral-medium-latest"),
llm_providers: z.string().default('openai,google,mistral'),
prompt_analyse_new_file: z.string().optional(),
is_welcome_message_hidden: z.string().optional(),
})
export const currencyFormSchema = z.object({
code: z.string().max(5),
name: z.string().max(32),
})
export const projectFormSchema = z.object({
name: z.string().max(128),
llm_prompt: z.string().max(512).nullable().optional(),
color: z.string().max(7).default(randomHexColor()).nullable().optional(),
})
export const categoryFormSchema = z.object({
name: z.string().max(128),
llm_prompt: z.string().max(512).nullable().optional(),
color: z.string().max(7).default(randomHexColor()).nullable().optional(),
})
export const fieldFormSchema = z.object({
name: z.string().max(128),
type: z.string().max(128).default("string"),
llm_prompt: z.string().max(512).nullable().optional(),
isVisibleInList: z.boolean().optional(),
isVisibleInAnalysis: z.boolean().optional(),
isRequired: z.boolean().optional(),
})