diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index dc7d9f9dd3..c7d36992aa 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -506,6 +506,7 @@ async def edit_image( async def ask_user( questions: list[dict], allow_other: bool = True, + timeout_ms: int = 120_000, __event_call__: callable = None, ) -> str: """ @@ -514,6 +515,7 @@ async def ask_user( :param questions: 1-3 question objects, each with id, header, question, and 2-3 options. Each option needs label and description. :param allow_other: Whether users may enter a free-form answer instead of choosing one of the options + :param timeout_ms: How long the browser should keep the prompt open before cancelling it :return: JSON with status and answers keyed by question id """ try: @@ -568,6 +570,9 @@ async def ask_user( } ) + if isinstance(timeout_ms, bool) or not isinstance(timeout_ms, int) or not 60_000 <= timeout_ms <= 240_000: + timeout_ms = 120_000 + if __event_call__ is None: return JSONCodec.dumps( { @@ -583,6 +588,7 @@ async def ask_user( 'data': { 'questions': normalized_questions, 'allow_other': allow_other, + 'timeout_ms': timeout_ms, }, } ) diff --git a/src/lib/components/chat/AskUserCard.svelte b/src/lib/components/chat/AskUserCard.svelte index 4c69789c04..d4ba1f8fc9 100644 --- a/src/lib/components/chat/AskUserCard.svelte +++ b/src/lib/components/chat/AskUserCard.svelte @@ -1,5 +1,6 @@ {#if show} -
+
-
- {$i18n.t('Planning question')} +
+ {$i18n.t('Assistant needs your input')}
-
+
{$i18n.t('Question')} {questionIndex + 1} {$i18n.t('of')} - {questions.length} ยท - {$i18n.t('Paused while visible')} + {questions.length}
@@ -177,12 +203,12 @@