fix(web): complete some ts type (#1148)

This commit is contained in:
Rhon Joe 2023-09-11 09:30:17 +08:00 committed by GitHub
parent 642842d61b
commit 38b9901274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View File

@ -239,7 +239,7 @@ const Completed: FC<ICompletedProps> = ({
// the current segment id and whether to show the modal // the current segment id and whether to show the modal
const [currSegment, setCurrSegment] = useState<{ segInfo?: SegmentDetailModel; showModal: boolean }>({ showModal: false }) const [currSegment, setCurrSegment] = useState<{ segInfo?: SegmentDetailModel; showModal: boolean }>({ showModal: false })
const [searchValue, setSearchValue] = useState() // the search value const [searchValue, setSearchValue] = useState<string>() // the search value
const [selectedStatus, setSelectedStatus] = useState<boolean | 'all'>('all') // the selected status, enabled/disabled/undefined const [selectedStatus, setSelectedStatus] = useState<boolean | 'all'>('all') // the selected status, enabled/disabled/undefined
const [lastSegmentsRes, setLastSegmentsRes] = useState<SegmentsResponse | undefined>(undefined) const [lastSegmentsRes, setLastSegmentsRes] = useState<SegmentsResponse | undefined>(undefined)

View File

@ -100,7 +100,7 @@ const KeyValidator = ({
className='mb-4' className='mb-4'
name={form.title} name={form.title}
placeholder={form.placeholder} placeholder={form.placeholder}
value={value[form.key] || ''} value={value[form.key] as string || ''}
onChange={v => handleChange(form, v)} onChange={v => handleChange(form, v)}
onFocus={() => handleFocus(form)} onFocus={() => handleFocus(form)}
validating={validating} validating={validating}

View File

@ -12,7 +12,7 @@ export type DatasetsContextValue = {
const DatasetsContext = createContext<DatasetsContextValue>({ const DatasetsContext = createContext<DatasetsContextValue>({
datasets: [], datasets: [],
mutateDatasets: () => {}, mutateDatasets: () => {},
currentDataset: undefined currentDataset: undefined,
}) })
export const useDatasetsContext = () => useContext(DatasetsContext) export const useDatasetsContext = () => useContext(DatasetsContext)

View File

@ -92,6 +92,12 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
prompt_template: '', prompt_template: '',
prompt_variables: [], prompt_variables: [],
}, },
opening_statement: null,
more_like_this: null,
suggested_questions_after_answer: null,
speech_to_text: null,
retriever_resource: null,
dataSets: [],
}, },
setModelConfig: () => { }, setModelConfig: () => { },
dataSets: [], dataSets: [],

View File

@ -35,24 +35,18 @@ export type SpeechToTextConfig = MoreLikeThisConfig
export type CitationConfig = MoreLikeThisConfig export type CitationConfig = MoreLikeThisConfig
export type RetrieverResourceConfig = MoreLikeThisConfig
// frontend use. Not the same as backend // frontend use. Not the same as backend
export type ModelConfig = { export type ModelConfig = {
provider: string // LLM Provider: for example "OPENAI" provider: string // LLM Provider: for example "OPENAI"
model_id: string model_id: string
configs: PromptConfig configs: PromptConfig
opening_statement: string | null opening_statement: string | null
more_like_this: { more_like_this: MoreLikeThisConfig | null
enabled: boolean suggested_questions_after_answer: SuggestedQuestionsAfterAnswerConfig | null
} | null speech_to_text: SpeechToTextConfig | null
suggested_questions_after_answer: { retriever_resource: RetrieverResourceConfig | null
enabled: boolean
} | null
speech_to_text: {
enabled: boolean
} | null
retriever_resource: {
enabled: boolean
} | null
dataSets: any[] dataSets: any[]
} }