diff --git a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue
index 584fe07..cbc73d6 100644
--- a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue
+++ b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue
@@ -1,23 +1,20 @@
-
-
-
-
-
- {{ entry.value }}
-
-
-
-
- {{ formatLeafValue(item) }}
-
+
+
+
+ {{ entry.value }}
+
+
+
+
+ {{ formatLeafValue(item) }}
-
+
@@ -36,9 +33,7 @@ const props = defineProps({
},
});
-const CONTENT_BODY_KEY = "content_body";
-const HIDDEN_CONTENT_BODY_KEYS = ["container_type"];
-const IGNORED_FIELD_KEYS = ["container_type"];
+const IGNORED_FIELD_KEYS = ["container_type", "content", "components"];
const isArrayValue = (value) => Array.isArray(value);
@@ -52,7 +47,7 @@ const sanitizeValue = (value) => {
}
if (isObjectValue(value)) {
return Object.keys(value).reduce((result, key) => {
- if (HIDDEN_CONTENT_BODY_KEYS.includes(key)) return result;
+ if (IGNORED_FIELD_KEYS.includes(key)) return result;
result[key] = sanitizeValue(value[key]);
return result;
}, {});
@@ -60,6 +55,17 @@ const sanitizeValue = (value) => {
return value;
};
+const hasDisplayValue = (value) => {
+ if (value === undefined || value === null) return false;
+ if (typeof value === "string") return !!value.trim();
+ if (isArrayValue(value)) return value.some((item) => hasDisplayValue(item));
+ if (isObjectValue(value)) {
+ const valueObj = sanitizeValue(value);
+ return Object.keys(valueObj).some((key) => hasDisplayValue(valueObj[key]));
+ }
+ return true;
+};
+
const formatLeafValue = (value) => {
if (value === undefined || value === null) return "";
if (typeof value === "boolean") return value ? "是" : "否";
@@ -73,35 +79,47 @@ const formatLeafValue = (value) => {
return String(value);
};
-const isContentBody = computed(() => props.fieldKey === CONTENT_BODY_KEY);
-const isIgnoredField = computed(() => IGNORED_FIELD_KEYS.includes(props.fieldKey));
+const renderFieldEntries = computed(() => {
+ if (isIgnoredField.value || !hasDisplayValue(props.value)) return [];
-const renderContentBodyEntries = computed(() => {
- if (!isContentBody.value || !isObjectValue(props.value)) return [];
+ const value = sanitizeValue(props.value);
+ if (isArrayValue(value)) {
+ return [{
+ key: props.fieldKey,
+ type: "list",
+ value: value.filter((item) => hasDisplayValue(item)),
+ }];
+ }
- return Object.keys(props.value)
- .filter((key) => !HIDDEN_CONTENT_BODY_KEYS.includes(key))
- .map((key) => {
- const value = props.value[key];
- if (isArrayValue(value)) {
+ if (isObjectValue(value)) {
+ return Object.keys(value)
+ .filter((key) => hasDisplayValue(value[key]))
+ .map((key) => {
+ const entryValue = value[key];
+ if (isArrayValue(entryValue)) {
+ return {
+ key,
+ type: "list",
+ value: entryValue.filter((item) => hasDisplayValue(item)),
+ };
+ }
return {
key,
- type: "list",
- value: value.filter((item) => formatLeafValue(item)),
+ type: "text",
+ value: formatLeafValue(entryValue),
};
- }
- return {
- key,
- type: "text",
- value: formatLeafValue(value),
- };
- })
- .filter((entry) => {
- if (entry.type === "list") return entry.value.length > 0;
- return !!entry.value;
- });
+ });
+ }
+
+ return [{
+ key: props.fieldKey,
+ type: "text",
+ value: formatLeafValue(value),
+ }];
});
+const isIgnoredField = computed(() => IGNORED_FIELD_KEYS.includes(props.fieldKey));
+const shouldRenderField = computed(() => renderFieldEntries.value.length > 0);
diff --git a/src/static/scss/flex.scss b/src/static/scss/flex.scss
index 7875f82..06c61e4 100644
--- a/src/static/scss/flex.scss
+++ b/src/static/scss/flex.scss
@@ -37,28 +37,4 @@
.flex-shrink-0 {
flex-shrink: 0;
-}
-
-.gap-6 {
- gap: 6px;
-}
-
-.gap-8 {
- gap: 8px;
-}
-
-.gap-10 {
- gap: 10px;
-}
-
-.gap-12 {
- gap: 12px;
-}
-
-.gap-14 {
- gap: 14px;
-}
-
-.gap-16 {
- gap: 16px;
-}
+}
\ No newline at end of file
diff --git a/src/static/scss/gap.scss b/src/static/scss/gap.scss
new file mode 100644
index 0000000..917bf54
--- /dev/null
+++ b/src/static/scss/gap.scss
@@ -0,0 +1,35 @@
+.gap-2 {
+ gap: 2px;
+}
+
+.gap-4 {
+ gap: 4px;
+}
+
+.gap-6 {
+ gap: 6px;
+}
+
+.gap-8 {
+ gap: 8px;
+}
+
+.gap-10 {
+ gap: 10px;
+}
+
+.gap-12 {
+ gap: 12px;
+}
+
+.gap-16 {
+ gap: 16px;
+}
+
+.gap-20 {
+ gap: 20px;
+}
+
+.gap-24 {
+ gap: 24px;
+}
diff --git a/src/static/scss/index.scss b/src/static/scss/index.scss
index 1538b4e..fda91b9 100644
--- a/src/static/scss/index.scss
+++ b/src/static/scss/index.scss
@@ -23,3 +23,4 @@
@import "./word-break.scss";
@import "./min-height.scss";
@import "./min-width.scss";
+@import "./gap.scss";
diff --git a/src/utils/longTextCard.js b/src/utils/longTextCard.js
index 3ba03be..2d4bb94 100644
--- a/src/utils/longTextCard.js
+++ b/src/utils/longTextCard.js
@@ -1,7 +1,35 @@
export const LONG_TEXT_KEYS = {
+ containerType: "container_type",
tag: "tag",
title: "title",
content: "content",
+ guideConclusion: "guide_conclusion",
+ keyFacts: "key_facts",
+ sceneImage: "scene_image",
+ checklistOrSteps: "checklist_or_steps",
+ bestTimeOrPeople: "best_time_or_people",
+ avoidPitfalls: "avoid_pitfalls",
+ nextSuggestion: "next_suggestion",
+ poiDefinition: "poi_definition",
+ keyHighlights: "key_highlights",
+ heroImage: "hero_image",
+ backgroundStory: "background_story",
+ bestTime: "best_time",
+ visitSuggestion: "visit_suggestion",
+ routeSummary: "route_summary",
+ routeMeta: "route_meta",
+ routeSteps: "route_steps",
+ onsiteClues: "onsite_clues",
+ realtimeNotice: "realtime_notice",
+ routeWarning: "route_warning",
+ arrivalNextStep: "arrival_next_step",
+ photoConclusion: "photo_conclusion",
+ photoSpots: "photo_spots",
+ compositionTips: "composition_tips",
+ phoneSettings: "phone_settings",
+ lightReminder: "light_reminder",
+ sampleImage: "sample_image",
+ components: "components",
checklist: "checklist",
suggest: "suggest",
commodity: "commodity",
@@ -9,9 +37,37 @@ export const LONG_TEXT_KEYS = {
};
export const LONG_TEXT_FIELD_CONFIG = [
+ { key: LONG_TEXT_KEYS.containerType },
{ key: LONG_TEXT_KEYS.tag },
{ key: LONG_TEXT_KEYS.title },
{ key: LONG_TEXT_KEYS.content },
+ { key: LONG_TEXT_KEYS.guideConclusion },
+ { key: LONG_TEXT_KEYS.keyFacts },
+ { key: LONG_TEXT_KEYS.sceneImage },
+ { key: LONG_TEXT_KEYS.checklistOrSteps },
+ { key: LONG_TEXT_KEYS.bestTimeOrPeople },
+ { key: LONG_TEXT_KEYS.avoidPitfalls },
+ { key: LONG_TEXT_KEYS.nextSuggestion },
+ { key: LONG_TEXT_KEYS.poiDefinition },
+ { key: LONG_TEXT_KEYS.keyHighlights },
+ { key: LONG_TEXT_KEYS.heroImage },
+ { key: LONG_TEXT_KEYS.backgroundStory },
+ { key: LONG_TEXT_KEYS.bestTime },
+ { key: LONG_TEXT_KEYS.visitSuggestion },
+ { key: LONG_TEXT_KEYS.routeSummary },
+ { key: LONG_TEXT_KEYS.routeMeta },
+ { key: LONG_TEXT_KEYS.routeSteps },
+ { key: LONG_TEXT_KEYS.onsiteClues },
+ { key: LONG_TEXT_KEYS.realtimeNotice },
+ { key: LONG_TEXT_KEYS.routeWarning },
+ { key: LONG_TEXT_KEYS.arrivalNextStep },
+ { key: LONG_TEXT_KEYS.photoConclusion },
+ { key: LONG_TEXT_KEYS.photoSpots },
+ { key: LONG_TEXT_KEYS.compositionTips },
+ { key: LONG_TEXT_KEYS.phoneSettings },
+ { key: LONG_TEXT_KEYS.lightReminder },
+ { key: LONG_TEXT_KEYS.sampleImage },
+ { key: LONG_TEXT_KEYS.components },
{ key: LONG_TEXT_KEYS.checklist },
{ key: LONG_TEXT_KEYS.suggest },
{ key: LONG_TEXT_KEYS.commodity },