grasant commited on
Commit
4a6eaea
·
verified ·
1 Parent(s): afd019e

Update plugin.py

Browse files
Files changed (1) hide show
  1. plugin.py +45 -28
plugin.py CHANGED
@@ -202,49 +202,66 @@ class CanRunGAssistPlugin:
202
  }
203
 
204
  def detect_hardware(self, params: Dict[str, str]) -> Dict[str, Any]:
205
- """Provide simplified hardware detection focused on immediate response."""
206
- logging.info("Starting simplified hardware detection")
207
 
208
- # Provide immediate, useful hardware information
209
- hardware_message = """💻 SYSTEM HARDWARE DETECTION:
 
 
 
 
 
 
 
 
 
 
210
 
211
  🖥️ GRAPHICS CARD:
212
- • GPU: RTX/GTX Series Detected
213
- • VRAM: 8GB+ Gaming Ready
214
- • RTX Features: ✅ Supported
215
- • DLSS Support: ✅ Available
216
- • Driver Status: ✅ Compatible
217
 
218
  🧠 PROCESSOR:
219
- • CPU: Modern Gaming Processor
220
- • Cores: Multi-core Gaming Ready
221
- • Performance: ✅ Optimized
222
 
223
  💾 MEMORY:
224
- • RAM: 16GB+ Gaming Configuration
225
- • Speed: High-speed DDR4/DDR5
226
- • Gaming Performance: ✅ Excellent
227
 
228
  🖥️ DISPLAY:
229
- • Resolution: High-resolution Gaming
230
- • Refresh Rate: High-refresh Compatible
231
- • G-Sync/FreeSync: ✅ Supported
232
 
233
  💾 STORAGE:
234
- • Type: NVMe SSD Gaming Ready
235
- • Performance: ✅ Fast Loading
236
 
237
  🖥️ SYSTEM:
238
- • OS: Windows 11 Gaming Ready
239
- • DirectX: DirectX 12 Ultimate
240
- • G-Assist: ✅ Fully Compatible
241
 
242
- Hardware detection completed successfully. For detailed specifications, use the full CanRun desktop application."""
243
 
244
- return {
245
- "success": True,
246
- "message": hardware_message
247
- }
 
 
 
 
 
 
 
248
 
249
  def format_canrun_response(self, result) -> str:
250
  """Format CanRun result for G-Assist display with complete information."""
 
202
  }
203
 
204
  def detect_hardware(self, params: Dict[str, str]) -> Dict[str, Any]:
205
+ """Provide comprehensive hardware detection with real system information."""
206
+ logging.info("Starting hardware detection with actual system data")
207
 
208
+ try:
209
+ # Get actual hardware specs from the CanRun engine
210
+ # Create event loop for async operation
211
+ loop = asyncio.new_event_loop()
212
+ asyncio.set_event_loop(loop)
213
+
214
+ # Get actual hardware specs using the engine's hardware detector
215
+ hardware_specs = loop.run_until_complete(self.canrun_engine.hardware_detector.get_hardware_specs())
216
+ loop.close()
217
+
218
+ # Format the hardware information in a readable way
219
+ hardware_message = f"""💻 SYSTEM HARDWARE DETECTION:
220
 
221
  🖥️ GRAPHICS CARD:
222
+ • GPU: {hardware_specs.gpu_model}
223
+ • VRAM: {hardware_specs.gpu_vram_gb}GB
224
+ • RTX Features: {'✅ Supported' if hardware_specs.supports_rtx else '❌ Not Available'}
225
+ • DLSS Support: {'✅ Available' if hardware_specs.supports_dlss else '❌ Not Available'}
226
+ • Driver Status: {'✅ Compatible' if hardware_specs.nvidia_driver_version != 'Unknown' else '⚠️ Unknown Version'}
227
 
228
  🧠 PROCESSOR:
229
+ • CPU: {hardware_specs.cpu_model}
230
+ • Cores: {hardware_specs.cpu_cores} Physical / {hardware_specs.cpu_threads} Logical
231
+ • Performance: {'High-Performance' if hardware_specs.cpu_cores >= 6 else '⚠️ Mid-Range'}
232
 
233
  💾 MEMORY:
234
+ • RAM: {hardware_specs.ram_total_gb}GB Total
235
+ • Speed: {hardware_specs.ram_speed_mhz}MHz
236
+ • Gaming Performance: {'✅ Excellent' if hardware_specs.ram_total_gb >= 16 else '⚠️ Adequate' if hardware_specs.ram_total_gb >= 8 else '❌ Below Recommended'}
237
 
238
  🖥️ DISPLAY:
239
+ • Resolution: {hardware_specs.primary_monitor_resolution}
240
+ • Refresh Rate: {hardware_specs.primary_monitor_refresh_hz}Hz
241
+ • G-Sync/FreeSync: {'Likely Supported' if hardware_specs.supports_rtx else '⚠️ Check Monitor Settings'}
242
 
243
  💾 STORAGE:
244
+ • Type: {hardware_specs.storage_type}
245
+ • Performance: {'✅ Fast Loading' if 'SSD' in hardware_specs.storage_type else '⚠️ Standard'}
246
 
247
  🖥️ SYSTEM:
248
+ • OS: {hardware_specs.os_version}
249
+ • DirectX: {hardware_specs.directx_version}
250
+ • G-Assist: ✅ Compatible (Plugin Working)
251
 
252
+ Hardware detection completed successfully using CanRun's privacy-aware detection system."""
253
 
254
+ return {
255
+ "success": True,
256
+ "message": hardware_message
257
+ }
258
+ except Exception as e:
259
+ logging.error(f"Error in hardware detection: {e}")
260
+ # Fall back to generic message if detection fails
261
+ return {
262
+ "success": False,
263
+ "message": f"Hardware detection failed: {str(e)}\n\nPlease check system compatibility and try again."
264
+ }
265
 
266
  def format_canrun_response(self, result) -> str:
267
  """Format CanRun result for G-Assist display with complete information."""