|
|
|
|
@ -71,8 +71,9 @@ import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
|
|
|
|
import { SupportUploadFileTypes } from '@/app/components/workflow/types'
|
|
|
|
|
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
|
|
|
|
|
import { fetchFileUploadConfig } from '@/service/common'
|
|
|
|
|
import { correctProvider } from '@/utils'
|
|
|
|
|
|
|
|
|
|
interface PublishConfig {
|
|
|
|
|
type PublishConfig = {
|
|
|
|
|
modelConfig: ModelConfig
|
|
|
|
|
completionParams: FormValue
|
|
|
|
|
}
|
|
|
|
|
@ -156,6 +157,7 @@ const Configuration: FC = () => {
|
|
|
|
|
const setCompletionParams = (value: FormValue) => {
|
|
|
|
|
const params = { ...value }
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line ts/no-use-before-define
|
|
|
|
|
if ((!params.stop || params.stop.length === 0) && (modeModeTypeRef.current === ModelModeType.completion)) {
|
|
|
|
|
params.stop = getTempStop()
|
|
|
|
|
setTempStop([])
|
|
|
|
|
@ -164,7 +166,7 @@ const Configuration: FC = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [modelConfig, doSetModelConfig] = useState<ModelConfig>({
|
|
|
|
|
provider: 'openai',
|
|
|
|
|
provider: 'langgenius/openai/openai',
|
|
|
|
|
model_id: 'gpt-3.5-turbo',
|
|
|
|
|
mode: ModelModeType.unset,
|
|
|
|
|
configs: {
|
|
|
|
|
@ -187,7 +189,7 @@ const Configuration: FC = () => {
|
|
|
|
|
|
|
|
|
|
const isAgent = mode === 'agent-chat'
|
|
|
|
|
|
|
|
|
|
const isOpenAI = modelConfig.provider === 'openai'
|
|
|
|
|
const isOpenAI = modelConfig.provider === 'langgenius/openai/openai'
|
|
|
|
|
|
|
|
|
|
const [collectionList, setCollectionList] = useState<Collection[]>([])
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
@ -356,6 +358,7 @@ const Configuration: FC = () => {
|
|
|
|
|
const [canReturnToSimpleMode, setCanReturnToSimpleMode] = useState(true)
|
|
|
|
|
const setPromptMode = async (mode: PromptMode) => {
|
|
|
|
|
if (mode === PromptMode.advanced) {
|
|
|
|
|
// eslint-disable-next-line ts/no-use-before-define
|
|
|
|
|
await migrateToDefaultPrompt()
|
|
|
|
|
setCanReturnToSimpleMode(true)
|
|
|
|
|
}
|
|
|
|
|
@ -540,8 +543,19 @@ const Configuration: FC = () => {
|
|
|
|
|
if (modelConfig.retriever_resource)
|
|
|
|
|
setCitationConfig(modelConfig.retriever_resource)
|
|
|
|
|
|
|
|
|
|
if (modelConfig.annotation_reply)
|
|
|
|
|
setAnnotationConfig(modelConfig.annotation_reply, true)
|
|
|
|
|
if (modelConfig.annotation_reply) {
|
|
|
|
|
let annotationConfig = modelConfig.annotation_reply
|
|
|
|
|
if (modelConfig.annotation_reply.enabled) {
|
|
|
|
|
annotationConfig = {
|
|
|
|
|
...modelConfig.annotation_reply,
|
|
|
|
|
embedding_model: {
|
|
|
|
|
...modelConfig.annotation_reply.embedding_model,
|
|
|
|
|
embedding_provider_name: correctProvider(modelConfig.annotation_reply.embedding_model.embedding_provider_name),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setAnnotationConfig(annotationConfig, true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (modelConfig.sensitive_word_avoidance)
|
|
|
|
|
setModerationConfig(modelConfig.sensitive_word_avoidance)
|
|
|
|
|
@ -551,7 +565,7 @@ const Configuration: FC = () => {
|
|
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
|
modelConfig: {
|
|
|
|
|
provider: model.provider,
|
|
|
|
|
provider: correctProvider(model.provider),
|
|
|
|
|
model_id: model.name,
|
|
|
|
|
mode: model.mode,
|
|
|
|
|
configs: {
|
|
|
|
|
@ -605,6 +619,10 @@ const Configuration: FC = () => {
|
|
|
|
|
...tool,
|
|
|
|
|
isDeleted: res.deleted_tools?.includes(tool.tool_name),
|
|
|
|
|
notAuthor: collectionList.find(c => tool.provider_id === c.id)?.is_team_authorization === false,
|
|
|
|
|
...(tool.provider_type === 'builtin' ? {
|
|
|
|
|
provider_id: correctProvider(tool.provider_name),
|
|
|
|
|
provider_name: correctProvider(tool.provider_name),
|
|
|
|
|
} : {}),
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
} : DEFAULT_AGENT_SETTING,
|
|
|
|
|
@ -622,6 +640,12 @@ const Configuration: FC = () => {
|
|
|
|
|
retrieval_model: RETRIEVE_TYPE.multiWay,
|
|
|
|
|
...modelConfig.dataset_configs,
|
|
|
|
|
...retrievalConfig,
|
|
|
|
|
...(retrievalConfig.reranking_model ? {
|
|
|
|
|
reranking_model: {
|
|
|
|
|
...retrievalConfig.reranking_model,
|
|
|
|
|
reranking_provider_name: correctProvider(modelConfig.dataset_configs.reranking_model.reranking_provider_name),
|
|
|
|
|
},
|
|
|
|
|
} : {}),
|
|
|
|
|
})
|
|
|
|
|
setHasFetchedDetail(true)
|
|
|
|
|
})
|
|
|
|
|
|