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>
|
reset: (types: ("rags" | "tools" | "history" | "system-prompt")[], message: string) => Promise<void>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type GPUInfo = {
|
||||||
|
name: string,
|
||||||
|
memory: number,
|
||||||
|
discrete: boolean
|
||||||
|
}
|
||||||
type SystemInfo = {
|
type SystemInfo = {
|
||||||
"Installed RAM (GB)": string,
|
"Installed RAM": string,
|
||||||
"Graphics Cards": string[],
|
"Graphics Card": GPUInfo[],
|
||||||
"CPU": string
|
"CPU": string
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ const SystemInfoComponent: React.FC<{ systemInfo: SystemInfo }> = ({ systemInfo
|
|||||||
return v.map((card, index) => (
|
return v.map((card, index) => (
|
||||||
<div key={index} className="SystemInfoItem">
|
<div key={index} className="SystemInfoItem">
|
||||||
<div>{convertToSymbols(k)} {index}</div>
|
<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>
|
</div>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import uuid
|
|||||||
import random
|
import random
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
import math
|
||||||
|
|
||||||
def try_import(module_name, pip_name=None):
|
def try_import(module_name, pip_name=None):
|
||||||
try:
|
try:
|
||||||
@ -71,7 +72,7 @@ def get_installed_ram():
|
|||||||
meminfo = f.read()
|
meminfo = f.read()
|
||||||
match = re.search(r'MemTotal:\s+(\d+)', meminfo)
|
match = re.search(r'MemTotal:\s+(\d+)', meminfo)
|
||||||
if match:
|
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:
|
except Exception as e:
|
||||||
return f"Error retrieving RAM: {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)
|
# Clean up the output (remove leading/trailing whitespace and newlines)
|
||||||
output = result.stdout.strip()
|
output = result.stdout.strip()
|
||||||
for index in range(len(output.splitlines())):
|
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_info = result.stdout.strip().splitlines()
|
||||||
gpu = {
|
gpu = {
|
||||||
"discrete": True, # Assume it's discrete initially
|
"discrete": True, # Assume it's discrete initially
|
||||||
@ -103,7 +104,7 @@ def get_graphics_cards():
|
|||||||
gpu["memory"] = match.group(1)
|
gpu["memory"] = match.group(1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = re.match(r'^\s*Is integrated with host: Yes"', line)
|
match = re.match(r'^.*Is integrated with host: Yes.*', line)
|
||||||
if match:
|
if match:
|
||||||
gpu["discrete"] = False
|
gpu["discrete"] = False
|
||||||
continue
|
continue
|
||||||
@ -125,7 +126,7 @@ def get_cpu_info():
|
|||||||
|
|
||||||
def system_info(model):
|
def system_info(model):
|
||||||
return {
|
return {
|
||||||
"Installed RAM": get_installed_ram(),
|
"System RAM": get_installed_ram(),
|
||||||
"Graphics Card": get_graphics_cards(),
|
"Graphics Card": get_graphics_cards(),
|
||||||
"CPU": get_cpu_info(),
|
"CPU": get_cpu_info(),
|
||||||
"LLM Model": model
|
"LLM Model": model
|
||||||
|
Loading…
x
Reference in New Issue
Block a user