Merge models and runtime gaps
This commit is contained in:
@@ -16,6 +16,36 @@
|
||||
: "No Google credential configured: calls answer 503 until GOOGLE_API_KEY is set.";
|
||||
}).catch(function () { $("m-config").textContent = "Status unavailable."; });
|
||||
|
||||
// Admin panel: one example body per route (the server validates everything).
|
||||
var templates = {
|
||||
"endpoints": { action: "list_beta" },
|
||||
"endpoint/call": { kind: "compute_tokens", endpoint: "ENDPOINT_ID",
|
||||
contents: [{ role: "user", parts: [{ text: "hello" }] }] },
|
||||
"endpoint/operations": { action: "list", endpoint: "ENDPOINT_ID" },
|
||||
"publisher": { action: "beta_get", publisher: "google", model: "gemini-2.5-flash" }
|
||||
};
|
||||
function fillAdmin() {
|
||||
$("m-admin-body").value = JSON.stringify(templates[$("m-admin-route").value], null, 1);
|
||||
}
|
||||
$("m-admin-route").addEventListener("change", fillAdmin);
|
||||
fillAdmin();
|
||||
$("m-admin-run").addEventListener("click", function () {
|
||||
var body;
|
||||
try { body = JSON.parse($("m-admin-body").value || "{}"); }
|
||||
catch (e) { $("m-error").textContent = "Body is not valid JSON"; return; }
|
||||
$("m-error").textContent = "";
|
||||
$("m-out").textContent = "...";
|
||||
fetch("/agent/models/" + $("m-admin-route").value, {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body)
|
||||
}).then(function (r) {
|
||||
return r.text().then(function (t) { return { ok: r.ok, text: t }; });
|
||||
}).then(function (res) {
|
||||
if (!res.ok) { $("m-error").textContent = res.text.slice(0, 300); $("m-out").textContent = ""; return; }
|
||||
$("m-out").textContent = res.text.slice(0, MAX_OUT);
|
||||
}).catch(function (e) { $("m-error").textContent = String(e); });
|
||||
});
|
||||
|
||||
$("m-run").addEventListener("click", function () {
|
||||
var action = $("m-action").value;
|
||||
var prompt = $("m-prompt").value;
|
||||
|
||||
@@ -40,5 +40,29 @@
|
||||
$("rt-list").onclick = function () { post("/agent/runtime/list", {}); };
|
||||
$("rt-get").onclick = function () { post("/agent/runtime/get", { id: $("rt-id").value.trim() }); };
|
||||
$("rt-query").onclick = function () { var b = queryBody(); if (b) post("/agent/runtime/query", b); };
|
||||
// Body templates for the "More calls" panel: one example per route.
|
||||
var templates = {
|
||||
"operations": { action: "get", name: "projects/P/locations/L/reasoningEngines/E/operations/O" },
|
||||
"revisions": { action: "list", id: "ENGINE_ID" },
|
||||
"update": { id: "ENGINE_ID", displayName: "New name" },
|
||||
"iam": { action: "get", id: "ENGINE_ID" },
|
||||
"code": { id: "ENGINE_ID", inputs: [{ code: "print(1)" }] },
|
||||
"async/cancel": { id: "ENGINE_ID", operation: "projects/P/locations/L/operations/O" },
|
||||
"feedback": { action: "list", id: "ENGINE_ID" },
|
||||
"a2a": { target: "engine", protocol: "v1", op: "card", id: "ENGINE_ID" },
|
||||
"a2a/tasks": { action: "list", id: "ENGINE_ID" },
|
||||
"a2a/records": { action: "list", store: "STORE_ID" }
|
||||
};
|
||||
function fillTemplate() {
|
||||
$("rt-body").value = JSON.stringify(templates[$("rt-route").value], null, 1);
|
||||
}
|
||||
$("rt-route").onchange = fillTemplate;
|
||||
fillTemplate();
|
||||
$("rt-send").onclick = function () {
|
||||
var body;
|
||||
try { body = JSON.parse($("rt-body").value || "{}"); }
|
||||
catch (e) { err.textContent = "Body is not valid JSON"; return; }
|
||||
post("/agent/runtime/" + $("rt-route").value, body);
|
||||
};
|
||||
$("rt-stream").onclick = function () { var b = queryBody(); if (b) post("/agent/runtime/stream", b); };
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user