Show system info
This commit is contained in:
parent
34edaa3fdc
commit
100e8ea9db
@ -78,9 +78,14 @@ interface ControlsParams {
|
||||
reset: (types: ("rags" | "tools" | "history" | "system-prompt")[], message: string) => Promise<void>
|
||||
};
|
||||
|
||||
type GPUInfo = {
|
||||
name: string,
|
||||
memory: number,
|
||||
discrete: boolean
|
||||
}
|
||||
type SystemInfo = {
|
||||
"Installed RAM (GB)": string,
|
||||
"Graphics Cards": string[],
|
||||
"Installed RAM": string,
|
||||
"Graphics Card": GPUInfo[],
|
||||
"CPU": string
|
||||
};
|
||||
|
||||
@ -101,7 +106,7 @@ const SystemInfoComponent: React.FC<{ systemInfo: SystemInfo }> = ({ systemInfo
|
||||
return v.map((card, index) => (
|
||||
<div key={index} className="SystemInfoItem">
|
||||
<div>{convertToSymbols(k)} {index}</div>
|
||||
<div>{convertToSymbols(card)}</div>
|
||||
<div>{convertToSymbols(card.name)} {card.discrete ? `w/ ${Math.round(card.memory / (1024 * 1024 * 1024))}GB RAM` : "(integrated)"}</div>
|
||||
</div>
|
||||
));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import uuid
|
||||
import random
|
||||
import subprocess
|
||||
import re
|
||||
import math
|
||||
|
||||
def try_import(module_name, pip_name=None):
|
||||
try:
|
||||
@ -71,7 +72,7 @@ def get_installed_ram():
|
||||
meminfo = f.read()
|
||||
match = re.search(r'MemTotal:\s+(\d+)', meminfo)
|
||||
if match:
|
||||
return f"{round(int(match.group(1)) / 1024**2, 2)}GB" # Convert KB to GB
|
||||
return f"{math.floor(int(match.group(1)) / 1000**2)}GB" # Convert KB to GB
|
||||
except Exception as e:
|
||||
return f"Error retrieving RAM: {e}"
|
||||
|
||||
@ -84,7 +85,7 @@ def get_graphics_cards():
|
||||
# Clean up the output (remove leading/trailing whitespace and newlines)
|
||||
output = result.stdout.strip()
|
||||
for index in range(len(output.splitlines())):
|
||||
result = subprocess.run(['ze-monitor', f'--device {index+1} --info'], capture_output=True, text=True, check=True)
|
||||
result = subprocess.run(['ze-monitor', '--device', f'{index+1}', '--info'], capture_output=True, text=True, check=True)
|
||||
gpu_info = result.stdout.strip().splitlines()
|
||||
gpu = {
|
||||
"discrete": True, # Assume it's discrete initially
|
||||
@ -103,7 +104,7 @@ def get_graphics_cards():
|
||||
gpu["memory"] = match.group(1)
|
||||
continue
|
||||
|
||||
match = re.match(r'^\s*Is integrated with host: Yes"', line)
|
||||
match = re.match(r'^.*Is integrated with host: Yes.*', line)
|
||||
if match:
|
||||
gpu["discrete"] = False
|
||||
continue
|
||||
@ -125,7 +126,7 @@ def get_cpu_info():
|
||||
|
||||
def system_info(model):
|
||||
return {
|
||||
"Installed RAM": get_installed_ram(),
|
||||
"System RAM": get_installed_ram(),
|
||||
"Graphics Card": get_graphics_cards(),
|
||||
"CPU": get_cpu_info(),
|
||||
"LLM Model": model
|
||||
|
Loading…
x
Reference in New Issue
Block a user