fix: remove config bundle restore dependency
This commit is contained in:
@@ -1243,6 +1243,10 @@ pub fn build_router(api: WorkspaceApi) -> Router {
|
||||
"/api/w/{workspace_id}/config/source-tree",
|
||||
get(scoped_get_workspace_config_tree),
|
||||
)
|
||||
.route(
|
||||
"/api/w/{workspace_id}/config/projections/prompts",
|
||||
get(scoped_get_prompt_projection),
|
||||
)
|
||||
.route(
|
||||
"/api/w/{workspace_id}/config/source-tree/commit",
|
||||
post(scoped_commit_workspace_config_tree),
|
||||
@@ -2581,6 +2585,25 @@ struct WorkspaceConfigEntryPath {
|
||||
path: String,
|
||||
}
|
||||
|
||||
async fn scoped_get_prompt_projection(
|
||||
State(api): State<WorkspaceApi>,
|
||||
AxumPath(path): AxumPath<ScopedWorkspacePath>,
|
||||
) -> ApiResult<Json<worker::WorkspacePromptProjection>> {
|
||||
validate_workspace_scope(&api, &path.workspace_id)?;
|
||||
let state = api
|
||||
.config_store
|
||||
.load_workspace_config(&path.workspace_id)?
|
||||
.ok_or_else(|| {
|
||||
ApiError::from(Error::InvalidInput(
|
||||
"Workspace config is not initialized".to_string(),
|
||||
))
|
||||
})?;
|
||||
let projection = api
|
||||
.prompt_projection_cache
|
||||
.resolve(&path.workspace_id, &state)?;
|
||||
Ok(Json(projection.as_ref().clone()))
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct WorkspaceConfigTreeResponse {
|
||||
snapshot: ConfigTreeSnapshot,
|
||||
|
||||
Reference in New Issue
Block a user