From 901e4ccec1645a039bb5bbe3239d66d12a694803 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 15 May 2024 09:39:16 -0400 Subject: [PATCH] Use core messages spec (#337) --- components/chat.tsx | 5 +- components/stocks/message.tsx | 2 +- components/stocks/stock-purchase.tsx | 28 +-- lib/chat/actions.tsx | 265 ++++++++++++++++++--------- lib/types.ts | 6 +- package.json | 2 +- pnpm-lock.yaml | 30 ++- 7 files changed, 231 insertions(+), 107 deletions(-) diff --git a/components/chat.tsx b/components/chat.tsx index a8d188f..c43d42a 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -7,9 +7,8 @@ import { EmptyScreen } from '@/components/empty-screen' import { useLocalStorage } from '@/lib/hooks/use-local-storage' import { useEffect, useState } from 'react' import { useUIState, useAIState } from 'ai/rsc' -import { Session } from '@/lib/types' +import { Message, Session } from '@/lib/types' import { usePathname, useRouter } from 'next/navigation' -import { Message } from '@/lib/chat/actions' import { useScrollAnchor } from '@/lib/hooks/use-scroll-anchor' import { toast } from 'sonner' @@ -71,7 +70,7 @@ export function Chat({ id, className, session, missingKeys }: ChatProps) { ) : ( )} -
+
-
+
+
+1.23% ↑
{symbol}
@@ -70,7 +70,7 @@ export function Purchase({
{purchasingUI}
) : status === 'requires_action' ? ( <> -
+

Shares to purchase

- + 10 - + 100 - + 500 - + 1000
@@ -98,27 +98,27 @@ export function Purchase({

Total cost

-
+
{value} shares
-
×
- +
×
+ ${price} per share -
+
= {formatNumber(value * price)}