fix: cross-platform config path in chat_bridge.py
_load_providers and _SERVE_DB had hardcoded C:\\\\Users\\\\hmo paths.
Now uses os.path.expanduser(" ~\) as primary path, with Windows
fallback. Supports OPENCODE_CONFIG_PATH env override.
This commit is contained in:
@@ -340,10 +340,13 @@ def _search_all_sessions(query: str, max_sessions: int = 5) -> str:
|
|||||||
return f"(搜索出错: {e})"
|
return f"(搜索出错: {e})"
|
||||||
|
|
||||||
|
|
||||||
# ── Serve session DB path ──
|
# ── Serve session DB path (cross-platform) ──
|
||||||
_SERVE_DB = os.path.join(
|
_SERVE_DB = os.path.join(
|
||||||
os.environ.get("USERPROFILE", "C:\\Users\\hmo"),
|
os.path.expanduser("~"), ".local", "share", "opencode", "opencode.db")
|
||||||
".local", "share", "opencode", "opencode.db")
|
if sys.platform == "win32" and not os.path.exists(_SERVE_DB):
|
||||||
|
_SERVE_DB = os.path.join(
|
||||||
|
os.environ.get("USERPROFILE", "C:\\Users\\hmo"),
|
||||||
|
".local", "share", "opencode", "opencode.db")
|
||||||
|
|
||||||
|
|
||||||
class SessionBridge:
|
class SessionBridge:
|
||||||
|
|||||||
Reference in New Issue
Block a user