Skip to content

Commit 48a1809

Browse files
committed
update
1 parent 9535aaf commit 48a1809

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from collections.abc import Mapping
44
from pathlib import Path
55

6+
from propcache import cached_property
7+
68
from openhands.sdk.agent.base import AgentBase
79
from openhands.sdk.context.prompts.prompt import render_template
810
from openhands.sdk.conversation.base import BaseConversation
@@ -292,6 +294,11 @@ def resolved_plugins(self) -> list[ResolvedPluginSource] | None:
292294
"""
293295
return self._resolved_plugins
294296

297+
@cached_property
298+
def profile_store(self) -> LLMProfileStore:
299+
"""Get the profile store associated with this conversation."""
300+
return LLMProfileStore()
301+
295302
def _ensure_plugins_loaded(self) -> None:
296303
"""Lazy load plugins and set up hooks on first use.
297304
@@ -467,8 +474,7 @@ def _switch_model_profile(self, profile_name: str) -> None:
467474
try:
468475
new_llm = self.llm_registry.get(usage_id)
469476
except KeyError:
470-
store = LLMProfileStore()
471-
new_llm = store.load(profile_name)
477+
new_llm = self.profile_store.load(profile_name)
472478
new_llm = new_llm.model_copy(update={"usage_id": usage_id})
473479
self.llm_registry.add(new_llm)
474480

@@ -480,9 +486,9 @@ def _emit_model_info(self) -> None:
480486
"""Emit an environment message with current model and available profiles."""
481487
current_model = self.agent.llm.model
482488
try:
483-
store = LLMProfileStore()
484-
profiles = store.list()
489+
profiles = self.profile_store.list()
485490
except Exception:
491+
logger.warning("Failed to load profile store", exc_info=True)
486492
profiles = []
487493

488494
profile_list = (

0 commit comments

Comments
 (0)