cambios mcp remoto
This commit is contained in:
@@ -6,12 +6,13 @@ import { withAuth } from "../../auth/index.js";
|
||||
import { handleToolError } from "../helpers/errorHandler.js";
|
||||
import { withAuthParams } from "../helpers/authSchema.js";
|
||||
import { pythonPost } from "../helpers/pythonServerClient.js";
|
||||
import { resolveCurrentProjectDir } from "../files/helpers.js";
|
||||
|
||||
// --- Verificacion de creditos ---
|
||||
const WS_BASE = "https://ws.cocosolution.com/api/handler_acaicode.php";
|
||||
|
||||
function getAcaiToken() {
|
||||
const projectDir = process.env.ACAI_PROJECT_DIR || "";
|
||||
const projectDir = resolveCurrentProjectDir();
|
||||
if (!projectDir) return null;
|
||||
try {
|
||||
const acaiFile = path.join(projectDir, ".acai");
|
||||
@@ -56,7 +57,7 @@ export function registerGenerateImageTool(server) {
|
||||
};
|
||||
}
|
||||
|
||||
const projectSlug = path.basename(process.env.ACAI_PROJECT_DIR || "");
|
||||
const projectSlug = path.basename(resolveCurrentProjectDir());
|
||||
const safeFileName = fileName || `generated-${Date.now()}`;
|
||||
const destRelativePath = `cms/uploads/generated/${safeFileName}.jpg`;
|
||||
const fullPrompt = style ? `${style} style: ${prompt}` : prompt;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { handleToolError, validateRequired, handleApiResponse } from "../helpers
|
||||
import { withAuthParams } from "../helpers/authSchema.js";
|
||||
import { AcaiHttpClient } from "../helpers/acaiHttpClient.js";
|
||||
import { pythonPost } from "../helpers/pythonServerClient.js";
|
||||
import { resolveCurrentProjectDir } from "../files/helpers.js";
|
||||
|
||||
/**
|
||||
* Helper: POST to mcp_respond.php via viewer_functions.php
|
||||
@@ -78,7 +79,7 @@ async function resolveLocalImageAsBase64(imageUrl) {
|
||||
}
|
||||
|
||||
// Intento B: resolver el pathname contra ACAI_PROJECT_DIR y leer del disco
|
||||
const projectDir = process.env.ACAI_PROJECT_DIR || "";
|
||||
const projectDir = resolveCurrentProjectDir();
|
||||
if (projectDir && parsed.pathname) {
|
||||
try {
|
||||
const localPath = path.join(projectDir, parsed.pathname);
|
||||
@@ -118,7 +119,7 @@ export function registerUploadRecordImageTool(server) {
|
||||
);
|
||||
if (validationError) return validationError;
|
||||
|
||||
const projectSlug = path.basename(process.env.ACAI_PROJECT_DIR || "");
|
||||
const projectSlug = path.basename(resolveCurrentProjectDir());
|
||||
|
||||
// Intentar via Python server (tiene sync + optimizacion)
|
||||
let result;
|
||||
|
||||
Reference in New Issue
Block a user