+
Inputs
{Object.keys(inputs).length > 0 ? (
Object.entries(inputs).map(([param, value], idx) => (
diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/index.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/index.tsx
index 7f9630c97..0dc62c44d 100644
--- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/index.tsx
+++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/index.tsx
@@ -158,7 +158,7 @@ export default function DocumentEditor({
/>
-
diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/EvaluationResults/EvaluationResultInfo/Messages.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/EvaluationResults/EvaluationResultInfo/Messages.tsx
index 94438d66a..3ff743601 100644
--- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/EvaluationResults/EvaluationResultInfo/Messages.tsx
+++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/evaluations/[evaluationId]/_components/EvaluationResults/EvaluationResultInfo/Messages.tsx
@@ -22,12 +22,6 @@ export function EvaluationResultMessages({
}, [providerLog])
if (!providerLog) return null
- return (
-
- )
+
+ return
}
diff --git a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogInfo/Messages.tsx b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogInfo/Messages.tsx
index d2f74c44d..246c5a404 100644
--- a/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogInfo/Messages.tsx
+++ b/apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogInfo/Messages.tsx
@@ -23,12 +23,6 @@ export function DocumentLogMessages({
}, [providerLogs])
if (!providerLogs) return null
- return (
-
- )
+
+ return
}
diff --git a/packages/web-ui/src/ds/molecules/Chat/ErrorMessage/index.tsx b/packages/web-ui/src/ds/molecules/Chat/ErrorMessage/index.tsx
index 674502be1..fb5cc3686 100644
--- a/packages/web-ui/src/ds/molecules/Chat/ErrorMessage/index.tsx
+++ b/packages/web-ui/src/ds/molecules/Chat/ErrorMessage/index.tsx
@@ -1,16 +1,11 @@
-import { CompileError, ContentType } from '@latitude-data/compiler'
+import { CompileError } from '@latitude-data/compiler'
-import { Text } from '../../../atoms'
-import { Message } from '../Message'
+import { Alert, Text } from '../../../atoms'
export function ErrorMessage({ error }: { error: Error }) {
return (
-
+
{error instanceof CompileError && (
{error
diff --git a/packages/web-ui/src/ds/molecules/Chat/Message/helpers.ts b/packages/web-ui/src/ds/molecules/Chat/Message/helpers.ts
new file mode 100644
index 000000000..f93c90698
--- /dev/null
+++ b/packages/web-ui/src/ds/molecules/Chat/Message/helpers.ts
@@ -0,0 +1,12 @@
+export const roleVariant = (role: string) => {
+ switch (role) {
+ case 'user':
+ return 'purple'
+ case 'system':
+ return 'outline'
+ case 'assistant':
+ return 'yellow'
+ default:
+ return 'default'
+ }
+}
diff --git a/packages/web-ui/src/ds/molecules/Chat/Message/index.tsx b/packages/web-ui/src/ds/molecules/Chat/Message/index.tsx
index 3724afb48..f27a69a75 100644
--- a/packages/web-ui/src/ds/molecules/Chat/Message/index.tsx
+++ b/packages/web-ui/src/ds/molecules/Chat/Message/index.tsx
@@ -5,39 +5,16 @@ import {
} from '@latitude-data/compiler'
import { cn } from '../../../../lib/utils'
-import { Badge, BadgeProps, Text } from '../../../atoms'
+import { Badge, Text } from '../../../atoms'
import { TextColor } from '../../../tokens'
+import { roleVariant } from './helpers'
-type MessageVariant = {
- badgeVariant: BadgeProps['variant']
- textColor: TextColor
-}
-
-const MessageVariants = {
- muted: {
- badgeVariant: 'muted',
- textColor: 'foregroundMuted',
- } as MessageVariant,
- accent: {
- badgeVariant: 'accent',
- textColor: 'accentForeground',
- } as MessageVariant,
- outline: {
- badgeVariant: 'outline',
- textColor: 'foregroundMuted',
- } as MessageVariant,
- destructive: {
- badgeVariant: 'destructive',
- textColor: 'destructive',
- } as MessageVariant,
-}
+export { roleVariant } from './helpers'
export type MessageProps = {
role: string
content: MessageContent[] | string
className?: string
- variant?: keyof typeof MessageVariants
- layout?: 'horizontal' | 'vertical'
size?: 'default' | 'small'
animatePulse?: boolean
}
@@ -46,38 +23,36 @@ export function Message({
role,
content,
animatePulse,
- variant = 'muted',
- layout = 'horizontal',
size = 'default',
}: MessageProps) {
- const { badgeVariant, textColor } = MessageVariants[variant]
return (
-
-
+
+
{role.charAt(0).toUpperCase() + role.slice(1)}
-
- {typeof content === 'string' ? (
-
- ) : (
- content.map((c, idx) => (
-
- ))
- )}
+
+
+
+ {typeof content === 'string' ? (
+
+ ) : (
+ content.map((c, idx) => (
+
+ ))
+ )}
+
)
diff --git a/packages/web-ui/src/ds/molecules/Chat/MessageList/index.tsx b/packages/web-ui/src/ds/molecules/Chat/MessageList/index.tsx
index 3a9136f18..c421c6112 100644
--- a/packages/web-ui/src/ds/molecules/Chat/MessageList/index.tsx
+++ b/packages/web-ui/src/ds/molecules/Chat/MessageList/index.tsx
@@ -4,35 +4,14 @@ import { Fragment } from 'react'
import { Message as ConversationMessage } from '@latitude-data/compiler'
-import { Message, MessageProps } from '../Message'
+import { Message } from '../Message'
-export function MessageList({
- messages,
- variant,
- messageLayout,
- separator = false,
- size,
-}: {
- messages: ConversationMessage[]
- variant?: MessageProps['variant']
- messageLayout?: MessageProps['layout']
- size?: MessageProps['size']
- separator?: boolean
-}) {
+export function MessageList({ messages }: { messages: ConversationMessage[] }) {
return (
{messages.map((message, index) => (
- {separator && index > 0 && (
-
- )}
-
+
))}