mirror of
https://github.com/vas3k/TaxHacker.git
synced 2026-07-03 19:19:35 +08:00
Support Ollama, LM Studio, vLLM, and any OpenAI-compatible API via a configurable base URL. Reuses ChatOpenAI with custom baseURL, no new dependencies. Local models use direct JSON parsing instead of withStructuredOutput since many don't support function calling. Co-authored-by: FasterOP <7832832+mmplisskin@useres.noreply.github.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 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"),
|
|
openai_compatible_api_key: z.string().optional(),
|
|
openai_compatible_model_name: z.string().optional(),
|
|
openai_compatible_base_url: z.string().optional(),
|
|
llm_providers: z.string().default('openai,google,mistral,openai_compatible'),
|
|
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(),
|
|
})
|