π OpenHands: AI-Driven Development
(Hotfix): Fix logs and filestore init for llm registry (#10470)
Rohit Malhotra875036d9200e
diff --git a/openhands/server/services/conversation_stats.py b/openhands/server/services/conversation_stats.pyindex 65522fdf30..89ed789f6c 100644--- a/openhands/server/services/conversation_stats.py+++ b/openhands/server/services/conversation_stats.py@@ -39,6 +39,10 @@ class ConversationStats:pickled = pickle.dumps(self.service_to_metrics)serialized_metrics = base64.b64encode(pickled).decode('utf-8')self.file_store.write(self.metrics_path, serialized_metrics)+ logger.info(+ 'Saved converation stats',+ extra={'conversation_id': self.conversation_id},+ )def maybe_restore_metrics(self):if not self.file_store or not self.conversation_id:@@ -56,9 +60,6 @@ class ConversationStats:total_metrics = Metrics()for metrics in self.service_to_metrics.values():total_metrics.merge(metrics)-- logger.info(f'metrics by all services: {self.service_to_metrics}')- logger.info(f'combined metrics\n\n{total_metrics}')return total_metricsdef get_metrics_for_service(self, service_id: str) -> Metrics:diff --git a/openhands/utils/utils.py b/openhands/utils/utils.pyindex db24201bb0..8ea3b96b54 100644--- a/openhands/utils/utils.py+++ b/openhands/utils/utils.py@@ -31,7 +31,13 @@ def create_registry_and_conversation_stats(agent_cls = user_settings.agent if user_settings else Nonellm_registry = LLMRegistry(user_config, agent_cls)- file_store = get_file_store(user_config.file_store, user_config.file_store_path)+ file_store = get_file_store(+ file_store_type=config.file_store,+ file_store_path=config.file_store_path,+ file_store_web_hook_url=config.file_store_web_hook_url,+ file_store_web_hook_headers=config.file_store_web_hook_headers,+ file_store_web_hook_batch=config.file_store_web_hook_batch,+ )conversation_stats = ConversationStats(file_store, sid, user_id)llm_registry.subscribe(conversation_stats.register_llm)return llm_registry, conversation_stats, user_config