Merge branch 'main' into web-chat-live
This commit is contained in:
@@ -60,6 +60,29 @@ export class PipelinesRepository {
|
||||
return response.graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pipeline from a definition `source` (the `submit` command),
|
||||
* create-only, mirroring `PipelinesRepository.createPipeline`: the name must
|
||||
* not already exist, so this can only ever add a draft and never overwrite a
|
||||
* retained pipeline. A blank name is refused before anything is sent, exactly
|
||||
* like the Android client; the sent name is trimmed. No run is started.
|
||||
*/
|
||||
async submit(name, source) {
|
||||
if (!String(name ?? "").trim()) {
|
||||
throw new ProtocolError("Enter a pipeline name.");
|
||||
}
|
||||
const response = await this.#client.call({
|
||||
type: Protocol.SUBMIT,
|
||||
name: String(name).trim(),
|
||||
source,
|
||||
create_only: true,
|
||||
});
|
||||
if (!response.detail) {
|
||||
throw new ProtocolError("The server returned no pipeline detail.");
|
||||
}
|
||||
return response.detail;
|
||||
}
|
||||
|
||||
async listRuns() {
|
||||
const response = await this.#client.call({ type: Protocol.LIST_RUNS });
|
||||
return { runs: response.runs ?? [], usage: response.usage ?? null };
|
||||
|
||||
Reference in New Issue
Block a user