Skip to content

Commit

Permalink
Sync live with main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyphilemon committed Feb 5, 2025
1 parent 5e51a26 commit 192f6e8
Show file tree
Hide file tree
Showing 57 changed files with 2,607 additions and 1,190 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Get your OpenAI API Key here: https://platform.openai.com/account/api-keys
# Get your OpenAI API Key here for chat models: https://platform.openai.com/account/api-keys
OPENAI_API_KEY=****

# Get your Fireworks AI API Key here for reasoning models: https://fireworks.ai/account/api-keys
FIREWORKS_API_KEY=****

# Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32`
AUTH_SECRET=****

Expand Down
12 changes: 6 additions & 6 deletions app/(chat)/actions.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
'use server';

import { type CoreUserMessage, generateText } from 'ai';
import { generateText, Message } from 'ai';
import { cookies } from 'next/headers';

import { customModel } from '@/lib/ai';
import {
deleteMessagesByChatIdAfterTimestamp,
getMessageById,
updateChatVisiblityById,
} from '@/lib/db/queries';
import { VisibilityType } from '@/components/visibility-selector';
import { myProvider } from '@/lib/ai/models';

export async function saveModelId(model: string) {
export async function saveChatModelAsCookie(model: string) {
const cookieStore = await cookies();
cookieStore.set('model-id', model);
cookieStore.set('chat-model', model);
}

export async function generateTitleFromUserMessage({
message,
}: {
message: CoreUserMessage;
message: Message;
}) {
const { text: title } = await generateText({
model: customModel('gpt-4o-mini'),
model: myProvider.languageModel('title-model'),
system: `\n
- you will generate a short title based on the first message a user begins a conversation with
- ensure it is not more than 80 characters long
Expand Down
Loading

0 comments on commit 192f6e8

Please sign in to comment.