diff --git a/packages/web-app-chat-with-file/src/components/ChatPanel.vue b/packages/web-app-chat-with-file/src/components/ChatPanel.vue
index 647278626..29bfa5a13 100644
--- a/packages/web-app-chat-with-file/src/components/ChatPanel.vue
+++ b/packages/web-app-chat-with-file/src/components/ChatPanel.vue
@@ -48,14 +48,30 @@
}}
-
+
{{ diffPrefix(line.type) }}{{ line.text }}
-
+ class="diff-block"
+ :class="{ 'diff-block--tall': isDiffHeightExpanded(index) }"
+ >
+
{{ diffPrefix(line.type) }}{{ line.text }}
+
+
+
{{ $gettext('No changes detected.') }}
@@ -239,6 +255,24 @@ function getDiff(index: number): FlatLine[] {
return messageDiffs.value[index] ?? []
}
+const DIFF_LONG_THRESHOLD = 12
+
+function isDiffLong(index: number): boolean {
+ return getDiff(index).length > DIFF_LONG_THRESHOLD
+}
+
+const expandedDiffHeights = ref([])
+
+function isDiffHeightExpanded(index: number): boolean {
+ return expandedDiffHeights.value.includes(index)
+}
+
+function toggleDiffHeight(index: number): void {
+ expandedDiffHeights.value = isDiffHeightExpanded(index)
+ ? expandedDiffHeights.value.filter((i) => i !== index)
+ : [...expandedDiffHeights.value, index]
+}
+
const expandedDiffs = ref([])
function isDiffExpanded(index: number): boolean {
@@ -283,6 +317,7 @@ watch(
if (newId && oldId && newId !== oldId) {
mode.value = 'chat'
diffCache.clear()
+ expandedDiffHeights.value = []
}
}
)
@@ -388,6 +423,27 @@ onMounted(() => {
overflow-y: auto;
}
+.diff-block--tall {
+ max-height: 600px;
+}
+
+.diff-height-toggle {
+ display: block;
+ width: 100%;
+ background: none;
+ border: none;
+ cursor: pointer;
+ font-size: 0.75rem;
+ font-family: inherit;
+ color: var(--oc-color-swatch-primary-default, #0d6efd);
+ padding: 4px 0;
+ text-align: center;
+}
+
+.diff-height-toggle:hover {
+ text-decoration: underline;
+}
+
.diff-line {
display: block;
white-space: pre;