{
- if (item.type === 'file' || safeLinkUrl(item.url)) {
- let fileId = item?.id ?? item?.tempId;
- window.open(
- item.type === 'file'
- ? item?.url?.startsWith('http')
- ? item.url
- : `${WEBUI_API_BASE_URL}/files/${fileId}/content`
- : item.url,
- '_blank'
- );
- }
- }}
>
{item?.name ?? 'File'}
diff --git a/src/lib/components/common/diffEditor.ts b/src/lib/components/common/diffEditor.ts
index 699853e48a..c1519c6b73 100644
--- a/src/lib/components/common/diffEditor.ts
+++ b/src/lib/components/common/diffEditor.ts
@@ -67,6 +67,22 @@ export function copyChunk(a: Text, b: Text, chunk: Chunk, direction: MergeDirect
return { from, to: Math.min(to, destination.length), insert };
}
+export function keepBothChunk(a: Text, b: Text, chunk: Chunk): ChangeSpec | null {
+ // A line-aligned chunk can include text on both sides even for a pure EOF insertion.
+ if (
+ !chunk.changes.some((change) => change.fromA < change.toA) ||
+ !chunk.changes.some((change) => change.fromB < change.toB)
+ )
+ return null;
+ const original = a.sliceString(chunk.fromA, Math.min(chunk.toA, a.length));
+ const proposed = b.sliceString(chunk.fromB, Math.min(chunk.toB, b.length));
+ return {
+ from: chunk.fromB,
+ to: Math.min(chunk.toB, b.length),
+ insert: original + (original.endsWith('\n') ? '' : '\n') + proposed
+ };
+}
+
export function selectedChunk(chunks: readonly Chunk[], side: 'a' | 'b', position: number) {
return chunks.findIndex((chunk) => {
const from = side === 'a' ? chunk.fromA : chunk.fromB;
diff --git a/src/lib/components/layout/Sidebar/ChatItem.svelte b/src/lib/components/layout/Sidebar/ChatItem.svelte
index 4b6cf6b2fd..675082cf4c 100644
--- a/src/lib/components/layout/Sidebar/ChatItem.svelte
+++ b/src/lib/components/layout/Sidebar/ChatItem.svelte
@@ -673,7 +673,7 @@
}}
>
+ let closeActiveHoverPreview = null;
+
+