Merge branch 'main' into main

This commit is contained in:
Philipp Schmid
2025-06-18 14:52:46 +02:00
committed by GitHub
11 changed files with 75 additions and 42 deletions

View File

@@ -4,6 +4,7 @@ import { useState, useEffect, useRef, useCallback } from "react";
import { ProcessedEvent } from "@/components/ActivityTimeline";
import { WelcomeScreen } from "@/components/WelcomeScreen";
import { ChatMessagesView } from "@/components/ChatMessagesView";
import { Button } from "@/components/ui/button";
export default function App() {
const [processedEventsTimeline, setProcessedEventsTimeline] = useState<
@@ -14,7 +15,7 @@ export default function App() {
>({});
const scrollAreaRef = useRef<HTMLDivElement>(null);
const hasFinalizeEventOccurredRef = useRef(false);
const [error, setError] = useState<string | null>(null);
const thread = useStream<{
messages: Message[];
initial_search_query_count: number;
@@ -26,15 +27,12 @@ export default function App() {
: "http://localhost:8123",
assistantId: "agent",
messagesKey: "messages",
onFinish: (event: any) => {
console.log(event);
},
onUpdateEvent: (event: any) => {
let processedEvent: ProcessedEvent | null = null;
if (event.generate_query) {
processedEvent = {
title: "Generating Search Queries",
data: event.generate_query.query_list.join(", "),
data: event.generate_query?.search_query?.join(", ") || "",
};
} else if (event.web_research) {
const sources = event.web_research.sources_gathered || [];
@@ -52,11 +50,7 @@ export default function App() {
} else if (event.reflection) {
processedEvent = {
title: "Reflection",
data: event.reflection.is_sufficient
? "Search successful, generating final answer."
: `Need more information, searching for ${event.reflection.follow_up_queries.join(
", "
)}`,
data: "Analysing Web Research Results",
};
} else if (event.finalize_answer) {
processedEvent = {
@@ -72,6 +66,9 @@ export default function App() {
]);
}
},
onError: (error: any) => {
setError(error.message);
},
});
useEffect(() => {
@@ -161,6 +158,20 @@ export default function App() {
isLoading={thread.isLoading}
onCancel={handleCancel}
/>
) : error ? (
<div className="flex flex-col items-center justify-center h-full">
<div className="flex flex-col items-center justify-center gap-4">
<h1 className="text-2xl text-red-400 font-bold">Error</h1>
<p className="text-red-400">{JSON.stringify(error)}</p>
<Button
variant="destructive"
onClick={() => window.location.reload()}
>
Retry
</Button>
</div>
</div>
) : (
<ChatMessagesView
messages={thread.messages}

View File

@@ -203,7 +203,9 @@ const AiMessageBubble: React.FC<AiMessageBubbleProps> = ({
</ReactMarkdown>
<Button
variant="default"
className="cursor-pointer bg-neutral-700 border-neutral-600 text-neutral-300 self-end"
className={`cursor-pointer bg-neutral-700 border-neutral-600 text-neutral-300 self-end ${
message.content.length > 0 ? "visible" : "hidden"
}`}
onClick={() =>
handleCopy(
typeof message.content === "string"
@@ -250,7 +252,6 @@ export function ChatMessagesView({
console.error("Failed to copy text: ", err);
}
};
return (
<div className="flex flex-col h-full">
<ScrollArea className="flex-1 overflow-y-auto" ref={scrollAreaRef}>

View File

@@ -49,7 +49,7 @@ export const InputForm: React.FC<InputFormProps> = ({
return (
<form
onSubmit={handleInternalSubmit}
className={`flex flex-col gap-2 p-3 `}
className={`flex flex-col gap-2 p-3 pb-4`}
>
<div
className={`flex flex-row items-center justify-between text-white rounded-3xl rounded-bl-sm ${

View File

@@ -17,6 +17,7 @@ function ScrollArea({
<ScrollAreaPrimitive.Viewport
data-slot="scroll-area-viewport"
className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
style={{ overscrollBehavior: 'none' }}
>
{children}
</ScrollAreaPrimitive.Viewport>
@@ -38,16 +39,16 @@ function ScrollBar({
className={cn(
"flex touch-none p-px transition-colors select-none",
orientation === "vertical" &&
"h-full w-2.5 border-l border-l-transparent",
"h-full w-1.5 border-l border-l-transparent",
orientation === "horizontal" &&
"h-2.5 flex-col border-t border-t-transparent",
"h-1.5 flex-col border-t border-t-transparent",
className
)}
{...props}
>
<ScrollAreaPrimitive.ScrollAreaThumb
data-slot="scroll-area-thumb"
className="bg-border relative flex-1 rounded-full"
className="bg-neutral-600/30 relative flex-1 rounded-full"
/>
</ScrollAreaPrimitive.ScrollAreaScrollbar>
)

View File

@@ -116,6 +116,13 @@
}
body {
@apply bg-background text-foreground;
/* Prevent scroll bounce/overscroll on mobile */
overscroll-behavior: none;
-webkit-overflow-scrolling: touch;
}
html {
/* Prevent scroll bounce on the entire page */
overscroll-behavior: none;
}
}
@@ -150,5 +157,31 @@
animation: fadeInUpSmooth 0.3s ease-out forwards;
}
/* Prevent scroll bounce on scroll areas */
[data-radix-scroll-area-viewport] {
overscroll-behavior: none !important;
-webkit-overflow-scrolling: touch;
}
/* Hide any white space that might appear during scroll bounce */
[data-radix-scroll-area-viewport]::-webkit-scrollbar {
width: 0px;
background: transparent;
}
/* Subtle scroll bar styling */
[data-slot="scroll-area-scrollbar"] {
opacity: 0.3;
transition: opacity 0.2s ease;
}
[data-slot="scroll-area"]:hover [data-slot="scroll-area-scrollbar"] {
opacity: 0.6;
}
[data-slot="scroll-area-thumb"] {
background-color: rgb(115 115 115 / 0.2) !important;
}
/* Ensure your body or html has a dark background if not already set, e.g.: */
/* body { background-color: #0c0c0d; } */ /* This is similar to neutral-950 */