Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ __pycache__/
venv/

# Runtime data (monitor)
monitor/ocr_data.db
monitor/chroma_db/
monitor/screenshots/
monitor/monitor_pipe_name.txt
Expand Down
244 changes: 0 additions & 244 deletions ai_embedding/skill.md

This file was deleted.

51 changes: 51 additions & 0 deletions monitor/monitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ def _handle_command(req: dict):
return result


def _storage_ipc_health_snapshot():
try:
from storage_client import get_storage_client
sc = get_storage_client()
if sc and hasattr(sc, 'ipc_health_snapshot'):
return sc.ipc_health_snapshot()
except Exception as exc:
return {'error': str(exc)}
return None


def _handle_command_impl(req: dict):
"""Actual command dispatch logic."""
global _last_seq_no
Expand Down Expand Up @@ -341,6 +352,46 @@ def _handle_command_impl(req: dict):
status['ocr_stats'] = _ocr_worker.get_stats()
return status

if cmd == 'index_health':
storage_ipc = _storage_ipc_health_snapshot()
if not _ocr_worker:
return {
'status': 'success',
'worker_available': False,
'worker_started': False,
'stats': {},
'postprocess': None,
'storage_ipc': storage_ipc,
}
try:
refresh = bool(req.get('refresh', False))
if hasattr(_ocr_worker, 'get_index_health'):
result = _ocr_worker.get_index_health(refresh=refresh)
if isinstance(result, dict):
result['storage_ipc'] = storage_ipc
return result
return {
'status': 'success',
'worker_available': True,
'worker_started': None,
'stats': _ocr_worker.get_stats() if hasattr(_ocr_worker, 'get_stats') else {},
'postprocess': None,
'storage_ipc': storage_ipc,
}
except Exception as e:
logger.warning('Index health query failed: %s', e)
return {'status': 'error', 'error': str(e)}

if cmd == 'retry_vector_indexing':
if not _ocr_worker or not hasattr(_ocr_worker, 'retry_vector_indexing'):
return {'status': 'error', 'error': 'Vector indexing retry is not available'}
try:
limit = int(req.get('limit', 32) or 32)
return _ocr_worker.retry_vector_indexing(limit=limit)
except Exception as e:
logger.warning('Vector indexing retry failed: %s', e)
return {'status': 'error', 'error': str(e)}

# ----- Configuration commands -----
if cmd == 'update_filters':
filters = req.get('filters', {}) if isinstance(req, dict) else {}
Expand Down
Loading
Loading