Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(chat): mark thread busy during tool approval/exec and hide stray progress bar on model load

Akarshan Biswas8d4b81298d13
diff --git a/web-app/src/components/PromptProgress.tsx b/web-app/src/components/PromptProgress.tsx
index c215d11bd..02ffdd86d 100644
--- a/web-app/src/components/PromptProgress.tsx
+++ b/web-app/src/components/PromptProgress.tsx
@@ -47,7 +47,7 @@ export function PromptProgress({ hideIdle = false }: { hideIdle?: boolean }) {
<Loader className="animate-spin w-3.5 h-3.5 text-primary shrink-0" />
<span className="font-medium text-foreground">{label}</span>
</div>
- {showReading && (
+ {showReading && !loadingModel && (
<Progress value={percentage} className="h-1 bg-secondary/60" />
)}
{detail && (
diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsx
index 785c4f2b9..ec9a870ff 100644
--- a/web-app/src/routes/threads/$threadId.tsx
+++ b/web-app/src/routes/threads/$threadId.tsx
@@ -355,6 +355,10 @@ function ThreadDetail() {
const ragToolNames = useAppState.getState().ragToolNames
const mcpToolNames = useAppState.getState().mcpToolNames
+ // Keep the thread marked busy while awaiting approval and executing tools,
+ // since streaming has already ended and isSessionBusy's tools-array read isn't reactive.
+ useAppState.getState().setThreadBusy(threadId, true)
+
// Process tool calls sequentially, requesting approval for each if needed
;(async () => {
for (const toolCall of sessionData.tools) {
@@ -438,6 +442,7 @@ function ThreadDetail() {
// Clear tools after processing all
sessionData.tools = []
toolCallAbortController.current = null
+ useAppState.getState().setThreadBusy(threadId, false)
})().catch((error) => {
// Ignore abort errors
if (error.name !== 'AbortError') {
@@ -445,6 +450,7 @@ function ThreadDetail() {
}
sessionData.tools = []
toolCallAbortController.current = null
+ useAppState.getState().setThreadBusy(threadId, false)
})
if (!isAbort) {