Automatic category from expense title (#80)

* environment variable

* random category draft

* get category from ai

* input limit and documentation

* use watch

* use field.name

* prettier

* presigned upload, readme warning, category to string util

* prettier

* check whether feature is enabled

* use process.env

* improved prompt to return id only

* remove console.debug

* show loader

* share class name

* prettier

* use template literals

* rename format util

* prettier
This commit is contained in:
Mert Demir
2024-02-05 02:23:11 +09:00
committed by GitHub
parent 10fd69404a
commit fb49fb596a
8 changed files with 136 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
import { Category } from '@prisma/client'
import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'
@@ -15,3 +16,7 @@ export function formatExpenseDate(date: Date) {
timeZone: 'UTC',
})
}
export function formatCategoryForAIPrompt(category: Category) {
return `"${category.grouping}/${category.name}" (ID: ${category.id})`
}