mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
fix(onboarding): preserve emoji in recommendation reasons (#110401)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -170,7 +170,7 @@ describe("setup app recommendation matcher", () => {
|
||||
});
|
||||
|
||||
it("tolerates fenced JSON with extra keys and long reasons", async () => {
|
||||
const reason = `useful ${"very ".repeat(40)}integration`;
|
||||
const reason = `${"a".repeat(118)}🤖suffix`;
|
||||
const result = await getSetupAppRecommendations({
|
||||
inventorySource,
|
||||
runtime: defaultRuntime,
|
||||
@@ -200,6 +200,7 @@ describe("setup app recommendation matcher", () => {
|
||||
expect(result.status).toBe("ok");
|
||||
if (result.status === "ok") {
|
||||
expect(result.matches[0]?.candidateId).toBe("notes-tools");
|
||||
expect(result.matches[0]?.reason).toBe(`${"a".repeat(118)}…`);
|
||||
expect(result.matches[0]?.reason.length).toBeLessThanOrEqual(120);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
|
||||
import pLimit from "p-limit";
|
||||
import { z } from "zod";
|
||||
import { searchClawHubSkills } from "../infra/clawhub.js";
|
||||
@@ -79,7 +80,7 @@ const MatcherOutputSchema = z.object({
|
||||
.string()
|
||||
.trim()
|
||||
.min(1)
|
||||
.transform((value) => (value.length > 120 ? `${value.slice(0, 119)}…` : value)),
|
||||
.transform((value) => (value.length > 120 ? `${truncateUtf16Safe(value, 119)}…` : value)),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user