From 7a2c667d2bc80f9a8eeefb14b536b104eacdecf3 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Mon, 24 Jun 2024 13:07:35 -0700 Subject: [PATCH] Add proper titles and metadata to Chat and Materials page. Show ProjectName - UIUC.chat --- src/components/Chat/Chat.tsx | 278 +++++++++--------- .../UIUC-Components/MakeOldCoursePage.tsx | 3 +- src/pages/[course_name]/materials.tsx | 3 - 3 files changed, 147 insertions(+), 137 deletions(-) diff --git a/src/components/Chat/Chat.tsx b/src/components/Chat/Chat.tsx index 97da578b8..2b8a61b58 100644 --- a/src/components/Chat/Chat.tsx +++ b/src/components/Chat/Chat.tsx @@ -71,6 +71,7 @@ import handleTools, { import { useFetchEnabledDocGroups } from '~/hooks/docGroupsQueries' import Link from 'next/link' import { CropwizardLicenseDisclaimer } from '~/pages/cropwizard-licenses' +import Head from 'next/head' const montserrat_med = Montserrat({ weight: '500', @@ -1000,76 +1001,27 @@ export const Chat = memo(({ stopConversationRef, courseMetadata }: Props) => { ) return ( -
-
- -
-
- {!(apiKey || serverSideApiKeyIsSet) ? ( -
-
-
- -
- {' '} - {t( - 'Please set your OpenAI API key in the bottom left of the screen.', - )} -
- - If you don't have a key yet, you can get one here:{' '} - - OpenAI API key{' '} - - - - - - This key will live securely encrypted in your - browser's cache. It's all client-side so our - servers never see it. - - - - GPT 3.5 is default. For GPT-4 access, either complete one - billing cycle as an OpenAI API customer or pre-pay a - minimum of $0.50. See - - {' '} - this documentation for details{' '} - - - - - - You only pay the standard OpenAI prices, per token read or - generated by the model. - -
-
-
- + + {getCurrentPageName()} - UIUC.chat + + + +
+
+ +
+
+ {!(apiKey || serverSideApiKeyIsSet) ? ( +
+
+
+
{' '} @@ -1124,77 +1076,139 @@ export const Chat = memo(({ stopConversationRef, courseMetadata }: Props) => {
-
+
+
+ {' '} + {t( + 'Please set your OpenAI API key in the bottom left of the screen.', + )} +
+ + If you don't have a key yet, you can get one + here:{' '} + + OpenAI API key{' '} + + + + + + This key will live securely encrypted in your + browser's cache. It's all client-side so our + servers never see it. + + + + GPT 3.5 is default. For GPT-4 access, either complete + one billing cycle as an OpenAI API customer or pre-pay + a minimum of $0.50. See + + {' '} + this documentation for details{' '} + + + + + + You only pay the standard OpenAI prices, per token + read or generated by the model. + +
+
+
+ +
-
- ) : modelError ? ( - - ) : ( - <> -
- {selectedConversation?.messages.length === 0 ? ( - <> -
{renderIntroductoryStatements()}
- - ) : ( - <> - {selectedConversation?.messages.map((message, index) => ( - { - // setCurrentMessage(editedMessage) - handleSend( - editedMessage, - selectedConversation?.messages.length - index, - null, - tools, - enabledDocumentGroups, - ) - }} - onImageUrlsUpdate={onImageUrlsUpdate} + ) : modelError ? ( + + ) : ( + <> +
+ {selectedConversation?.messages.length === 0 ? ( + <> +
+ {renderIntroductoryStatements()} +
+ + ) : ( + <> + {selectedConversation?.messages.map((message, index) => ( + { + // setCurrentMessage(editedMessage) + handleSend( + editedMessage, + selectedConversation?.messages.length - index, + null, + tools, + enabledDocumentGroups, + ) + }} + onImageUrlsUpdate={onImageUrlsUpdate} + /> + ))} + {loading && } +
- ))} - {loading && } -
- - )} -
- {/*
*/} - { - // setCurrentMessage(message) - handleSend(message, 0, plugin, tools, enabledDocumentGroups) - }} - onScrollDownClick={handleScrollDown} - onRegenerate={handleRegenerate} - showScrollDownButton={showScrollDownButton} - inputContent={inputContent} - setInputContent={setInputContent} - courseName={getCurrentPageName()} - /> - - )} + + )} +
+ {/*
*/} + { + // setCurrentMessage(message) + handleSend(message, 0, plugin, tools, enabledDocumentGroups) + }} + onScrollDownClick={handleScrollDown} + onRegenerate={handleRegenerate} + showScrollDownButton={showScrollDownButton} + inputContent={inputContent} + setInputContent={setInputContent} + courseName={getCurrentPageName()} + /> + + )} +
-
+ ) Chat.displayName = 'Chat' }) diff --git a/src/components/UIUC-Components/MakeOldCoursePage.tsx b/src/components/UIUC-Components/MakeOldCoursePage.tsx index 8c1a795cf..b0ff66eab 100644 --- a/src/components/UIUC-Components/MakeOldCoursePage.tsx +++ b/src/components/UIUC-Components/MakeOldCoursePage.tsx @@ -81,13 +81,12 @@ const MakeOldCoursePage = ({ - {course_name} + {course_name} - Admin page - UIUC.chat - {/*
*/}
diff --git a/src/pages/[course_name]/materials.tsx b/src/pages/[course_name]/materials.tsx index 2eff5a492..38ca5e1eb 100644 --- a/src/pages/[course_name]/materials.tsx +++ b/src/pages/[course_name]/materials.tsx @@ -7,10 +7,7 @@ import { CannotEditGPT4Page } from '~/components/UIUC-Components/CannotEditGPT4' import { LoadingSpinner } from '~/components/UIUC-Components/LoadingSpinner' import { MainPageBackground } from '~/components/UIUC-Components/MainPageBackground' import { AuthComponent } from '~/components/UIUC-Components/AuthToEditCourse' -import { Title } from '@mantine/core' import { extractEmailsFromClerk } from '~/components/UIUC-Components/clerkHelpers' -import { montserrat_heading } from 'fonts' -import Navbar from '~/components/UIUC-Components/navbars/Navbar' import { CourseMetadata } from '~/types/courseMetadata' import { fetchCourseMetadata } from '~/utils/apiUtils'