feat: add cli execution stubs
This commit is contained in:
1 parent
1454e64066
commit
0d92b0a445
1 file changed
+59
-2
@@ -397,8 +397,65 @@ fn execution_stub(contract: &ExecutionContract) -> ExecutionStub {
|
||||
ExecutionContract::SummaryOnly { command } => ExecutionStub::SummaryOnly {
|
||||
command: command.clone(),
|
||||
},
|
||||
_ => ExecutionStub::SummaryOnly {
|
||||
command: "unimplemented".to_owned(),
|
||||
ExecutionContract::HttpGet {
|
||||
path,
|
||||
api_key_present,
|
||||
} => ExecutionStub::HttpRequest {
|
||||
method: "GET",
|
||||
path: path.clone(),
|
||||
api_key_present: *api_key_present,
|
||||
body: None,
|
||||
},
|
||||
ExecutionContract::LocalModelScan { models_dir } => ExecutionStub::LocalAction {
|
||||
action: "scan_models_dir",
|
||||
target: models_dir.clone(),
|
||||
detail: None,
|
||||
},
|
||||
ExecutionContract::LocalModelLoad {
|
||||
models_dir,
|
||||
model,
|
||||
alias,
|
||||
} => ExecutionStub::LocalAction {
|
||||
action: "load_model",
|
||||
target: models_dir.clone(),
|
||||
detail: Some(match alias {
|
||||
Some(alias) => format!("model={} alias={}", model, alias),
|
||||
None => format!("model={}", model),
|
||||
}),
|
||||
},
|
||||
ExecutionContract::LocalAuthConfig { mode, api_key } => ExecutionStub::LocalAction {
|
||||
action: "configure_auth",
|
||||
target: "auth".to_owned(),
|
||||
detail: Some(format!(
|
||||
"mode={} has_api_key={}",
|
||||
auth_mode_name(*mode),
|
||||
api_key.is_some()
|
||||
)),
|
||||
},
|
||||
ExecutionContract::LocalConfigWrite { key, value } => ExecutionStub::LocalAction {
|
||||
action: "write_config",
|
||||
target: key.clone(),
|
||||
detail: Some(format!("value={}", value)),
|
||||
},
|
||||
ExecutionContract::ThroughputRequest {
|
||||
path,
|
||||
api_key_present,
|
||||
samples,
|
||||
prompt_tokens,
|
||||
completion_tokens,
|
||||
} => ExecutionStub::HttpRequest {
|
||||
method: "POST",
|
||||
path: path.clone(),
|
||||
api_key_present: *api_key_present,
|
||||
body: Some(format!(
|
||||
"samples={} prompt_tokens={} completion_tokens={} stream=false",
|
||||
samples, prompt_tokens, completion_tokens
|
||||
)),
|
||||
},
|
||||
ExecutionContract::LocalLogRead { lines } => ExecutionStub::LocalAction {
|
||||
action: "tail_logs",
|
||||
target: "logs".to_owned(),
|
||||
detail: Some(format!("lines={}", lines)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user