From cfe32aa0a7d91c191062a396460367fcfde4b2f2 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Thu, 30 Mar 2023 01:46:18 -0700 Subject: [PATCH] Central default for ChatModelId --- components/ChatMessage.tsx | 2 +- lib/data.ts | 2 ++ lib/store-chats.ts | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/ChatMessage.tsx b/components/ChatMessage.tsx index 1c5a8a67f..4066b20d7 100644 --- a/components/ChatMessage.tsx +++ b/components/ChatMessage.tsx @@ -200,7 +200,7 @@ function copyToClipboard(text: string) { function prettyBaseModel(model: string | undefined): string { if (!model) return ''; if (model.startsWith('gpt-4')) return 'gpt-4'; - if (model.startsWith('gpt-3.5-turbo')) return '3.5-turbo'; + if (model.startsWith('gpt-3.5-turbo')) return '3.5 Turbo'; return model; } diff --git a/lib/data.ts b/lib/data.ts index 75de5a44a..ddcb9f254 100644 --- a/lib/data.ts +++ b/lib/data.ts @@ -51,6 +51,8 @@ export const SystemPurposes: { [key in SystemPurposeId]: SystemPurposeData } = { export type ChatModelId = 'gpt-4' | 'gpt-3.5-turbo'; +export const defaultChatModelId: ChatModelId = 'gpt-4'; + type ChatModelData = { description: string | JSX.Element; title: string; diff --git a/lib/store-chats.ts b/lib/store-chats.ts index 1390a316f..6f1f19fbb 100644 --- a/lib/store-chats.ts +++ b/lib/store-chats.ts @@ -2,7 +2,7 @@ import * as React from 'react'; import { create } from 'zustand'; import { persist } from 'zustand/middleware'; -import { ChatModelId, SystemPurposeId } from '@/lib/data'; +import { ChatModelId, defaultChatModelId, SystemPurposeId } from '@/lib/data'; /// Conversations Store @@ -72,9 +72,9 @@ export interface DConversation { const createConversation = (id: string, name: string, systemPurposeId: SystemPurposeId, chatModelId: ChatModelId): DConversation => ({ id, name, messages: [], systemPurposeId, chatModelId, created: Date.now(), updated: Date.now() }); -const defaultConversations: DConversation[] = [createConversation('default', 'Conversation', 'Generic', 'gpt-4')]; +const defaultConversations: DConversation[] = [createConversation('default', 'Conversation', 'Generic', defaultChatModelId)]; -const errorConversation: DConversation = createConversation('error-missing', 'Missing Conversation', 'Developer', 'gpt-3.5-turbo'); +const errorConversation: DConversation = createConversation('error-missing', 'Missing Conversation', 'Developer', defaultChatModelId); export const useChatStore = create()(