From 5c3001e29a571d1eea6cf0d3dbd779d1e5cfe361 Mon Sep 17 00:00:00 2001 From: Gary Meehan Date: Wed, 4 Oct 2023 22:27:23 +0100 Subject: [PATCH 1/3] add redirect --- components/chat.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/chat.tsx b/components/chat.tsx index a9ecafe..a4c60cc 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -20,6 +20,7 @@ import { useState } from 'react' import { Button } from './ui/button' import { Input } from './ui/input' import { toast } from 'react-hot-toast' +import { usePathname, useRouter } from 'next/navigation' const IS_PREVIEW = process.env.VERCEL_ENV === 'preview' export interface ChatProps extends React.ComponentProps<'div'> { @@ -28,6 +29,8 @@ export interface ChatProps extends React.ComponentProps<'div'> { } export function Chat({ id, initialMessages, className }: ChatProps) { + const router = useRouter() + const path = usePathname() const [previewToken, setPreviewToken] = useLocalStorage( 'ai-token', null @@ -46,6 +49,12 @@ export function Chat({ id, initialMessages, className }: ChatProps) { if (response.status === 401) { toast.error(response.statusText) } + }, + onFinish() { + if (!path.includes('chat')) { + router.push(`/chat/${id}`, { shallow: true }) + router.refresh() + } } }) return ( From aeb03500d86fa930124ef6bab42533c0dc3dfb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C5=A9=20V=C4=83n=20D=C5=A9ng?= Date: Wed, 18 Oct 2023 10:39:23 +0700 Subject: [PATCH 2/3] disable selection on code block line numbers --- components/ui/codeblock.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/ui/codeblock.tsx b/components/ui/codeblock.tsx index ccbf82d..3a61fd4 100644 --- a/components/ui/codeblock.tsx +++ b/components/ui/codeblock.tsx @@ -128,6 +128,9 @@ const CodeBlock: FC = memo(({ language, value }) => { background: 'transparent', padding: '1.5rem 1rem' }} + lineNumberStyle={{ + userSelect: "none", + }} codeTagProps={{ style: { fontSize: '0.9rem', From 502dcbbc08cbb6e63872663e48a85cbc29b40a6a Mon Sep 17 00:00:00 2001 From: giannis Date: Tue, 14 Nov 2023 17:21:47 -0500 Subject: [PATCH 3/3] Update docs to include Cohere support --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88d4854..26ac5aa 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ - [Next.js](https://nextjs.org) App Router - React Server Components (RSCs), Suspense, and Server Actions - [Vercel AI SDK](https://sdk.vercel.ai/docs) for streaming chat UI -- Support for OpenAI (default), Anthropic, Hugging Face, or custom AI chat models and/or LangChain +- Support for OpenAI (default), Anthropic, Cohere, Hugging Face, or custom AI chat models and/or LangChain - Edge runtime-ready - [shadcn/ui](https://ui.shadcn.com) - Styling with [Tailwind CSS](https://tailwindcss.com) @@ -32,7 +32,7 @@ ## Model Providers -This template ships with OpenAI `gpt-3.5-turbo` as the default. However, thanks to the [Vercel AI SDK](https://sdk.vercel.ai/docs), you can switch LLM providers to [Anthropic](https://anthropic.com), [Hugging Face](https://huggingface.co), or using [LangChain](https://js.langchain.com) with just a few lines of code. +This template ships with OpenAI `gpt-3.5-turbo` as the default. However, thanks to the [Vercel AI SDK](https://sdk.vercel.ai/docs), you can switch LLM providers to [Anthropic](https://anthropic.com), [Cohere](https://cohere.com/), [Hugging Face](https://huggingface.co), or using [LangChain](https://js.langchain.com) with just a few lines of code. ## Deploy Your Own