forked from kimhyungsik/ax_hub_mcp_tool
refactor: replace MapStruct INSTANCE with Spring DI in SmsLegacyConverter and ToolScaffolder template
This commit is contained in:
@@ -169,6 +169,8 @@ public class ToolScaffolder {
|
|||||||
import %s.annotation.McpTool;
|
import %s.annotation.McpTool;
|
||||||
import %s.dto.%sReq;
|
import %s.dto.%sReq;
|
||||||
import %s.dto.%sRes;
|
import %s.dto.%sRes;
|
||||||
|
import %s.%s.converter.%sLegacyConverter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,12 +188,15 @@ public class ToolScaffolder {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
@McpTool(
|
@McpTool(
|
||||||
routingType = "%s",
|
routingType = "%s",
|
||||||
categoryKey = "%s"
|
categoryKey = "%s"
|
||||||
)
|
)
|
||||||
public class %sService extends AbstractMcpToolService {
|
public class %sService extends AbstractMcpToolService {
|
||||||
|
|
||||||
|
private final %sLegacyConverter converter;
|
||||||
|
|
||||||
@McpFunction(
|
@McpFunction(
|
||||||
displayName = "%s 툴",
|
displayName = "%s 툴",
|
||||||
name = "%s",
|
name = "%s",
|
||||||
@@ -202,19 +207,20 @@ public class ToolScaffolder {
|
|||||||
requiresApproval = false
|
requiresApproval = false
|
||||||
)
|
)
|
||||||
public Object execute(%sReq req) {
|
public Object execute(%sReq req) {
|
||||||
return executeLegacy("%s", "%s", req);
|
// %sLegacyReq legacyReq = converter.toLegacyReq(req);
|
||||||
|
return executeLegacy("%s", "%s", req); // Or pass legacyReq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".formatted(
|
""".formatted(
|
||||||
BASE_PACKAGE,
|
|
||||||
BASE_PACKAGE,
|
|
||||||
BASE_PACKAGE,
|
BASE_PACKAGE,
|
||||||
BASE_PACKAGE, baseName,
|
BASE_PACKAGE, baseName,
|
||||||
BASE_PACKAGE, baseName,
|
BASE_PACKAGE, baseName,
|
||||||
|
BASE_PACKAGE, shortName, baseName,
|
||||||
|
BASE_PACKAGE, baseName,
|
||||||
BASE_PACKAGE, baseName, author, createDate, createDate, author,
|
BASE_PACKAGE, baseName, author, createDate, createDate, author,
|
||||||
routingType, group.toLowerCase(), baseName,
|
routingType, group.toLowerCase(), baseName, baseName,
|
||||||
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
baseName, toolName, description, description + " 해줘.", interfaceId, register,
|
||||||
baseName, routingType, interfaceId
|
baseName, baseName, routingType, interfaceId
|
||||||
);
|
);
|
||||||
|
|
||||||
Files.writeString(serviceDir.resolve(baseName + "Service.java"), serviceContent);
|
Files.writeString(serviceDir.resolve(baseName + "Service.java"), serviceContent);
|
||||||
@@ -304,8 +310,6 @@ public class ToolScaffolder {
|
|||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface %sLegacyConverter {
|
public interface %sLegacyConverter {
|
||||||
|
|
||||||
%sLegacyConverter INSTANCE = Mappers.getMapper(%sLegacyConverter.class);
|
|
||||||
|
|
||||||
// @Mapping(source = "sourceField", target = "targetField")
|
// @Mapping(source = "sourceField", target = "targetField")
|
||||||
%sLegacyReq toLegacyReq(%sReq req);
|
%sLegacyReq toLegacyReq(%sReq req);
|
||||||
|
|
||||||
@@ -318,7 +322,7 @@ public class ToolScaffolder {
|
|||||||
BASE_PACKAGE, shortName, baseName,
|
BASE_PACKAGE, shortName, baseName,
|
||||||
BASE_PACKAGE, shortName, baseName,
|
BASE_PACKAGE, shortName, baseName,
|
||||||
BASE_PACKAGE, shortName, baseName, author, createDate, createDate, author,
|
BASE_PACKAGE, shortName, baseName, author, createDate, createDate, author,
|
||||||
baseName, baseName, baseName, baseName, baseName, baseName, baseName
|
baseName, baseName, baseName, baseName, baseName, baseName
|
||||||
);
|
);
|
||||||
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent);
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import org.mapstruct.factory.Mappers;
|
|||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface SmsLegacyConverter {
|
public interface SmsLegacyConverter {
|
||||||
|
|
||||||
SmsLegacyConverter INSTANCE = Mappers.getMapper(SmsLegacyConverter.class);
|
|
||||||
|
|
||||||
@Mapping(source = "phoneNumber", target = "phone")
|
@Mapping(source = "phoneNumber", target = "phone")
|
||||||
@Mapping(source = "message", target = "content")
|
@Mapping(source = "message", target = "content")
|
||||||
SmsLegacyReqDto toLegacyReq(SmsSendReq req);
|
SmsLegacyReqDto toLegacyReq(SmsSendReq req);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import io.shinhanlife.axhub.biz.mcp.tool.dto.SmsSendReq;
|
|||||||
import io.shinhanlife.axhub.biz.mcp.tool.service.AbstractMcpToolService;
|
import io.shinhanlife.axhub.biz.mcp.tool.service.AbstractMcpToolService;
|
||||||
import io.shinhanlife.axhub.biz.mcp.tool.sms.converter.SmsLegacyConverter;
|
import io.shinhanlife.axhub.biz.mcp.tool.sms.converter.SmsLegacyConverter;
|
||||||
import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsLegacyReqDto;
|
import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsLegacyReqDto;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -25,15 +26,18 @@ import java.util.Map;
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
@McpTool(routingType = "EAI", categoryKey = "notification")
|
@McpTool(routingType = "EAI", categoryKey = "notification")
|
||||||
public class SmsToolService extends AbstractMcpToolService {
|
public class SmsToolService extends AbstractMcpToolService {
|
||||||
|
|
||||||
|
private final SmsLegacyConverter converter;
|
||||||
|
|
||||||
@McpFunction(displayName = "send_sms 툴", name = "send_sms", description = "SMS 발송", prompt = "고객에게 SMS 메시지를 발송해줘.", mappingId = "SMS_SEND_001")
|
@McpFunction(displayName = "send_sms 툴", name = "send_sms", description = "SMS 발송", prompt = "고객에게 SMS 메시지를 발송해줘.", mappingId = "SMS_SEND_001")
|
||||||
public Object sendSms(SmsSendReq req) {
|
public Object sendSms(SmsSendReq req) {
|
||||||
log.info("[SMS] SMS 발송 요청 수신. 수신자: {}", req.getPhoneNumber());
|
log.info("[SMS] SMS 발송 요청 수신. 수신자: {}", req.getPhoneNumber());
|
||||||
|
|
||||||
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
|
// MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO)
|
||||||
SmsLegacyReqDto legacyReq = SmsLegacyConverter.INSTANCE.toLegacyReq(req);
|
SmsLegacyReqDto legacyReq = converter.toLegacyReq(req);
|
||||||
|
|
||||||
// 레거시 시스템 연동 (EAI) - DTO 객체를 그대로 넘김
|
// 레거시 시스템 연동 (EAI) - DTO 객체를 그대로 넘김
|
||||||
Map<String, Object> result = executeLegacy("EAI", "SMS_SEND_001", legacyReq);
|
Map<String, Object> result = executeLegacy("EAI", "SMS_SEND_001", legacyReq);
|
||||||
|
|||||||
39
fix_bugs.py
Normal file
39
fix_bugs.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
# 1. Fix catalog.html JS bug and error box colors
|
||||||
|
catalog_path = r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html"
|
||||||
|
with open(catalog_path, "r", encoding="utf-8") as f:
|
||||||
|
catalog_html = f.read()
|
||||||
|
|
||||||
|
# Remove totalCount reference since we removed the element
|
||||||
|
catalog_html = catalog_html.replace("document.getElementById('totalCount').textContent = Total: ;", "")
|
||||||
|
|
||||||
|
# Fix the error box colors to be dark-theme compatible
|
||||||
|
catalog_html = catalog_html.replace("border-red-200 bg-red-50 text-red-600", "border-red-900 bg-red-950/30 text-red-400")
|
||||||
|
with open(catalog_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write(catalog_html)
|
||||||
|
|
||||||
|
# 2. Fix input field visibility in scaffold.html and playground.html
|
||||||
|
files = [
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html"
|
||||||
|
]
|
||||||
|
|
||||||
|
for fp in files:
|
||||||
|
if not os.path.exists(fp):
|
||||||
|
continue
|
||||||
|
with open(fp, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Enhance input-base visibility
|
||||||
|
content = content.replace("border: 1px solid rgba(255,255,255,0.1);", "border: 1px solid rgba(255,255,255,0.25);\n background-color: rgba(255,255,255,0.05);")
|
||||||
|
content = content.replace("background-color: #18181b;", "") # remove old background
|
||||||
|
|
||||||
|
# In playground.html, also enhance select Tool and textarea
|
||||||
|
# We already updated .input-base, which applies to textarea and select.
|
||||||
|
|
||||||
|
with open(fp, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Bugs and visibility fixed.")
|
||||||
23
fix_links.py
Normal file
23
fix_links.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
files_to_patch = [
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html"
|
||||||
|
]
|
||||||
|
|
||||||
|
for file_path in files_to_patch:
|
||||||
|
if not os.path.exists(file_path):
|
||||||
|
continue
|
||||||
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Fix the links
|
||||||
|
content = content.replace('href="/admin/catalog.html"', 'href="/catalog.html"')
|
||||||
|
content = content.replace('href="/admin/playground.html"', 'href="/playground.html"')
|
||||||
|
content = content.replace('href="/admin/scaffold.html"', 'href="/admin/scaffold.html"') # Keep scaffold as /admin/scaffold.html
|
||||||
|
|
||||||
|
with open(file_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Links fixed.")
|
||||||
37
patch_colors.py
Normal file
37
patch_colors.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
files_to_patch = [
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html"
|
||||||
|
]
|
||||||
|
|
||||||
|
for file_path in files_to_patch:
|
||||||
|
if not os.path.exists(file_path):
|
||||||
|
continue
|
||||||
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Change background and foreground colors in tailwind config
|
||||||
|
content = content.replace("background: '#ffffff',", "background: '#f8fafc',")
|
||||||
|
content = content.replace("foreground: '#000000',", "foreground: '#0f172a',")
|
||||||
|
|
||||||
|
# Add primary colors to tailwind config
|
||||||
|
if "primaryHover: '#4338ca'," not in content:
|
||||||
|
content = content.replace("border: '#e2e8f0',", "border: '#e2e8f0',\n primary: '#4f46e5',\n primaryHover: '#4338ca',")
|
||||||
|
|
||||||
|
# Change btn-black to use primary color (indigo) instead of pure black for primary actions
|
||||||
|
# In scaffold.html, btn-black is used for the generate button. Let's make it btn-primary.
|
||||||
|
content = content.replace(".btn-black {", ".btn-black {\n background-color: theme('colors.primary');")
|
||||||
|
content = content.replace("background-color: #000000;", "")
|
||||||
|
content = content.replace(".btn-black:hover {\n background-color: #333333;\n }", ".btn-black:hover {\n background-color: theme('colors.primaryHover');\n }")
|
||||||
|
|
||||||
|
# Change btn-black references to btn-primary
|
||||||
|
content = content.replace("btn-black", "btn-primary")
|
||||||
|
content = content.replace(".btn-primary {", ".btn-primary {\n color: #ffffff;\n font-weight: 500;\n padding: 0.5rem 1rem;\n border-radius: 4px;\n font-size: 0.875rem;\n transition: background-color 0.15s;\n }")
|
||||||
|
|
||||||
|
with open(file_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Patch applied.")
|
||||||
178
patch_dark_theme.py
Normal file
178
patch_dark_theme.py
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
files = [
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html",
|
||||||
|
r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html"
|
||||||
|
]
|
||||||
|
|
||||||
|
tailwind_and_style = """<script>
|
||||||
|
tailwind.config = {
|
||||||
|
darkMode: 'class',
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
fontFamily: {
|
||||||
|
sans: ['Geist', 'sans-serif'],
|
||||||
|
mono: ['Geist Mono', 'monospace']
|
||||||
|
},
|
||||||
|
colors: {
|
||||||
|
background: '#09090b',
|
||||||
|
panel: '#18181b',
|
||||||
|
foreground: '#f4f4f5',
|
||||||
|
muted: '#a1a1aa',
|
||||||
|
border: 'rgba(255,255,255,0.1)',
|
||||||
|
primary: '#3b82f6',
|
||||||
|
primaryHover: '#2563eb',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: theme('colors.background');
|
||||||
|
color: theme('colors.foreground');
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
.geist-mono { font-family: 'Geist Mono', monospace; }
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(135deg, #3b82f6 0%, #4f46e5 100%);
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
box-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:disabled {
|
||||||
|
background: #27272a;
|
||||||
|
color: #71717a;
|
||||||
|
box-shadow: none;
|
||||||
|
border-color: transparent;
|
||||||
|
transform: none;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-base {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
background-color: #18181b;
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #f4f4f5;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-base:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #3b82f6;
|
||||||
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
select.input-base {
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
|
||||||
|
background-position: right 0.5rem center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 1.5em 1.5em;
|
||||||
|
padding-right: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-panel {
|
||||||
|
background: #18181b;
|
||||||
|
border: 1px solid theme('colors.border');
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For catalog schema / playground output */
|
||||||
|
pre {
|
||||||
|
background-color: #09090b !important;
|
||||||
|
border: 1px solid rgba(255,255,255,0.05);
|
||||||
|
}
|
||||||
|
</style>"""
|
||||||
|
|
||||||
|
for fp in files:
|
||||||
|
if not os.path.exists(fp):
|
||||||
|
continue
|
||||||
|
with open(fp, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# 1. Replace tailwind config and style
|
||||||
|
content = re.sub(r'<script>\s*tailwind\.config = \{.*?</style>', tailwind_and_style, content, flags=re.DOTALL)
|
||||||
|
|
||||||
|
# 2. Add class="dark" to html tag if not present
|
||||||
|
content = re.sub(r'<html lang="ko">', '<html lang="ko" class="dark">', content)
|
||||||
|
|
||||||
|
# 3. Fix colors in the HTML body
|
||||||
|
# Replace background colors
|
||||||
|
content = content.replace("bg-white", "bg-zinc-900")
|
||||||
|
content = content.replace("bg-slate-50", "bg-zinc-950")
|
||||||
|
content = content.replace("bg-slate-100", "bg-zinc-800")
|
||||||
|
content = content.replace("bg-slate-200", "bg-zinc-700")
|
||||||
|
content = content.replace("bg-gray-50", "bg-zinc-900")
|
||||||
|
content = content.replace("bg-gray-100", "bg-zinc-800")
|
||||||
|
|
||||||
|
# Replace text colors
|
||||||
|
content = content.replace("text-black", "text-zinc-100")
|
||||||
|
content = content.replace("text-slate-900", "text-zinc-100")
|
||||||
|
content = content.replace("text-slate-800", "text-zinc-200")
|
||||||
|
content = content.replace("text-slate-600", "text-zinc-400")
|
||||||
|
content = content.replace("text-slate-500", "text-zinc-400")
|
||||||
|
content = content.replace("text-gray-900", "text-zinc-100")
|
||||||
|
content = content.replace("text-gray-800", "text-zinc-200")
|
||||||
|
content = content.replace("text-gray-600", "text-zinc-400")
|
||||||
|
content = content.replace("text-gray-500", "text-zinc-400")
|
||||||
|
content = content.replace("text-gray-400", "text-zinc-500")
|
||||||
|
|
||||||
|
# Replace borders
|
||||||
|
content = content.replace("border-slate-200", "border-white/10")
|
||||||
|
content = content.replace("border-slate-300", "border-white/20")
|
||||||
|
content = content.replace("border-gray-200", "border-white/10")
|
||||||
|
content = content.replace("border-gray-300", "border-white/20")
|
||||||
|
content = content.replace("border-border", "border-white/10")
|
||||||
|
|
||||||
|
# Update Header to match index.html
|
||||||
|
header_html = """<header class="border-b border-white/10 sticky top-0 bg-[#09090b]/80 backdrop-blur-xl z-50">
|
||||||
|
<div class="max-w-6xl mx-auto px-6 h-14 flex items-center justify-between">
|
||||||
|
<div class="flex items-center space-x-5">
|
||||||
|
<a href="/index.html" class="flex items-center group">
|
||||||
|
<div class="w-2 h-2 rounded-full bg-blue-500 shadow-[0_0_8px_rgba(59,130,246,0.8)] mr-2 group-hover:shadow-[0_0_12px_rgba(59,130,246,1)] transition-all"></div>
|
||||||
|
<span class="font-semibold tracking-tight text-sm text-zinc-100 group-hover:text-white">AXHUB Gateway</span>
|
||||||
|
</a>
|
||||||
|
<div class="h-4 w-px bg-white/10"></div>
|
||||||
|
<nav class="flex space-x-5 text-[13px] font-medium">
|
||||||
|
<a href="/admin/scaffold.html" class="text-zinc-400 hover:text-white transition-colors">Scaffold</a>
|
||||||
|
<a href="/catalog.html" class="text-zinc-400 hover:text-white transition-colors">Catalog</a>
|
||||||
|
<a href="/playground.html" class="text-zinc-400 hover:text-white transition-colors">Playground</a>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class="text-[10px] uppercase tracking-widest bg-blue-500/10 text-blue-400 px-2 py-1 rounded font-bold border border-blue-500/20">v0.0.1</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>"""
|
||||||
|
|
||||||
|
content = re.sub(r'<header.*?</header>', header_html, content, flags=re.DOTALL)
|
||||||
|
|
||||||
|
# In playground.html, fix the text area and json output styling
|
||||||
|
if "playground.html" in fp:
|
||||||
|
content = content.replace('bg-slate-50', 'bg-[#09090b]')
|
||||||
|
|
||||||
|
with open(fp, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Dark theme applied.")
|
||||||
19
patch_htmls.py
Normal file
19
patch_htmls.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
base_dir = r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static"
|
||||||
|
|
||||||
|
files_to_patch = ["index.html", "playground.html"]
|
||||||
|
for f in files_to_patch:
|
||||||
|
path = os.path.join(base_dir, f)
|
||||||
|
with open(path, "r", encoding="utf-8") as file:
|
||||||
|
content = file.read()
|
||||||
|
content = content.replace("tool.toolName", "tool.name")
|
||||||
|
with open(path, "w", encoding="utf-8") as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
catalog_path = os.path.join(base_dir, "catalog.html")
|
||||||
|
with open(catalog_path, "r", encoding="utf-8") as file:
|
||||||
|
catalog_content = file.read()
|
||||||
|
catalog_content = catalog_content.replace("${tool.name}", "${tool.displayName} <span class=\"text-xs text-slate-500 font-mono\">(${tool.name})</span>")
|
||||||
|
with open(catalog_path, "w", encoding="utf-8") as file:
|
||||||
|
file.write(catalog_content)
|
||||||
|
print("Done")
|
||||||
13
patch_htmls_group.py
Normal file
13
patch_htmls_group.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import os
|
||||||
|
base_dir = r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static"
|
||||||
|
|
||||||
|
files_to_patch = ["index.html", "playground.html"]
|
||||||
|
for f in files_to_patch:
|
||||||
|
path = os.path.join(base_dir, f)
|
||||||
|
with open(path, "r", encoding="utf-8") as file:
|
||||||
|
content = file.read()
|
||||||
|
content = content.replace("tool.domainGroup", "tool.categoryKey")
|
||||||
|
with open(path, "w", encoding="utf-8") as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
print("Done")
|
||||||
61
patch_tool_controller.py
Normal file
61
patch_tool_controller.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
file_path = r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-tool-core\src\main\java\io\shinhanlife\axhub\biz\mcp\tool\presentation\BusinessToolController.java"
|
||||||
|
|
||||||
|
with open(file_path, "r", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
old_block = """ Map<String, Object> innerResult = new HashMap<>();
|
||||||
|
if (methodResult instanceof Map) {
|
||||||
|
innerResult.putAll((Map<String, Object>) methodResult);
|
||||||
|
}
|
||||||
|
if (!innerResult.containsKey("contracts")) {
|
||||||
|
List<Object> contracts = new ArrayList<>();
|
||||||
|
if (methodResult != null) {
|
||||||
|
contracts.add(methodResult);
|
||||||
|
}
|
||||||
|
innerResult.put("contracts", contracts);
|
||||||
|
}"""
|
||||||
|
|
||||||
|
new_block = """ Map<String, Object> innerResult = new HashMap<>();
|
||||||
|
if (methodResult instanceof Map && ((Map<?, ?>) methodResult).containsKey("contracts")) {
|
||||||
|
innerResult.putAll((Map<String, Object>) methodResult);
|
||||||
|
} else {
|
||||||
|
List<Object> contracts = new ArrayList<>();
|
||||||
|
if (methodResult != null) {
|
||||||
|
contracts.add(methodResult);
|
||||||
|
}
|
||||||
|
innerResult.put("contracts", contracts);
|
||||||
|
|
||||||
|
if (methodResult instanceof Map && ((Map<?, ?>) methodResult).containsKey("status")) {
|
||||||
|
innerResult.put("status", ((Map<?, ?>) methodResult).get("status"));
|
||||||
|
} else {
|
||||||
|
innerResult.put("status", "SUCCESS");
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
|
||||||
|
old_size = 'resultPayload.put("original_size", 0);'
|
||||||
|
|
||||||
|
new_size = """ int originalSize = 0;
|
||||||
|
try {
|
||||||
|
if (methodResult instanceof Map && ((Map<?, ?>) methodResult).containsKey("legacy_response")) {
|
||||||
|
Object legacyResp = ((Map<?, ?>) methodResult).get("legacy_response");
|
||||||
|
if (legacyResp instanceof String) {
|
||||||
|
originalSize = ((String) legacyResp).getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String jsonStr = objectMapper.writeValueAsString(innerResult);
|
||||||
|
originalSize = jsonStr.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Failed to calculate original_size", e);
|
||||||
|
}
|
||||||
|
resultPayload.put("original_size", originalSize);"""
|
||||||
|
|
||||||
|
content = content.replace(old_block, new_block)
|
||||||
|
content = content.replace(old_size, new_size)
|
||||||
|
|
||||||
|
with open(file_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Patch applied to BusinessToolController.java")
|
||||||
24
send_email.py
Normal file
24
send_email.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import urllib.request
|
||||||
|
import json
|
||||||
|
|
||||||
|
url = "http://localhost:8281/mcp/api/v1/tools/call"
|
||||||
|
data = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1,
|
||||||
|
"method": "tools/call",
|
||||||
|
"params": {
|
||||||
|
"name": "send_email",
|
||||||
|
"arguments": {
|
||||||
|
"emailAddress": "kimhs@shinhanlife.io",
|
||||||
|
"subject": "AX HUB MCP 연동 테스트 메일",
|
||||||
|
"body": "안녕하세요 김형식님, AI 어시스턴트가 정상적으로 연동되어 발송하는 테스트 이메일입니다."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req = urllib.request.Request(url, data=json.dumps(data).encode('utf-8'), headers={'Content-Type': 'application/json'})
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(req) as response:
|
||||||
|
print(response.read().decode('utf-8'))
|
||||||
|
except urllib.error.URLError as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
Reference in New Issue
Block a user