@@ -377,6 +377,7 @@ def subcommands(self) -> Dict[str, Callable[[List[str]], Awaitable[str]]]:
377
377
return {
378
378
"set" : self ._set_system_prompt ,
379
379
"show" : self ._show_system_prompt ,
380
+ "reset" : self ._reset_system_prompt ,
380
381
}
381
382
382
383
async def _set_system_prompt (self , flags : Dict [str , str ], args : List [str ]) -> str :
@@ -421,7 +422,30 @@ async def _show_system_prompt(self, flags: Dict[str, str], args: List[str]) -> s
421
422
except crud .WorkspaceDoesNotExistError :
422
423
return f"Workspace `{ workspace_name } ` doesn't exist"
423
424
424
- return f"Workspace **{ workspace .name } ** system prompt:\n \n { workspace .system_prompt } ."
425
+ sysprompt = workspace .system_prompt
426
+ if not sysprompt :
427
+ return f"Workspace **{ workspace .name } ** system prompt is unset."
428
+
429
+ return f"Workspace **{ workspace .name } ** system prompt:\n \n { sysprompt } ."
430
+
431
+ async def _reset_system_prompt (self , flags : Dict [str , str ], args : List [str ]) -> str :
432
+ """
433
+ Reset the system prompt of a workspace
434
+ If a workspace name is not provided, the active workspace is used
435
+ """
436
+ workspace_name = flags .get ("-w" )
437
+ if not workspace_name :
438
+ active_workspace = await self .workspace_crud .get_active_workspace ()
439
+ workspace_name = active_workspace .name
440
+
441
+ try :
442
+ updated_worksapce = await self .workspace_crud .update_workspace_system_prompt (
443
+ workspace_name , ["" ]
444
+ )
445
+ except crud .WorkspaceDoesNotExistError :
446
+ return f"Workspace `{ workspace_name } ` doesn't exist"
447
+
448
+ return f"Workspace `{ updated_worksapce .name } ` system prompt reset."
425
449
426
450
@property
427
451
def help (self ) -> str :
0 commit comments