feat: expose _meta in tool metadata and map parametersSchema to inputSchema
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 27s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 27s
This commit is contained in:
@@ -215,9 +215,10 @@
|
|||||||
const badgeBorder = isDirect ? 'rgba(59,130,246,0.3)' : 'rgba(249,115,22,0.3)';
|
const badgeBorder = isDirect ? 'rgba(59,130,246,0.3)' : 'rgba(249,115,22,0.3)';
|
||||||
|
|
||||||
let paramHtml = '';
|
let paramHtml = '';
|
||||||
if (tool.parametersSchema && tool.parametersSchema.properties) {
|
const schema = tool.inputSchema || tool.parametersSchema;
|
||||||
const props = tool.parametersSchema.properties;
|
if (schema && schema.properties) {
|
||||||
const required = tool.parametersSchema.required || [];
|
const props = schema.properties;
|
||||||
|
const required = schema.required || [];
|
||||||
if (Object.keys(props).length > 0) {
|
if (Object.keys(props).length > 0) {
|
||||||
paramHtml = `
|
paramHtml = `
|
||||||
<div style="margin-top:16px; padding-top:16px; border-top:1px solid #27272a;">
|
<div style="margin-top:16px; padding-top:16px; border-top:1px solid #27272a;">
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = tool.name;
|
option.value = tool.name;
|
||||||
option.textContent = tool.name;
|
option.textContent = tool.name;
|
||||||
option.dataset.schema = JSON.stringify(tool.parametersSchema);
|
option.dataset.schema = JSON.stringify(tool.inputSchema || tool.parametersSchema);
|
||||||
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
|
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
|
||||||
option.dataset.integrationType = tool.integrationType || 'HTTP';
|
option.dataset.integrationType = tool.integrationType || 'HTTP';
|
||||||
optgroup.appendChild(option);
|
optgroup.appendChild(option);
|
||||||
|
|||||||
@@ -351,12 +351,13 @@
|
|||||||
option.value = tool.toolName;
|
option.value = tool.toolName;
|
||||||
const commType = tool.integrationType ? tool.integrationType : 'HTTP';
|
const commType = tool.integrationType ? tool.integrationType : 'HTTP';
|
||||||
option.textContent = tool.description ? `[${commType}] ${tool.description} (${tool.toolName})` : `[${commType}] ${tool.toolName}`;
|
option.textContent = tool.description ? `[${commType}] ${tool.description} (${tool.toolName})` : `[${commType}] ${tool.toolName}`;
|
||||||
option.dataset.schema = JSON.stringify(tool.parametersSchema);
|
option.dataset.schema = JSON.stringify(tool.inputSchema || tool.parametersSchema);
|
||||||
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
|
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
|
||||||
optgroup.appendChild(option);
|
optgroup.appendChild(option);
|
||||||
|
|
||||||
const enums = tool.parametersSchema?.properties?.action?.enum || [];
|
const schema = tool.inputSchema || tool.parametersSchema;
|
||||||
const descStr = tool.parametersSchema?.properties?.action?.description || "";
|
const enums = schema?.properties?.action?.enum || [];
|
||||||
|
const descStr = schema?.properties?.action?.description || "";
|
||||||
|
|
||||||
let descMap = {};
|
let descMap = {};
|
||||||
if(descStr.includes(":")) {
|
if(descStr.includes(":")) {
|
||||||
|
|||||||
@@ -331,7 +331,7 @@
|
|||||||
function generateDummyPayload(tool) {
|
function generateDummyPayload(tool) {
|
||||||
if (tool._customPayload) return tool._customPayload;
|
if (tool._customPayload) return tool._customPayload;
|
||||||
|
|
||||||
const schema = tool.parametersSchema;
|
const schema = tool.inputSchema || tool.parametersSchema;
|
||||||
if (!schema || !schema.properties) return {};
|
if (!schema || !schema.properties) return {};
|
||||||
const payload = {};
|
const payload = {};
|
||||||
for (const [key, value] of Object.entries(schema.properties)) {
|
for (const [key, value] of Object.entries(schema.properties)) {
|
||||||
@@ -705,7 +705,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSmartForm(tool, payloadToUse = null) {
|
function renderSmartForm(tool, payloadToUse = null) {
|
||||||
const schema = tool.parametersSchema;
|
const schema = tool.inputSchema || tool.parametersSchema;
|
||||||
const form = document.getElementById('payloadFormContainer');
|
const form = document.getElementById('payloadFormContainer');
|
||||||
form.innerHTML = '';
|
form.innerHTML = '';
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@
|
|||||||
inputHtml = `<input type="text" data-key="${key}" data-type="string" value="${typeof val === 'object' ? JSON.stringify(val).replace(/"/g, '"') : val}" class="bg-[#09090b] border border-[#3f3f46] text-white text-sm rounded p-2 w-full focus:border-blue-500 outline-none">`;
|
inputHtml = `<input type="text" data-key="${key}" data-type="string" value="${typeof val === 'object' ? JSON.stringify(val).replace(/"/g, '"') : val}" class="bg-[#09090b] border border-[#3f3f46] text-white text-sm rounded p-2 w-full focus:border-blue-500 outline-none">`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let reqStar = (schema.required && schema.required.includes(key)) ? '<span class="text-red-500">*</span>' : '';
|
let reqStar = ((tool.inputSchema || tool.parametersSchema)?.required?.includes(key)) ? '<span class="text-red-500">*</span>' : '';
|
||||||
html += `<div class="bg-[#18181b] p-4 rounded-lg border border-[#27272a]">
|
html += `<div class="bg-[#18181b] p-4 rounded-lg border border-[#27272a]">
|
||||||
<label class="block text-sm font-medium text-slate-300 mb-2">${key} ${reqStar} <span class="text-xs text-zinc-500 font-mono font-normal ml-2">${typeLabel}</span></label>
|
<label class="block text-sm font-medium text-slate-300 mb-2">${key} ${reqStar} <span class="text-xs text-zinc-500 font-mono font-normal ml-2">${typeLabel}</span></label>
|
||||||
${inputHtml}
|
${inputHtml}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.HashMap;
|
||||||
import io.shinhanlife.dap.lib.dto.OperationType;
|
import io.shinhanlife.dap.lib.dto.OperationType;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
/**
|
/**
|
||||||
* Tool(Agent)의 명세 및 라우팅 정보를 담고 있는 메타데이터 클래스
|
* Tool(Agent)의 명세 및 라우팅 정보를 담고 있는 메타데이터 클래스
|
||||||
* Redis 레지스트리에 저장되며, Planner와 Router 간의 통신 객체(Plan)로 사용됩니다.
|
* Redis 레지스트리에 저장되며, Planner와 Router 간의 통신 객체(Plan)로 사용됩니다.
|
||||||
@@ -55,6 +57,7 @@ public class ToolMetadata {
|
|||||||
private List<String> requiredEnvKeys;
|
private List<String> requiredEnvKeys;
|
||||||
|
|
||||||
// 2. 파라미터 스키마 (JSON Schema 형태의 Map)
|
// 2. 파라미터 스키마 (JSON Schema 형태의 Map)
|
||||||
|
@JsonProperty("inputSchema")
|
||||||
private Map<String, Object> parametersSchema;
|
private Map<String, Object> parametersSchema;
|
||||||
private Map<String, Object> outputSchema;
|
private Map<String, Object> outputSchema;
|
||||||
|
|
||||||
@@ -143,4 +146,31 @@ public class ToolMetadata {
|
|||||||
if (parametersSchema == null || !parametersSchema.containsKey("required")) return Set.of();
|
if (parametersSchema == null || !parametersSchema.containsKey("required")) return Set.of();
|
||||||
return new HashSet<>((List<String>) parametersSchema.get("required"));
|
return new HashSet<>((List<String>) parametersSchema.get("required"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonProperty("_meta")
|
||||||
|
public Map<String, Object> get_meta() {
|
||||||
|
Map<String, Object> meta = new HashMap<>();
|
||||||
|
meta.put("uid", this.uid);
|
||||||
|
meta.put("semver", this.semver);
|
||||||
|
meta.put("moduleName", this.moduleName);
|
||||||
|
meta.put("categoryKey", this.categoryKey);
|
||||||
|
meta.put("endpoint", this.endpoint);
|
||||||
|
meta.put("podUrl", this.podUrl);
|
||||||
|
meta.put("visible", this.visible);
|
||||||
|
meta.put("enabled", this.enabled);
|
||||||
|
meta.put("isRegistered", this.isRegistered);
|
||||||
|
meta.put("requiresApproval", this.requiresApproval);
|
||||||
|
meta.put("readOnlyHint", this.readOnlyHint);
|
||||||
|
meta.put("destructiveHint", this.destructiveHint);
|
||||||
|
meta.put("idempotentHint", this.idempotentHint);
|
||||||
|
meta.put("openWorldHint", this.openWorldHint);
|
||||||
|
meta.put("integrationType", this.integrationType);
|
||||||
|
meta.put("mciServiceId", this.mciServiceId);
|
||||||
|
meta.put("operationType", this.operationType);
|
||||||
|
meta.put("retryEnabled", this.retryEnabled);
|
||||||
|
meta.put("circuitBreakerFailureThreshold", this.circuitBreakerFailureThreshold);
|
||||||
|
meta.put("circuitBreakerOpenMillis", this.circuitBreakerOpenMillis);
|
||||||
|
meta.put("timeoutMillis", this.timeoutMillis);
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user