Merge pull request #118 from open-webui/main

0.8.7
This commit is contained in:
Tim Baek authored and GitHub committed 2026-07-09 22:45:45 -05:00
commit 0cd055a318
11 files changed
+209 -77

No files matched your search

+7
View File
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.8.7] - 2026-07-09
### Fixed
- 🗂️ **Clearer Git status.** File changes now show a clear status instead of misleading line totals for images and other non-text files.
- 🤖 **More reliable Claude Code chats.** Image attachments and separate thinking sections now appear and finish more reliably.
## [0.8.6] - 2026-07-09
### Added
@@ -1231,10 +1231,15 @@
class="flex shrink-0 items-center gap-1 text-[0.625rem] font-mono font-medium"
use:tooltip={gitStatusTooltip(fileGitStatus, entry)}
>
<span class="text-green-600 dark:text-green-400"
>+{fileGitStatus.additions ?? 0}</span
>
<span class="text-red-500 dark:text-red-400">-{fileGitStatus.deletions ?? 0}</span>
{#if fileGitStatus.binary}
<span class={entryGitDecoration.badgeColor}>{entryGitDecoration.char}</span>
{:else}
<span class="text-green-600 dark:text-green-400"
>+{fileGitStatus.additions ?? 0}</span
>
<span class="text-red-500 dark:text-red-400">-{fileGitStatus.deletions ?? 0}</span
>
{/if}
</span>
{/if}
{#if entry.type !== 'directory' && entry.size !== null}
@@ -1026,6 +1026,17 @@
return `${(bytes / 1048576).toFixed(1)} MB`;
}
function gitStatusChar(status: string): string {
const chars: Record<string, string> = {
added: 'A',
untracked: 'U',
modified: 'M',
deleted: 'D',
renamed: 'R'
};
return chars[status] ?? '?';
}
onDestroy(() => {
destroyEditor();
revokeBinaryUrl();
@@ -1041,8 +1052,12 @@
<span class="file-name scrollbar-none">{fileData.name}</span>
{#if currentFileStatus}
<span class="file-git-stats">
<span class="file-git-additions">+{currentFileStatus.additions ?? 0}</span>
<span class="file-git-deletions">-{currentFileStatus.deletions ?? 0}</span>
{#if currentFileStatus.binary}
<span class="file-git-status">{gitStatusChar(currentFileStatus.status)}</span>
{:else}
<span class="file-git-additions">+{currentFileStatus.additions ?? 0}</span>
<span class="file-git-deletions">-{currentFileStatus.deletions ?? 0}</span>
{/if}
</span>
{/if}
</span>
@@ -1325,6 +1340,10 @@
color: #ef4444;
}
.file-git-status {
color: var(--color-gray-500);
}
:global(.dark) .file-git-additions {
color: #4ade80;
}
+64 -22
View File
@@ -44,6 +44,7 @@
unstaged?: boolean;
staged_status?: string;
unstaged_status?: string;
binary?: boolean;
additions?: number;
deletions?: number;
};
@@ -673,6 +674,25 @@
return `${Math.floor(s / 86400)}d`;
}
function statusChar(status: string): { char: string; color: string } {
switch (status) {
case 'added':
return { char: 'A', color: 'text-green-500' };
case 'untracked':
return { char: 'U', color: 'text-green-500' };
case 'modified':
return { char: 'M', color: 'text-amber-500' };
case 'deleted':
return { char: 'D', color: 'text-red-400' };
case 'renamed':
return { char: 'R', color: 'text-blue-400' };
case 'conflict':
return { char: '!', color: 'text-orange-500' };
default:
return { char: '?', color: 'text-gray-400' };
}
}
const syncAction = $derived.by(() => {
if (!gitStatus) return { label: $t('git.fetch'), icon: 'refresh', action: doFetch };
if (gitStatus.behind > 0)
@@ -788,25 +808,38 @@
<Icon name="chevron-down" size={9} class="text-gray-400 dark:text-gray-600" />
</button>
{#if gitStatus.ahead > 0}<span
{#if gitStatus.ahead > 0}
<span
class="ml-1.5 shrink-0 whitespace-nowrap text-[0.625rem] font-mono text-gray-400 dark:text-gray-600"
>↑{gitStatus.ahead}</span
>{/if}
{#if gitStatus.behind > 0}<span
class="text-[0.625rem] font-mono text-gray-400 dark:text-gray-600 ml-1"
>↓{gitStatus.behind}</span
>{/if}
{#if totalChanges > 0}<span
>
↑{gitStatus.ahead}
</span>
{/if}
{#if gitStatus.behind > 0}
<span class="text-[0.625rem] font-mono text-gray-400 dark:text-gray-600 ml-1">
↓{gitStatus.behind}
</span>
{/if}
{#if totalChanges > 0}
<span
class="mx-1.5 block min-w-0 max-w-20 shrink truncate whitespace-nowrap text-[0.625rem] font-mono text-gray-400 dark:text-gray-600"
>{$t('git.changedCount', { count: totalChanges })}</span
><span class="mx-1.5 flex shrink-0 items-center gap-1 text-[0.625rem] font-mono"
><span class="text-green-600 dark:text-green-400">+{totalAdditions}</span>
<span class="text-red-500 dark:text-red-400">-{totalDeletions}</span></span
>{/if}
{#if actionMsg}<span
>
{$t('git.changedCount', { count: totalChanges })}
</span>
{#if totalAdditions || totalDeletions}
<span class="mx-1.5 flex shrink-0 items-center gap-1 text-[0.625rem] font-mono">
<span class="text-green-600 dark:text-green-400">+{totalAdditions}</span>
<span class="text-red-500 dark:text-red-400">-{totalDeletions}</span>
</span>
{/if}
{/if}
{#if actionMsg}
<span
class="ml-auto min-w-0 max-w-32 truncate whitespace-nowrap text-[0.625rem] font-mono text-gray-400 dark:text-gray-600"
>{actionMsg}</span
>{/if}
>
{actionMsg}
</span>
{/if}
<div class="flex-1"></div>
@@ -1235,6 +1268,7 @@
<div class="min-w-0 flex-1 overflow-x-hidden overflow-y-auto">
{#each gitStatus?.files ?? [] as file (file.path)}
{@const fp = fPath(file.path)}
{@const sc = statusChar(file.status)}
<button
class="group flex min-w-0 items-center gap-1.5 w-full h-7 px-2.5 text-left transition-colors duration-75
{selectedFile === file.path
@@ -1273,12 +1307,20 @@
}}>{fp.name}</span
>
</span>
<span
class="flex shrink-0 items-center gap-1 text-[0.625rem] font-mono font-medium"
>
<span class="text-green-600 dark:text-green-400">+{file.additions ?? 0}</span>
<span class="text-red-500 dark:text-red-400">-{file.deletions ?? 0}</span>
</span>
{#if file.binary}
<span class="shrink-0 text-[0.625rem] font-mono font-bold {sc.color}"
>{sc.char}</span
>
{:else}
<span
class="flex shrink-0 items-center gap-1 text-[0.625rem] font-mono font-medium"
>
<span class="text-green-600 dark:text-green-400"
>+{file.additions ?? 0}</span
>
<span class="text-red-500 dark:text-red-400">-{file.deletions ?? 0}</span>
</span>
{/if}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<span
class="flex items-center justify-center w-5 h-5 rounded shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-white/10 transition-all duration-75"
+44 -20
View File
@@ -17,6 +17,7 @@
path: string;
status: string;
staged: boolean;
binary: boolean;
diffFiles: DiffFile[];
additions: number;
deletions: number;
@@ -98,6 +99,7 @@
path: file.path,
status: file.status,
staged: file.staged,
binary: file.binary ?? false,
diffFiles,
additions: counts.additions,
deletions: counts.deletions,
@@ -150,6 +152,17 @@
if (slash < 0) return { dir: '', name: path };
return { dir: path.slice(0, slash + 1), name: path.slice(slash + 1) };
}
function statusChar(status: string): string {
const chars: Record<string, string> = {
added: 'A',
untracked: 'U',
modified: 'M',
deleted: 'D',
renamed: 'R'
};
return chars[status] ?? '?';
}
</script>
<div
@@ -201,12 +214,14 @@
<span class="ml-1 font-mono text-[0.625rem] text-gray-400 dark:text-gray-600"
>{$t('git.changedCount', { count: totalChanges })}</span
>
<span class="ml-2 font-mono text-[0.625rem] text-green-600 dark:text-green-400"
>+{totalAdditions}</span
>
<span class="font-mono text-[0.625rem] text-red-500 dark:text-red-400"
>-{totalDeletions}</span
>
{#if totalAdditions || totalDeletions}
<span class="ml-2 font-mono text-[0.625rem] text-green-600 dark:text-green-400"
>+{totalAdditions}</span
>
<span class="font-mono text-[0.625rem] text-red-500 dark:text-red-400"
>-{totalDeletions}</span
>
{/if}
{/if}
</div>
@@ -252,12 +267,14 @@
<span class="ml-auto text-[0.6875rem] text-gray-400 dark:text-gray-600"
>{$t('git.change', { count: totalChanges })}</span
>
<span class="ml-2 font-mono text-[0.6875rem] text-green-600 dark:text-green-400"
>+{totalAdditions}</span
>
<span class="font-mono text-[0.6875rem] text-red-500 dark:text-red-400"
>-{totalDeletions}</span
>
{#if totalAdditions || totalDeletions}
<span class="ml-2 font-mono text-[0.6875rem] text-green-600 dark:text-green-400"
>+{totalAdditions}</span
>
<span class="font-mono text-[0.6875rem] text-red-500 dark:text-red-400"
>-{totalDeletions}</span
>
{/if}
</div>
{/if}
@@ -312,14 +329,21 @@
>
{/if}
</div>
<span
class="shrink-0 font-mono text-[0.6875rem] font-medium text-green-600 dark:text-green-400"
>+{file.additions}</span
>
<span
class="shrink-0 font-mono text-[0.6875rem] font-medium text-red-500 dark:text-red-400"
>-{file.deletions}</span
>
{#if file.binary}
<span
class="shrink-0 font-mono text-[0.6875rem] font-medium text-gray-500 dark:text-gray-400"
>{statusChar(file.status)}</span
>
{:else}
<span
class="shrink-0 font-mono text-[0.6875rem] font-medium text-green-600 dark:text-green-400"
>+{file.additions}</span
>
<span
class="shrink-0 font-mono text-[0.6875rem] font-medium text-red-500 dark:text-red-400"
>-{file.deletions}</span
>
{/if}
<span
class="shrink-0 rounded px-1.5 py-0.5 text-[0.625rem] font-medium text-rose-500 bg-rose-50 dark:bg-rose-500/10 dark:text-rose-300"
@@ -17,6 +17,7 @@ export interface GitFile {
unstaged?: boolean;
staged_status?: string;
unstaged_status?: string;
binary?: boolean;
additions?: number;
deletions?: number;
}
+12 -2
View File
@@ -35,7 +35,9 @@ def _prompt_from_messages(messages: list[dict[str, Any]]) -> str:
return "\n\n".join(parts)
def _claude_query_input(prompt: str, attachments: PreparedAgentAttachments) -> Any:
def _claude_query_input(
prompt: str, attachments: PreparedAgentAttachments
) -> str | AsyncIterator[dict[str, Any]]:
if not attachments.images:
return prompt
content: list[dict[str, Any]] = []
@@ -52,7 +54,15 @@ def _claude_query_input(prompt: str, attachments: PreparedAgentAttachments) -> A
},
}
)
return content
async def messages() -> AsyncIterator[dict[str, Any]]:
yield {
"type": "user",
"message": {"role": "user", "content": content},
"parent_tool_use_id": None,
}
return messages()
def _chat_approval_mode(chat_params: dict[str, Any]) -> str:
+36 -19
View File
@@ -1521,21 +1521,22 @@ async def run_chat_task(
runner = runners.get(agent_target.agent)
if runner is None:
raise RuntimeError(f"Unsupported agent type: {agent_target.agent}")
reasoning_buffer = ""
reasoning_item_id = f"reasoning-{message_id}"
def _active_reasoning_item():
return next(
(
item
for item in reversed(output_items)
if item.get("type") == "reasoning" and item.get("status") == "in_progress"
),
None,
)
async def _finish_reasoning_item():
existing = next(
(item for item in output_items if item.get("id") == reasoning_item_id), None
)
if not existing or existing.get("status") == "completed":
existing = _active_reasoning_item()
if not existing:
return
item = {
"type": "reasoning",
"id": reasoning_item_id,
"status": "completed",
"content": [{"type": "reasoning_text", "text": reasoning_buffer}],
}
item = {**existing, "status": "completed"}
_upsert_output_item(output_items, item)
await emit(output=item)
_sync_state()
@@ -1557,13 +1558,29 @@ async def run_chat_task(
await emit(delta=event.text)
_sync_state()
elif isinstance(event, AgentReasoningDelta):
reasoning_buffer += event.text
item = {
"type": "reasoning",
"id": reasoning_item_id,
"status": "in_progress",
"content": [{"type": "reasoning_text", "text": reasoning_buffer}],
}
existing = _active_reasoning_item()
if existing:
blocks = existing.get("content") or []
text = next(
(
block.get("text", "")
for block in blocks
if isinstance(block, dict) and block.get("type") == "reasoning_text"
),
"",
)
item = {
**existing,
"content": [{"type": "reasoning_text", "text": f"{text}{event.text}"}],
}
else:
section = sum(item.get("type") == "reasoning" for item in output_items) + 1
item = {
"type": "reasoning",
"id": f"reasoning-{message_id}-{section}",
"status": "in_progress",
"content": [{"type": "reasoning_text", "text": event.text}],
}
_upsert_output_item(output_items, item)
await emit(output=item)
_sync_state()
+13 -6
View File
@@ -105,7 +105,10 @@ async def status(root: str) -> dict[str, Any]:
continue
added, deleted, path = parts[0], parts[1], parts[2]
entry = files_by_path.get(path)
if not entry or added == "-" or deleted == "-":
if not entry:
continue
if added == "-" or deleted == "-":
entry["binary"] = True
continue
entry["additions"] = entry.get("additions", 0) + int(added)
entry["deletions"] = entry.get("deletions", 0) + int(deleted)
@@ -142,8 +145,12 @@ async def status(root: str) -> dict[str, Any]:
path = line[2:]
add_file(path, "untracked", unstaged=True)
entry = files_by_path[path]
entry["additions"] = _count_text_lines(os.path.join(root, path))
entry["deletions"] = 0
line_count = _count_text_lines(os.path.join(root, path))
if line_count is None:
entry["binary"] = True
else:
entry["additions"] = line_count
entry["deletions"] = 0
elif line.startswith("u "):
# Unmerged
parts = line.split(" ", 10)
@@ -184,14 +191,14 @@ def _status_char(c: str) -> str:
}.get(c, c)
def _count_text_lines(path: str) -> int:
def _count_text_lines(path: str) -> int | None:
try:
with open(path, "rb") as f:
data = f.read()
except OSError:
return 0
return None
if b"\0" in data:
return 0
return None
if not data:
return 0
return data.count(b"\n") + (0 if data.endswith(b"\n") else 1)
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "cptr"
version = "0.8.6"
version = "0.8.7"
description = "Your computer, from anywhere. Code, manage, and control your machine from the web."
license = {file = "LICENSE"}
readme = "README.md"
Generated
+1 -1
View File
@@ -284,7 +284,7 @@ wheels = [
[[package]]
name = "cptr"
version = "0.8.6"
version = "0.8.7"
source = { editable = "." }
dependencies = [
{ name = "aiosqlite" },