fix: restore sku goods info display
This commit is contained in:
parent
8e225e9ae1
commit
dc1665d7ba
@ -1,4 +1,5 @@
|
||||
import { generateText } from "ai";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { createCipheriv, createHash } from "node:crypto";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
@ -87,13 +88,42 @@ function createGoodsInfoSignature(timespan: string, secret: string) {
|
||||
throw new Error("商品信息接口 Secret 长度必须为 8 位");
|
||||
}
|
||||
|
||||
const cipher = createCipheriv("des-cbc", secretBuffer, secretBuffer);
|
||||
cipher.setAutoPadding(true);
|
||||
const encrypted = Buffer.concat([
|
||||
cipher.update(String(timespan || "").trim(), "utf8"),
|
||||
cipher.final(),
|
||||
]);
|
||||
const encryptedHex = encrypted.toString("hex").toUpperCase();
|
||||
const plaintext = String(timespan || "").trim();
|
||||
let encryptedHex = "";
|
||||
|
||||
try {
|
||||
const cipher = createCipheriv("des-cbc", secretBuffer, secretBuffer);
|
||||
cipher.setAutoPadding(true);
|
||||
const encrypted = Buffer.concat([
|
||||
cipher.update(plaintext, "utf8"),
|
||||
cipher.final(),
|
||||
]);
|
||||
encryptedHex = encrypted.toString("hex").toUpperCase();
|
||||
} catch (error) {
|
||||
const opensslOutput = execFileSync(
|
||||
"openssl",
|
||||
[
|
||||
"enc",
|
||||
"-des-cbc",
|
||||
"-provider",
|
||||
"legacy",
|
||||
"-K",
|
||||
secretBuffer.toString("hex"),
|
||||
"-iv",
|
||||
secretBuffer.toString("hex"),
|
||||
"-nosalt",
|
||||
],
|
||||
{
|
||||
input: Buffer.from(plaintext, "utf8"),
|
||||
}
|
||||
);
|
||||
encryptedHex = Buffer.from(opensslOutput).toString("hex").toUpperCase();
|
||||
console.warn(
|
||||
"[Agent Workflow Material Search] Fallback to openssl legacy DES for goods info signature:",
|
||||
error instanceof Error ? error.message : error
|
||||
);
|
||||
}
|
||||
|
||||
return createHash("md5").update(encryptedHex, "utf8").digest("hex").toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
@ -641,28 +641,6 @@ export function AgentWorkflowPanelDarkV2({
|
||||
))
|
||||
)}
|
||||
|
||||
{/* 当前选择摘要 */}
|
||||
{summary.length > 0 && (
|
||||
<motion.section
|
||||
className="rounded-2xl border border-white/12 bg-white/[0.04] p-5 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
>
|
||||
<h3 className="mb-4 text-sm font-semibold text-white/80">当前选择</h3>
|
||||
<div className="grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3">
|
||||
{summary.map((item) => (
|
||||
<div
|
||||
key={`${item.stepKey}-${item.optionKey}`}
|
||||
className="flex items-center justify-between rounded-xl border border-white/10 bg-black/20 px-4 py-3"
|
||||
>
|
||||
<span className="text-sm text-white/50">{item.stepTitle}</span>
|
||||
<span className="text-sm font-medium text-white">{item.optionName}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</motion.section>
|
||||
)}
|
||||
|
||||
{/* Prompt 预览 */}
|
||||
<motion.section
|
||||
className="rounded-2xl border border-white/10 bg-white/[0.035] p-5 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user