diff --git a/README.md b/README.md index 8243668..d7193fa 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The gemini-1.5-pro-latest model is a large-scale language model developed by Goo All models that support [Anthropic API](https://docs.anthropic.com/en/docs/models-overview) are supported by [Assistants Hub](https://assistantshub.ai). | Model Name | Provider | Streaming
Responses | Documents | Functions | -|-------------------| --------- | ------------------------ | ------------------------ | ------------------------ | +| ----------------- | --------- | ------------------------ | ------------------------ | ------------------------ | | Claude 3 Opus | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | | Claude 3.5 Sonnet | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | | Claude 3 Sonnet | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | diff --git a/src/app/api/assistants/[id]/files/route.ts b/src/app/api/assistants/[id]/files/route.ts index d8f3e4d..410c210 100644 --- a/src/app/api/assistants/[id]/files/route.ts +++ b/src/app/api/assistants/[id]/files/route.ts @@ -1,5 +1,4 @@ import { ulid } from 'ulidx'; -import OpenAI from 'openai'; import fs from 'fs'; import os from 'os'; import path from 'path'; diff --git a/src/app/api/auth/[auth0]/route.ts b/src/app/api/auth/[auth0]/route.ts index 9e91a52..1fe2918 100644 --- a/src/app/api/auth/[auth0]/route.ts +++ b/src/app/api/auth/[auth0]/route.ts @@ -1,5 +1,10 @@ -import { handleAuth, handleLogin } from '@auth0/nextjs-auth0'; -import { redirect } from 'next/navigation'; +import { + getSession, + handleAuth, + handleLogin, + handleProfile, +} from '@auth0/nextjs-auth0'; +import prisma from '@/app/api/utils/prisma'; export const GET = handleAuth({ login: handleLogin((req) => { @@ -18,4 +23,24 @@ export const GET = handleAuth({ returnTo: returnUrl, }; }), + // @ts-ignore + profile: handleProfile(async (req) => { + // @ts-ignore + let session = await getSession(req); + + // Create organization if not yet created for this user + const organization = await prisma.organization.upsert({ + where: { + owner_ownerType: { + owner: session?.user.sub, + ownerType: 'personal', + }, + }, + update: {}, + create: { + owner: session?.user.sub, + ownerType: 'personal', + }, + }); + }), }); diff --git a/src/app/api/utils/openai.ts b/src/app/api/utils/openai.ts index 958aec6..da1255d 100644 --- a/src/app/api/utils/openai.ts +++ b/src/app/api/utils/openai.ts @@ -19,7 +19,7 @@ export function getOpenAI(assistant: any): OpenAI { }); } -export async function getOpenAIWithKey(modelProviderKeyId:string) { +export async function getOpenAIWithKey(modelProviderKeyId: string) { let openAIAPIKey = process.env.OPENAI_API_KEY ? process.env.OPENAI_API_KEY : null; @@ -36,9 +36,9 @@ export async function getOpenAIWithKey(modelProviderKeyId:string) { }, }); - if(modelProviderKey && modelProviderKey.key) { + if (modelProviderKey && modelProviderKey.key) { // @ts-ignore - openAIAPIKey = modelProviderKey.key['apiKey'] + openAIAPIKey = modelProviderKey.key['apiKey']; } } diff --git a/src/app/assistants/[id]/SideNavigation.tsx b/src/app/assistants/[id]/SideNavigation.tsx index 33b4c14..b272ded 100644 --- a/src/app/assistants/[id]/SideNavigation.tsx +++ b/src/app/assistants/[id]/SideNavigation.tsx @@ -72,7 +72,7 @@ export default function SideNavigation() { - ); - } - ) :<> +
+ {assistant && assistant.theme && assistant.theme.conversationStarters ? ( + assistant.theme.conversationStarters.map((conversationStarter) => { + return ( + + ); + }) + ) : ( + <> + )}
); -} \ No newline at end of file +} diff --git a/src/app/assistants/[id]/chat/ChatHeader.tsx b/src/app/assistants/[id]/chat/ChatHeader.tsx index 82447c2..958d61d 100644 --- a/src/app/assistants/[id]/chat/ChatHeader.tsx +++ b/src/app/assistants/[id]/chat/ChatHeader.tsx @@ -28,7 +28,9 @@ export default function ChatHeader(props: ChatHeaderProps) { >
-

{assistant.name}

+

+ {assistant.name} +

{!props.minimize && props.setMinimize ? ( @@ -54,7 +56,8 @@ export default function ChatHeader(props: ChatHeaderProps) {
{assistant.description} diff --git a/src/app/assistants/[id]/chat/ChatPage.tsx b/src/app/assistants/[id]/chat/ChatPage.tsx index 3c43b42..35ebb5e 100644 --- a/src/app/assistants/[id]/chat/ChatPage.tsx +++ b/src/app/assistants/[id]/chat/ChatPage.tsx @@ -33,7 +33,7 @@ export default function ChatPage(props: ChatPageProps) { messages, sendMessage, createNewThread, - sendConversationStarter + sendConversationStarter, } = useChatContext(); useEffect(() => { @@ -67,9 +67,9 @@ export default function ChatPage(props: ChatPageProps) { {messages.map((message: Message, index) => { return ; })} - { - messages.length === 1 ? : null - } + {messages.length === 1 ? ( + + ) : null} {streamText ? ( <> { @@ -80,9 +80,11 @@ export default function ChatPopup(props: ChatPopupProps) { {messages.map((message: Message, index) => { return ; })} - { - messages.length === 1 ? : null - } + {messages.length === 1 ? ( + + ) : null} {streamText ? ( <> { setMessageStatus('in_progress' as string); }; - const sendConversationStarter = async (prompt:string) => { + const sendConversationStarter = async (prompt: string) => { let message: Message = { created_at: Date.now() / 1000, role: 'user', @@ -234,6 +234,6 @@ export const useChatContext = () => { setFingerprint, sendMessage, createNewThread, - sendConversationStarter + sendConversationStarter, }; }; diff --git a/src/app/assistants/[id]/settings/page.tsx b/src/app/assistants/[id]/settings/page.tsx index d62072c..8831f9b 100644 --- a/src/app/assistants/[id]/settings/page.tsx +++ b/src/app/assistants/[id]/settings/page.tsx @@ -22,7 +22,9 @@ export default function Settings() { ); const [authenticationRequired, setAuthenticationRequired] = useState( - assistant.authenticatedUsersOnly !== undefined ? assistant.authenticatedUsersOnly : true + assistant.authenticatedUsersOnly !== undefined + ? assistant.authenticatedUsersOnly + : true ); const { push } = useRouter();