chore: refactor types out of atoms
This commit is contained in:
parent
7e28939a0c
commit
7585bb00ea
@ -4,6 +4,8 @@ import { PropsWithChildren } from 'react'
|
|||||||
|
|
||||||
import { Provider, atom } from 'jotai'
|
import { Provider, atom } from 'jotai'
|
||||||
|
|
||||||
|
import { FileInfo } from '@/types/file'
|
||||||
|
|
||||||
export const editPromptAtom = atom<string>('')
|
export const editPromptAtom = atom<string>('')
|
||||||
export const currentPromptAtom = atom<string>('')
|
export const currentPromptAtom = atom<string>('')
|
||||||
export const fileUploadAtom = atom<FileInfo[]>([])
|
export const fileUploadAtom = atom<FileInfo[]>([])
|
||||||
@ -15,10 +17,3 @@ export const selectedTextAtom = atom('')
|
|||||||
export default function JotaiWrapper({ children }: PropsWithChildren) {
|
export default function JotaiWrapper({ children }: PropsWithChildren) {
|
||||||
return <Provider>{children}</Provider>
|
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
6
web/types/file.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export type FileType = 'image' | 'pdf'
|
||||||
|
|
||||||
|
export type FileInfo = {
|
||||||
|
file: File
|
||||||
|
type: FileType
|
||||||
|
}
|
||||||
@ -13,10 +13,10 @@ import {
|
|||||||
} from '@janhq/core'
|
} from '@janhq/core'
|
||||||
import { ulid } from 'ulidx'
|
import { ulid } from 'ulidx'
|
||||||
|
|
||||||
import { FileType } from '@/containers/Providers/Jotai'
|
|
||||||
|
|
||||||
import { Stack } from '@/utils/Stack'
|
import { Stack } from '@/utils/Stack'
|
||||||
|
|
||||||
|
import { FileType } from '@/types/file'
|
||||||
|
|
||||||
export class MessageRequestBuilder {
|
export class MessageRequestBuilder {
|
||||||
msgId: string
|
msgId: string
|
||||||
type: MessageRequestType
|
type: MessageRequestType
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import {
|
|||||||
ThreadMessage,
|
ThreadMessage,
|
||||||
} from '@janhq/core'
|
} from '@janhq/core'
|
||||||
|
|
||||||
import { FileInfo } from '@/containers/Providers/Jotai'
|
|
||||||
|
|
||||||
import { MessageRequestBuilder } from './messageRequestBuilder'
|
import { MessageRequestBuilder } from './messageRequestBuilder'
|
||||||
|
|
||||||
|
import { FileInfo } from '@/types/file'
|
||||||
|
|
||||||
export class ThreadMessageBuilder {
|
export class ThreadMessageBuilder {
|
||||||
messageRequest: MessageRequestBuilder
|
messageRequest: MessageRequestBuilder
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user