mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
feat: filters, settings, backups fix: ts compile errors feat: new dashboard, webp previews and settings feat: use webp for pdfs feat: use webp fix: analyze resets old data fix: switch to corsproxy fix: switch to free cors fix: max upload limit fix: currency conversion feat: transaction export fix: currency conversion feat: refactor settings actions feat: new loader feat: README + LICENSE doc: update readme doc: update readme doc: update readme doc: update screenshots ci: bump prisma
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import { saveSettingsAction } from "@/app/settings/actions"
|
|
import { FormInput, FormTextarea } from "@/components/forms/simple"
|
|
import { Button } from "@/components/ui/button"
|
|
import { CircleCheckBig } from "lucide-react"
|
|
import { useActionState } from "react"
|
|
|
|
export default function LLMSettingsForm({ settings }: { settings: Record<string, string> }) {
|
|
const [saveState, saveAction, pending] = useActionState(saveSettingsAction, null)
|
|
|
|
return (
|
|
<form action={saveAction} className="space-y-4">
|
|
<FormInput title="OpenAI API Key" name="openai_api_key" defaultValue={settings.openai_api_key} />
|
|
|
|
<FormTextarea
|
|
title="Prompt for Analyze Transaction"
|
|
name="prompt_analyse_new_file"
|
|
defaultValue={settings.prompt_analyse_new_file}
|
|
className="h-96"
|
|
/>
|
|
|
|
<div className="flex flex-row items-center gap-4">
|
|
<Button type="submit" disabled={pending}>
|
|
{pending ? "Saving..." : "Save Settings"}
|
|
</Button>
|
|
{saveState?.success && (
|
|
<p className="text-green-500 flex flex-row items-center gap-2">
|
|
<CircleCheckBig />
|
|
Saved!
|
|
</p>
|
|
)}
|
|
</div>
|
|
|
|
{saveState?.error && <p className="text-red-500">{saveState.error}</p>}
|
|
</form>
|
|
)
|
|
}
|