Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/(chat)/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { checkBotId } from "botid/server";
import { geolocation, ipAddress } from "@vercel/functions";
import {
convertToModelMessages,
Expand All @@ -8,12 +7,13 @@ import {
stepCountIs,
streamText,
} from "ai";
import { checkBotId } from "botid/server";
import { after } from "next/server";
import { createResumableStreamContext } from "resumable-stream";
import { auth, type UserType } from "@/app/(auth)/auth";
import { entitlementsByUserType } from "@/lib/ai/entitlements";
import { type RequestHints, systemPrompt } from "@/lib/ai/prompts";
import { allowedModelIds } from "@/lib/ai/models";
import { type RequestHints, systemPrompt } from "@/lib/ai/prompts";
import { getLanguageModel } from "@/lib/ai/providers";
import { createDocument } from "@/lib/ai/tools/create-document";
import { getWeather } from "@/lib/ai/tools/get-weather";
Expand Down Expand Up @@ -185,7 +185,7 @@ export async function POST(request: Request) {
});

dataStream.merge(
result.toUIMessageStream({ sendReasoning: isReasoningModel }),
result.toUIMessageStream({ sendReasoning: isReasoningModel })
);

if (titlePromise) {
Expand Down Expand Up @@ -236,7 +236,7 @@ export async function POST(request: Request) {
if (
error instanceof Error &&
error.message?.includes(
"AI Gateway requires a valid credit card on file to service requests",
"AI Gateway requires a valid credit card on file to service requests"
)
) {
return "AI Gateway requires a valid credit card on file to service requests. Please visit https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dadd-credit-card to add a card and unlock your free credits.";
Expand Down
4 changes: 2 additions & 2 deletions components/ai-elements/web-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ export const WebPreviewConsole = ({
{logs.length === 0 ? (
<p className="text-muted-foreground">No console output</p>
) : (
logs.map((log, index) => (
logs.map((log) => (
<div
className={cn(
"text-xs",
log.level === "error" && "text-destructive",
log.level === "warn" && "text-yellow-600",
log.level === "log" && "text-foreground"
)}
key={`${log.timestamp.getTime()}-${index}`}
key={`${log.timestamp.getTime()}-${log.message}`}
>
<span className="text-muted-foreground">
{log.timestamp.toLocaleTimeString()}
Expand Down
6 changes: 3 additions & 3 deletions components/console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ export function Console({ consoleOutputs, setConsoleOutputs }: ConsoleProps) {
</div>
) : (
<div className="flex w-full flex-col gap-2 overflow-x-scroll text-zinc-900 dark:text-zinc-50">
{consoleOutput.contents.map((content, contentIndex) =>
{consoleOutput.contents.map((content) =>
content.type === "image" ? (
<picture key={`${consoleOutput.id}-${contentIndex}`}>
<picture key={`${consoleOutput.id}-${content.value}`}>
<img
alt="output"
className="w-full max-w-(--breakpoint-toast-mobile) rounded-md"
Expand All @@ -174,7 +174,7 @@ export function Console({ consoleOutputs, setConsoleOutputs }: ConsoleProps) {
) : (
<div
className="w-full whitespace-pre-line break-words"
key={`${consoleOutput.id}-${contentIndex}`}
key={`${consoleOutput.id}-${content.value}`}
>
{content.value}
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/elements/web-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ export const WebPreviewConsole = ({
{logs.length === 0 ? (
<p className="text-muted-foreground">No console output</p>
) : (
logs.map((log, index) => (
logs.map((log) => (
<div
className={cn(
"text-xs",
log.level === "error" && "text-destructive",
log.level === "warn" && "text-yellow-600",
log.level === "log" && "text-foreground"
)}
key={`${log.timestamp.getTime()}-${index}`}
key={`${log.timestamp.getTime()}-${log.message}`}
>
<span className="text-muted-foreground">
{log.timestamp.toLocaleTimeString()}
Expand Down