Skip to content

Commit

Permalink
[app] Layout improvments for messages and tool calls/results
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhancock committed Nov 26, 2024
1 parent 524af9e commit c872e24
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 185 deletions.
4 changes: 3 additions & 1 deletion ui/desktop/src/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Tabs from './components/Tabs';
import MoreMenu from './components/MoreMenu';
import { Bird } from './components/ui/icons';
import LoadingGoose from './components/LoadingGoose';

// import fakeToolInvocations from './fixtures/tool-calls-and-results.json';

export interface Chat {
id: number;
Expand Down Expand Up @@ -115,6 +115,8 @@ function ChatContent({
},
});

// const messages = fakeToolInvocations;

// Update chat messages when they change
useEffect(() => {
const updatedChats = chats.map((c) =>
Expand Down
25 changes: 9 additions & 16 deletions ui/desktop/src/components/GooseMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ToolInvocation from './ToolInvocation';
import ReactMarkdown from 'react-markdown';
import ToolInvocations from './ToolInvocations';
import LinkPreview from './LinkPreview';
import GooseResponseForm from './GooseResponseForm';
import { extractUrls } from '../utils/urlUtils';
Expand All @@ -22,44 +22,37 @@ export default function GooseMessage({ message, metadata, messages, append }: Go
const previousUrls = previousMessage ? extractUrls(previousMessage.content) : [];
const urls = !message.toolInvocations ? extractUrls(message.content, previousUrls) : [];

console.log("message", message.content)

return (
<div className="flex">
<div className="flex flex-col">
<div className="flex justify-start mb-[16px]">
<div className="flex-col">
{message.toolInvocations && (
<div className="bg-goose-bubble max-w-[100%] overflow-hidden text-white rounded-2xl p-4 mb-[16px]">
<div className="space-y-4">
{message.toolInvocations.map((toolInvocation) => (
<ToolInvocation
key={toolInvocation.toolCallId}
toolInvocation={toolInvocation}
/>
))}
</div>
<div className="flex bg-goose-bubble text-white rounded-2xl p-4 pb-0 mb-[16px]">
<ToolInvocations toolInvocations={message.toolInvocations} />
</div>
)}

{message.content && (
<div className="bg-goose-bubble max-w-[100%] overflow-hidden text-white rounded-2xl p-4 mb-[16px]">
<div className="flex bg-goose-bubble text-white rounded-2xl p-4 mb-[16px]">
<ReactMarkdown className="prose prose-xs">{message.content}</ReactMarkdown>
</div>
)}

{urls.length > 0 && (
<div className="mt-2">
<div className="flex mb-[16px]">
{urls.map((url, index) => (
<LinkPreview key={index} url={url} />
))}
</div>
)}

{metadata && (
<div className="flex mb-[16px]">
<GooseResponseForm
message={message.content}
metadata={metadata}
append={append}
/>
</div>
)}
</div>
</div>
Expand Down
165 changes: 0 additions & 165 deletions ui/desktop/src/components/ToolInvocation.tsx

This file was deleted.

Loading

0 comments on commit c872e24

Please sign in to comment.