Compare commits

..

25 Commits

Author SHA1 Message Date
Nicolas Mowen
aec7c15b6f Add support for markdown tables 2026-02-18 18:22:00 -07:00
Nicolas Mowen
a5755c806b Fix loading 2026-02-18 16:42:14 -07:00
Nicolas Mowen
ce33ae0bbc Cleanup UI bubbles 2026-02-18 16:34:51 -07:00
Nicolas Mowen
361dcc94c8 Cleanup UI and prompt 2026-02-18 10:52:48 -07:00
Nicolas Mowen
d4630c62ca Cleanup 2026-02-18 10:52:48 -07:00
Nicolas Mowen
994a5acc52 Add sub label to event tool filtering 2026-02-18 10:52:48 -07:00
Nicolas Mowen
2ddd55c470 Implement message editing 2026-02-18 10:52:48 -07:00
Nicolas Mowen
7f69233f71 Improve default behavior 2026-02-18 10:52:48 -07:00
Nicolas Mowen
7551332c01 Improvements to UI 2026-02-18 10:52:48 -07:00
Nicolas Mowen
76409f79e0 Add copy button 2026-02-18 10:52:48 -07:00
Nicolas Mowen
730bf3c0b7 Fix tool calling 2026-02-18 10:52:48 -07:00
Nicolas Mowen
0371f55321 Undo 2026-02-18 10:52:48 -07:00
Nicolas Mowen
858367c98a Full streaming support 2026-02-18 10:52:48 -07:00
Nicolas Mowen
e09e9a0b7a Support streaming 2026-02-18 10:52:48 -07:00
Nicolas Mowen
3b3edc481b Improve UI handling 2026-02-18 10:52:48 -07:00
Nicolas Mowen
b0bcf45245 Add title 2026-02-18 10:52:48 -07:00
Nicolas Mowen
910122913a Show tool calls separately from message 2026-02-18 10:52:48 -07:00
Nicolas Mowen
99e97850c9 More time parsing improvements 2026-02-18 10:52:48 -07:00
Nicolas Mowen
59a38aa67c Reduce fields in response 2026-02-18 10:52:48 -07:00
Nicolas Mowen
9125eff794 Adjust timing format 2026-02-18 10:52:48 -07:00
Nicolas Mowen
e934910616 Improvements 2026-02-18 10:52:48 -07:00
Nicolas Mowen
a21cabae2d Add markdown 2026-02-18 10:52:48 -07:00
Nicolas Mowen
79d7d20866 processing 2026-02-18 10:52:48 -07:00
Nicolas Mowen
e7e806b135 Add chat history 2026-02-18 10:52:48 -07:00
Nicolas Mowen
f29adca9ce Add basic chat page with entry 2026-02-18 10:52:48 -07:00
4 changed files with 2 additions and 88 deletions

View File

@ -69,7 +69,6 @@ class LlamaCppClient(GenAIClient):
# Build request payload with llama.cpp native options
payload = {
"model": self.genai_config.model,
"messages": [
{
"role": "user",
@ -121,7 +120,7 @@ class LlamaCppClient(GenAIClient):
elif tool_choice == "required":
openai_tool_choice = "required"
payload: dict[str, Any] = {"messages": messages, "model": self.genai_config.model}
payload: dict[str, Any] = {"messages": messages}
if stream:
payload["stream"] = True
if tools:

View File

@ -1,42 +0,0 @@
import { useApiHost } from "@/api";
type ChatEventThumbnailsRowProps = {
events: { id: string }[];
};
/**
* Horizontal scroll row of event thumbnail images for chat (e.g. after search_objects).
* Renders nothing when events is empty.
*/
export function ChatEventThumbnailsRow({
events,
}: ChatEventThumbnailsRowProps) {
const apiHost = useApiHost();
if (events.length === 0) return null;
return (
<div className="flex min-w-0 max-w-full flex-col gap-1 self-start">
<div className="scrollbar-container min-w-0 overflow-x-auto">
<div className="flex w-max gap-2">
{events.map((event) => (
<a
key={event.id}
href={`/explore?event_id=${event.id}`}
target="_blank"
rel="noopener noreferrer"
className="relative aspect-square size-32 shrink-0 overflow-hidden rounded-lg"
>
<img
className="size-full object-cover"
src={`${apiHost}api/events/${event.id}/thumbnail.webp`}
alt=""
loading="lazy"
/>
</a>
))}
</div>
</div>
</div>
);
}

View File

@ -4,14 +4,10 @@ import { FaArrowUpLong } from "react-icons/fa6";
import { useTranslation } from "react-i18next";
import { useState, useCallback } from "react";
import axios from "axios";
import { ChatEventThumbnailsRow } from "@/components/chat/ChatEventThumbnailsRow";
import { MessageBubble } from "@/components/chat/ChatMessage";
import { ToolCallBubble } from "@/components/chat/ToolCallBubble";
import type { ChatMessage } from "@/types/chat";
import {
getEventIdsFromSearchObjectsToolCalls,
streamChatCompletion,
} from "@/utils/chatUtil";
import { streamChatCompletion } from "@/utils/chatUtil";
export default function ChatPage() {
const { t } = useTranslation(["views/chat"]);
@ -122,15 +118,6 @@ export default function ChatPage() {
msg.role === "user" || !isLoading || i < messages.length - 1
}
/>
{msg.role === "assistant" &&
(() => {
const isComplete = !isLoading || i < messages.length - 1;
if (!isComplete) return null;
const events = getEventIdsFromSearchObjectsToolCalls(
msg.toolCalls,
);
return <ChatEventThumbnailsRow events={events} />;
})()}
</div>
);
})}

View File

@ -161,33 +161,3 @@ export async function streamChatCompletion(
onDone();
}
}
/**
* Parse search_objects tool call response(s) into event ids for thumbnails.
*/
export function getEventIdsFromSearchObjectsToolCalls(
toolCalls: ToolCall[] | undefined,
): { id: string }[] {
if (!toolCalls?.length) return [];
const results: { id: string }[] = [];
for (const tc of toolCalls) {
if (tc.name !== "search_objects" || !tc.response?.trim()) continue;
try {
const parsed = JSON.parse(tc.response) as unknown;
if (!Array.isArray(parsed)) continue;
for (const item of parsed) {
if (
item &&
typeof item === "object" &&
"id" in item &&
typeof (item as { id: unknown }).id === "string"
) {
results.push({ id: (item as { id: string }).id });
}
}
} catch {
// ignore parse errors
}
}
return results;
}