yumoqing 0e0ee695e6 feat: add orgid field to hermes_services for organization-scoped service isolation
- Add orgid field (str32, not nullable) to hermes_services table
- Replace user_id with orgid in all service CRUD operations (SQL + functions)
- Update function signatures: get_all_services, create_service, delete_service,
  get_service_by_id, test_service_connection, create_session,
  send_message_to_service, get_session_messages all use orgid
- Add orgid indexes: idx_hermes_services_orgid, idx_hermes_services_orgid_status
- Add logined_userorgid filtering to CRUD definition for automatic framework-level isolation
- Update all .dspy files to use get_userorgid() for org-scoped service queries
- Update init/data.json and db_tables.py to reflect orgid field
2026-04-27 11:50:05 +08:00

19 lines
534 B
Plaintext

# Test service connection by ID
# This .dspy file uses functions provided by load_hermes_web_cli()
try:
service_id = params_kw.get('id')
if not service_id:
return {"error": "Service ID is required"}
# Get current user's org ID
orgid = await get_userorgid()
# Call the function provided by the hermes-web-cli module
is_connected, status_msg = await test_service_connection(service_id, orgid)
return {"status": status_msg}
except Exception as e:
return {"error": str(e)}