Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(diff): 修复windows 下 /diff 不显示删除以及修改文件

openJiuwen-bot370164b97986
diff --git a/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts b/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
index 4a9c4b66ab..905c0c9240 100644
--- a/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
@@ -1789,7 +1789,10 @@ export class AppScreen implements Component, Focusable {
private _toRelativePath(absPath: string): string {
const cwd = getCurrentCwd() || process.cwd();
const normalized = path.resolve(absPath);
- if (normalized.startsWith(cwd + path.sep) || normalized === cwd) {
+ // On Windows, paths are case-insensitive — lower() for safe comparison
+ const a = process.platform === "win32" ? normalized.toLowerCase() : normalized;
+ const b = process.platform === "win32" ? cwd.toLowerCase() : cwd;
+ if (a.startsWith(b + path.sep) || a === b) {
const rel = path.relative(cwd, normalized);
return rel || path.basename(absPath);
}
diff --git a/jiuwenswarm/server/utils/diff_service.py b/jiuwenswarm/server/utils/diff_service.py
index 5183edcded..d0fe335be9 100644
--- a/jiuwenswarm/server/utils/diff_service.py
+++ b/jiuwenswarm/server/utils/diff_service.py
@@ -589,6 +589,7 @@ class DiffService:
cwd=project_dir,
capture_output=True,
text=True,
+ encoding="utf-8",
timeout=10,
)
if result.returncode != 0:
@@ -608,6 +609,7 @@ class DiffService:
cwd=project_dir,
capture_output=True,
text=True,
+ encoding="utf-8",
timeout=5,
)
if result.returncode != 0:
@@ -632,6 +634,7 @@ class DiffService:
cwd=project_dir,
capture_output=True,
text=True,
+ encoding="utf-8",
timeout=5,
)
if result.returncode != 0: