mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: resolve default_project returning null in cloud mode (#644)
In cloud mode, ConfigManager has no local config file so default_project always returned None. Add async get_default_project_name() on ProjectService that falls back to the database is_default flag when ConfigManager returns None. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -48,7 +48,7 @@ async def list_projects(
|
||||
A list of all projects with metadata
|
||||
"""
|
||||
projects = await project_service.list_projects()
|
||||
default_project = project_service.default_project
|
||||
default_project = await project_service.get_default_project_name()
|
||||
|
||||
project_items = [
|
||||
ProjectItem(
|
||||
|
||||
@@ -82,6 +82,21 @@ class ProjectService:
|
||||
"""
|
||||
return self.config_manager.default_project
|
||||
|
||||
async def get_default_project_name(self) -> str:
|
||||
"""Get the default project name, falling back to the database.
|
||||
|
||||
ConfigManager reads from the local config file, which doesn't exist
|
||||
in cloud mode. When it returns None, fall back to the is_default
|
||||
flag stored in the database.
|
||||
"""
|
||||
default = self.config_manager.default_project
|
||||
if default is not None:
|
||||
return default
|
||||
db_default = await self.repository.get_default_project()
|
||||
if db_default is not None:
|
||||
return db_default.name
|
||||
raise ValueError("No default project configured")
|
||||
|
||||
@property
|
||||
def current_project(self) -> Optional[str]:
|
||||
"""Get the name of the currently active project.
|
||||
|
||||
Reference in New Issue
Block a user