Skip to content

Commit 4cb39bc

Browse files
authored
fix chat issue and change view icon (#5525)
1 parent 4e35747 commit 4cb39bc

File tree

6 files changed

+57
-14
lines changed

6 files changed

+57
-14
lines changed

backend/onyx/agents/agent_search/dr/nodes/dr_a0_clarification.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,16 @@ def clarifier(
643643
datetime_aware=True,
644644
)
645645

646-
system_prompt_to_use = build_citations_system_message(
646+
system_prompt_to_use_content = build_citations_system_message(
647647
prompt_config
648648
).content
649+
system_prompt_to_use: str = cast(str, system_prompt_to_use_content)
650+
if graph_config.inputs.project_instructions:
651+
system_prompt_to_use = (
652+
system_prompt_to_use
653+
+ PROJECT_INSTRUCTIONS_SEPARATOR
654+
+ graph_config.inputs.project_instructions
655+
)
649656
user_prompt_to_use = build_citations_user_message(
650657
user_query=original_question,
651658
files=[],

backend/onyx/chat/process_message.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,8 @@ def stream_chat_message_objects(
503503
for fd in new_msg_req.current_message_files:
504504
uid = fd.get("user_file_id")
505505
if uid is not None:
506-
user_file_ids.append(uid)
506+
user_file_id = UUID(uid)
507+
user_file_ids.append(user_file_id)
507508

508509
# Load in user files into memory and create search tool override kwargs if needed
509510
# if we have enough tokens, we don't need to use search

backend/onyx/file_store/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import base64
22
from enum import Enum
33
from typing import NotRequired
4-
from uuid import UUID
54
from typing_extensions import TypedDict # noreorder
65

76
from pydantic import BaseModel
@@ -36,7 +35,7 @@ class FileDescriptor(TypedDict):
3635
id: str
3736
type: ChatFileType
3837
name: NotRequired[str | None]
39-
user_file_id: NotRequired[UUID | None]
38+
user_file_id: NotRequired[str | None]
4039

4140

4241
class InMemoryChatFile(BaseModel):
@@ -58,5 +57,5 @@ def to_file_descriptor(self) -> FileDescriptor:
5857
"id": str(self.file_id),
5958
"type": self.file_type,
6059
"name": self.filename,
61-
"user_file_id": UUID(str(self.file_id)) if self.file_id else None,
60+
"user_file_id": str(self.file_id) if self.file_id else None,
6261
}

web/src/app/chat/components/files/FilePicker.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
} from "@/components/ui/menubar";
1111
import { FileUploadIcon } from "@/components/icons/icons";
1212
import { Files } from "@phosphor-icons/react";
13-
import { FileIcon, Paperclip, Loader2, Eye } from "lucide-react";
13+
import { FileIcon, Paperclip, Loader2 } from "lucide-react";
14+
import { OpenInNewIcon } from "@/components/icons/CustomIcons";
1415
import { cn } from "@/lib/utils";
1516
import { ChatInputOption } from "../input/ChatInputOption";
1617
import FilesList from "./FilesList";
@@ -149,7 +150,10 @@ export default function FilePicker({
149150
onFileClick && onFileClick(f);
150151
}}
151152
>
152-
<Eye className="h-4 w-4 text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-200" />
153+
<OpenInNewIcon
154+
size={16}
155+
className="text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-200"
156+
/>
153157
</button>
154158
)}
155159
</div>
@@ -191,14 +195,14 @@ export default function FilePicker({
191195

192196
<Dialog open={showRecentFiles} onOpenChange={setShowRecentFiles}>
193197
<DialogContent
194-
className="w-full max-w-lg focus:outline-none focus-visible:outline-none"
198+
className="w-full max-w-lg px-6 py-3 sm:px-6 sm:py-4 focus:outline-none focus-visible:outline-none"
195199
tabIndex={-1}
196200
onOpenAutoFocus={(e) => {
197201
// Prevent auto-focus which can interfere with input
198202
e.preventDefault();
199203
}}
200204
>
201-
<DialogHeader>
205+
<DialogHeader className="px-0 pt-0 pb-2">
202206
<Files size={32} />
203207
<DialogTitle>Recent Files</DialogTitle>
204208
</DialogHeader>

web/src/app/chat/components/files/FilesList.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import React, { useMemo, useRef, useState, useEffect } from "react";
44
import { Input } from "@/components/ui/input";
55
import { ScrollArea } from "@/components/ui/scroll-area";
66
import { Separator } from "@/components/ui/separator";
7-
import { Search, Loader2, Trash2, Eye } from "lucide-react";
7+
import { Search, Loader2, Trash2 } from "lucide-react";
88
import { cn } from "@/lib/utils";
99
import { ProjectFile } from "../../projects/ProjectsContext";
1010
import { formatRelativeTime } from "../projects/project_utils";
1111
import {
1212
FileUploadIcon,
1313
ImageIcon as ImageFileIcon,
1414
} from "@/components/icons/icons";
15-
import { DocumentIcon } from "@/components/icons/CustomIcons";
15+
import { DocumentIcon, OpenInNewIcon } from "@/components/icons/CustomIcons";
1616

1717
interface FilesListProps {
1818
className?: string;
@@ -101,7 +101,7 @@ export default function FilesList({
101101

102102
return (
103103
<div
104-
className={cn("flex flex-col gap-3 focus:outline-none w-full", className)}
104+
className={cn("flex flex-col gap-2 focus:outline-none w-full", className)}
105105
tabIndex={-1}
106106
onMouseDown={(e) => {
107107
// Prevent parent dialog from intercepting mouse events
@@ -169,7 +169,7 @@ export default function FilesList({
169169
maxHeight: "588px", // ~10.5 items * 56px per item
170170
}}
171171
>
172-
<ScrollArea ref={scrollAreaRef} className="h-full pr-2">
172+
<ScrollArea ref={scrollAreaRef} className="h-full pr-1">
173173
<div className="flex flex-col">
174174
{filtered.map((f) => (
175175
<button
@@ -245,7 +245,10 @@ export default function FilesList({
245245
onFileClick && onFileClick(f);
246246
}}
247247
>
248-
<Eye className="h-4 w-4 text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-200" />
248+
<OpenInNewIcon
249+
size={16}
250+
className="text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-200"
251+
/>
249252
</button>
250253
)}
251254
{showRemove &&

web/src/components/icons/CustomIcons.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,32 @@ export const DocumentIcon = React.forwardRef<SVGSVGElement, IconProps>(
153153
);
154154

155155
DocumentIcon.displayName = "DocumentIcon";
156+
157+
export const OpenInNewIcon = React.forwardRef<SVGSVGElement, IconProps>(
158+
({ size = 14, color = "currentColor", title, className, ...props }, ref) => (
159+
<svg
160+
ref={ref}
161+
xmlns="http://www.w3.org/2000/svg"
162+
viewBox="0 0 14 14"
163+
width={size}
164+
height={size}
165+
fill="none"
166+
role={title ? "img" : "presentation"}
167+
aria-label={title}
168+
className={className}
169+
{...props}
170+
>
171+
{title ? <title>{title}</title> : null}
172+
<path
173+
d="M11 7.66667V11.6667C11 12.0203 10.8595 12.3594 10.6095 12.6095C10.3594 12.8595 10.0203 13 9.66667 13H2.33333C1.97971 13 1.64057 12.8595 1.39052 12.6095C1.14048 12.3594 1 12.0203 1 11.6667V4.33333C1 3.97971 1.14048 3.64057 1.39052 3.39052C1.64057 3.14048 1.97971 3 2.33333 3H6.33333M9 1H13M13 1V5M13 1L5.66667 8.33333"
174+
stroke={color}
175+
strokeOpacity={1}
176+
strokeWidth={1.5}
177+
strokeLinecap="round"
178+
strokeLinejoin="round"
179+
/>
180+
</svg>
181+
)
182+
);
183+
184+
OpenInNewIcon.displayName = "OpenInNewIcon";

0 commit comments

Comments
 (0)