Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/kimi_cli/auth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _common_headers() -> dict[str, str]:
"X-Msh-Version": VERSION,
"X-Msh-Device-Name": device_name,
"X-Msh-Device-Model": device_model,
"X-Msh-Os-Version": platform.version(),
"X-Msh-Os-Version": f"{platform.system()} {platform.release()}",
"X-Msh-Device-Id": get_device_id(),
}
return {key: _ascii_header_value(value) for key, value in headers.items()}
Expand Down
2 changes: 1 addition & 1 deletion src/kimi_cli/utils/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def detect() -> Environment:
os_kind = system

os_arch = platform.machine()
os_version = platform.version()
os_version = f"{platform.system()} {platform.release()}"

if os_kind == "Windows":
shell_name = "Windows PowerShell"
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/test_utils_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async def test_environment_detection(monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Linux")
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
monkeypatch.setattr(platform, "version", lambda: "5.15.0-123-generic")
monkeypatch.setattr(platform, "release", lambda: "5.15.0-123-generic")

async def _mock_is_file(self: KaosPath) -> bool:
return str(self) == "/usr/bin/bash"
Expand All @@ -20,7 +20,7 @@ async def _mock_is_file(self: KaosPath) -> bool:
env = await Environment.detect()
assert env.os_kind == "Linux"
assert env.os_arch == "x86_64"
assert env.os_version == "5.15.0-123-generic"
assert env.os_version == "Linux 5.15.0-123-generic"
assert env.shell_name == "bash"
assert str(env.shell_path) == "/usr/bin/bash"

Expand All @@ -29,13 +29,13 @@ async def _mock_is_file(self: KaosPath) -> bool:
async def test_environment_detection_windows(monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Windows")
monkeypatch.setattr(platform, "machine", lambda: "AMD64")
monkeypatch.setattr(platform, "version", lambda: "10.0.19044")
monkeypatch.setattr(platform, "release", lambda: "10.0.19044")

from kimi_cli.utils.environment import Environment

env = await Environment.detect()
assert env.os_kind == "Windows"
assert env.os_arch == "AMD64"
assert env.os_version == "10.0.19044"
assert env.os_version == "Windows 10.0.19044"
assert env.shell_name == "Windows PowerShell"
assert str(env.shell_path) == "powershell.exe"