Skip to content

Commit

Permalink
feat: added gpt-4o model
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwiseman committed May 13, 2024
1 parent 9f49d53 commit 2b96416
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions apps/frontend/src/app/_components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function Chat({
const panelRef = useRef<ImperativePanelHandle>(null);
const scrollRef = useRef<HTMLDivElement>(null);
const [model, setModel] = useState(
process.env.NODE_ENV === "development" ? "mistral" : "pplx",
process.env.NODE_ENV === "development" ? "llama" : "pplx",
);
const chat = useChat({ api: `/api/chat/${model}` });

Expand Down Expand Up @@ -118,7 +118,11 @@ export function Chat({
<div className="flex w-max flex-row items-center gap-2">
<IconBrandOpenai className="h-4 w-4 min-w-4" />
<Select
defaultValue="pplx"
defaultValue={
process.env.NODE_ENV === "development"
? "mistral"
: "pplx"
}
onValueChange={setModel}
value={model}
>
Expand All @@ -127,11 +131,11 @@ export function Chat({
</SelectTrigger>
<SelectContent>
{process.env.NODE_ENV === "development" ? (
<SelectItem value="mistral">Mistral</SelectItem>
<SelectItem value="llama">Llama 3</SelectItem>
) : null}
<SelectItem value="pplx">Perplexity</SelectItem>
<SelectItem value="3.5t">GPT-3.5 Turbo</SelectItem>
<SelectItem value="4t">GPT-4 Turbo</SelectItem>
<SelectItem value="4o">GPT-4o</SelectItem>
</SelectContent>
</Select>
</div>
Expand Down Expand Up @@ -181,7 +185,7 @@ export function Chat({
</div>
) : (
<ScrollArea
className="h-full px-6 py-0"
className="h-full overflow-x-auto px-6 py-0"
ref={scrollRef}
style={{
maskImage: `linear-gradient(#000,#000,transparent 0,#000 10px,#000 calc(100% - 10px),transparent)`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function POST(req: Request): Promise<StreamingTextResponse> {

// Ask OpenAI for a streaming chat completion given the prompt
const response = await openai.createChatCompletion({
model: "gpt-4-turbo-preview",
model: "gpt-4o",
stream: true,
messages,
max_tokens: 1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function POST(req: Request): Promise<StreamingTextResponse> {

const model = new ChatOllama({
baseUrl: "http://localhost:11434",
model: "mistral",
model: "llama3",
});

const parser = new BytesOutputParser();
Expand Down

0 comments on commit 2b96416

Please sign in to comment.