chore: refactor types out of atoms

This commit is contained in:
Louis 2024-12-05 11:27:58 +07:00
parent 7e28939a0c
commit 7585bb00ea
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
4 changed files with 12 additions and 11 deletions

View File

@ -4,6 +4,8 @@ import { PropsWithChildren } from 'react'
import { Provider, atom } from 'jotai'
import { FileInfo } from '@/types/file'
export const editPromptAtom = atom<string>('')
export const currentPromptAtom = atom<string>('')
export const fileUploadAtom = atom<FileInfo[]>([])
@ -15,10 +17,3 @@ export const selectedTextAtom = atom('')
export default function JotaiWrapper({ children }: PropsWithChildren) {
return <Provider>{children}</Provider>
}
export type FileType = 'image' | 'pdf'
export type FileInfo = {
file: File
type: FileType
}

6
web/types/file.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export type FileType = 'image' | 'pdf'
export type FileInfo = {
file: File
type: FileType
}

View File

@ -13,10 +13,10 @@ import {
} from '@janhq/core'
import { ulid } from 'ulidx'
import { FileType } from '@/containers/Providers/Jotai'
import { Stack } from '@/utils/Stack'
import { FileType } from '@/types/file'
export class MessageRequestBuilder {
msgId: string
type: MessageRequestType

View File

@ -6,10 +6,10 @@ import {
ThreadMessage,
} from '@janhq/core'
import { FileInfo } from '@/containers/Providers/Jotai'
import { MessageRequestBuilder } from './messageRequestBuilder'
import { FileInfo } from '@/types/file'
export class ThreadMessageBuilder {
messageRequest: MessageRequestBuilder