Skip to content

Commit

Permalink
Merge branch 'feat/model-provider-based-on-runtime' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh committed Jan 2, 2024
2 parents 287b2f6 + 460238c commit de068f0
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FC } from 'react'
import { useMemo, useState } from 'react'
import { useEffect, useMemo, useState } from 'react'
import useSWR from 'swr'
import { useTranslation } from 'react-i18next'
import type {
Expand Down Expand Up @@ -122,6 +122,22 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
}
}

const handleInitialParams = () => {
if (parameterRules.length) {
const newCompletionParams = { ...completionParams }
Object.keys(newCompletionParams).forEach((key) => {
if (!parameterRules.find(item => item.name === key))
delete newCompletionParams[key]
})

onCompletionParamsChange(newCompletionParams)
}
}

useEffect(() => {
handleInitialParams()
}, [parameterRules])

return (
<PortalToFollowElem
open={open}
Expand Down Expand Up @@ -222,7 +238,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
}
{
isLoading && (
<Loading />
<div className='mt-5'><Loading /></div>
)
}
{
Expand Down

0 comments on commit de068f0

Please sign in to comment.