feat: allow users to specify timeout for text generations and workflows by environment variable (#8395)

This commit is contained in:
kurokobo
2024-09-14 15:11:45 +09:00
committed by GitHub
parent 032dd93b2f
commit 52857dc0a6
8 changed files with 34 additions and 4 deletions

View File

@ -269,8 +269,10 @@ const Result: FC<IResultProps> = ({
}))
},
onWorkflowFinished: ({ data }) => {
if (isTimeout)
if (isTimeout) {
notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })
return
}
if (data.error) {
notify({ type: 'error', message: data.error })
setWorkflowProcessData(produce(getWorkflowProcessData()!, (draft) => {
@ -326,8 +328,10 @@ const Result: FC<IResultProps> = ({
setCompletionRes(res.join(''))
},
onCompleted: () => {
if (isTimeout)
if (isTimeout) {
notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })
return
}
setRespondingFalse()
setMessageId(tempMessageId)
onCompleted(getCompletionRes(), taskId, true)
@ -338,8 +342,10 @@ const Result: FC<IResultProps> = ({
setCompletionRes(res.join(''))
},
onError() {
if (isTimeout)
if (isTimeout) {
notify({ type: 'warning', message: t('appDebug.warningMessage.timeoutExceeded') })
return
}
setRespondingFalse()
onCompleted(getCompletionRes(), taskId, false)
isEnd = true

View File

@ -43,6 +43,7 @@ const LocaleLayout = ({
data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
data-public-text-generation-timeout-ms={process.env.NEXT_PUBLIC_TEXT_GENERATION_TIMEOUT_MS}
>
<Topbar />
<BrowserInitor>