Skip to content

Commit

Permalink
fix: show default message when no metadata on prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhopperlowe committed Oct 25, 2024
1 parent 439b206 commit 45a5cce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ui/admin/app/components/chat/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const Message = React.memo(({ message }: MessageProps) => {
/>
)}

{message.prompt ? (
{message.prompt?.metadata ? (
<PromptMessage prompt={message.prompt} />
) : (
<Markdown
Expand Down Expand Up @@ -137,6 +137,8 @@ export const Message = React.memo(({ message }: MessageProps) => {
Message.displayName = "Message";

function PromptMessage({ prompt }: { prompt: OAuthPrompt }) {
if (!prompt.metadata) return null;

return (
<div className="flex-auto flex flex-col flex-wrap gap-2 w-fit">
<TypographyP className="min-w-fit">
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/lib/model/chatEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type OAuthPrompt = {
id?: string;
name: string;
time?: Date;
message?: string;
message: string;
fields?: string[];
sensitive?: boolean;
metadata?: PromptOAuthMeta;
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/lib/model/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const toolCallMessage = (toolCall: ToolCall): Message => ({

export const promptMessage = (prompt: OAuthPrompt, runID: string): Message => ({
sender: "agent",
text: "",
text: prompt.message,
prompt,
runId: runID,
});
Expand Down

0 comments on commit 45a5cce

Please sign in to comment.