Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Scrape UI #38

Merged
merged 30 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
87af903
initial draft of input form layout
Maxwell-Lindsey Sep 14, 2023
fa047e2
Merge branch 'main' into web_scrape_ui
Maxwell-Lindsey Sep 18, 2023
8e649ed
Improved UI settings form format
Maxwell-Lindsey Sep 18, 2023
1d4ebfe
added tooltips to web scrape parameters inputs
Maxwell-Lindsey Sep 20, 2023
92090e5
moved all web scrape ui code into WebScrape.tsx
Maxwell-Lindsey Sep 21, 2023
52ef4ba
add conditonal display of boxes, must have URL entered
KastanDay Sep 21, 2023
5123dc7
added web scrape parameters to function call
Maxwell-Lindsey Sep 21, 2023
686f3fa
Merge branch 'web_scrape_ui' of github.com:KastanDay/ai-ta-frontend i…
Maxwell-Lindsey Sep 21, 2023
80abe57
changed web scrape parameters to be more readable
Maxwell-Lindsey Sep 21, 2023
2ffea94
standardize naming of stayOnBaseURL
KastanDay Sep 21, 2023
3dda7bb
adding 'read more' toggle to supported filetypes. TODO add better con…
KastanDay Sep 21, 2023
77155dd
Merge branch 'main' into web_scrape_ui
Maxwell-Lindsey Sep 27, 2023
ca2bebb
fixed drop down coloring
Maxwell-Lindsey Sep 27, 2023
a7af733
corrected input checking; Added Github scrape msg
Maxwell-Lindsey Oct 1, 2023
b6b8ae7
Added Max URLs and Max Depth ranges into label
Maxwell-Lindsey Oct 1, 2023
6af764a
center aligned Read More for web scrape info
Maxwell-Lindsey Oct 1, 2023
256c29d
Merge branch 'main' into web_scrape_ui
Maxwell-Lindsey Oct 1, 2023
5000c92
fixed guthub message
Maxwell-Lindsey Oct 1, 2023
1a5ae0f
maxUrls and maxDepth -1 bc 0 indexed
Maxwell-Lindsey Oct 1, 2023
05d5543
Update Terms, Privacy to UIUC standard ones
Maxwell-Lindsey Oct 1, 2023
1f7ec18
fixed type error for vercel check
Maxwell-Lindsey Oct 1, 2023
bb41db0
removed unused functions/imports
Maxwell-Lindsey Oct 1, 2023
54ddec3
fixed input check to ensure only numbers present
Maxwell-Lindsey Oct 1, 2023
b424d8c
fixed vercel error from ' instead of &apos
Maxwell-Lindsey Oct 1, 2023
474c154
fixed &apos in github msg
Maxwell-Lindsey Oct 1, 2023
5744536
tooltips: Adding more text, set widths and dark backgrounds
KastanDay Oct 3, 2023
b34aa2b
add nice coloring and examples to READ MORE accordian
KastanDay Oct 3, 2023
270a734
Major refactor of Supported File Types, no more 'Under development...…
KastanDay Oct 3, 2023
56f333e
tiny typo fix
KastanDay Oct 3, 2023
fd0e8e8
FORMAT FIX ONLY
KastanDay Oct 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/media/excel_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const Chat = memo(({ stopConversationRef, courseMetadata }: Props) => {
messages: updatedConversation.messages,
key:
courseMetadata?.openai_api_key &&
courseMetadata?.openai_api_key != ''
courseMetadata?.openai_api_key != ''
? courseMetadata.openai_api_key
: apiKey,
prompt: updatedConversation.prompt,
Expand Down Expand Up @@ -520,14 +520,14 @@ export const Chat = memo(({ stopConversationRef, courseMetadata }: Props) => {

const statements =
courseMetadata?.example_questions &&
courseMetadata.example_questions.length > 0
courseMetadata.example_questions.length > 0
? courseMetadata.example_questions
: [
'Make a bullet point list of key takeaways of the course.',
'What is [your favorite topic] and why is it worth learning about?',
'How can I effectively prepare for the upcoming exam?',
'How many assignments in the course?',
]
'Make a bullet point list of key takeaways of the course.',
'What is [your favorite topic] and why is it worth learning about?',
'How can I effectively prepare for the upcoming exam?',
'How many assignments in the course?',
]

// Add this function to create dividers with statements
const renderIntroductoryStatements = () => {
Expand Down
12 changes: 10 additions & 2 deletions src/components/UIUC-Components/GlobalFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ export default function Footer({ isNavbar = false }: { isNavbar?: boolean }) {
Disclaimer
</Link>
<Link
href="/terms"
href="https://www.vpaa.uillinois.edu/digital_risk_management/generative_ai/"
className="link-hover link text-blue-500"
target="_blank"
rel="noopener noreferrer"
>
Generative AI Policy
</Link>
<Link
href="https://www.vpaa.uillinois.edu/resources/terms_of_use"
className="link-hover link text-blue-500"
target="_blank"
rel="noopener noreferrer"
>
Terms
</Link>
<Link
href="/privacy"
href="https://www.vpaa.uillinois.edu/resources/web_privacy"
className="link-hover link text-blue-500"
target="_blank"
rel="noopener noreferrer"
Expand Down
12 changes: 7 additions & 5 deletions src/components/UIUC-Components/GlobalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ export function LandingPageHeader({
<SignedOut>
{/* Signed out users get sign in button */}
<SignInButton>
<button className={classes.link}><span
className={`${montserrat_heading.variable} font-montserratHeading`}
>
Sign in / Sign up
</span></button>
<button className={classes.link}>
<span
className={`${montserrat_heading.variable} font-montserratHeading`}
>
Sign in / Sign up
</span>
</button>
</SignInButton>
</SignedOut>
</Group>
Expand Down
23 changes: 18 additions & 5 deletions src/components/UIUC-Components/LargeDropzone.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
// LargeDropzone.tsx
import React, { useRef, useState } from 'react'
import { createStyles, Group, rem, Text, Title, useMantineTheme } from '@mantine/core'
import { IconAlertCircle, IconCloudUpload, IconDownload, IconX } from '@tabler/icons-react'
import {
createStyles,
Group,
rem,
Text,
Title,
useMantineTheme,
} from '@mantine/core'
import {
IconAlertCircle,
IconCloudUpload,
IconDownload,
IconX,
} from '@tabler/icons-react'
import { Dropzone } from '@mantine/dropzone'
import { useRouter } from 'next/router'
import { type CourseMetadata } from '~/types/courseMetadata'
Expand Down Expand Up @@ -264,7 +276,6 @@ export function LargeDropzone({
setUploadInProgress(false)
refreshOrRedirect(redirect_to_gpt_4)
// TODO: here we should raise toast for failed ingest files. AND successful ingest files.

} else {
console.error('Upsert metadata failed')
setUploadInProgress(false)
Expand All @@ -274,7 +285,7 @@ export function LargeDropzone({
radius="md"
bg="#0E1116"
disabled={isDisabled}
// #0E1116 -- nice dark
// #0E1116 -- nice dark
>
<div
style={{ pointerEvents: 'none', opacity: isDisabled ? 0.6 : 1 }}
Expand Down Expand Up @@ -394,7 +405,9 @@ const showToast = (error_files: string[]) => {
autoClose: 15000,
// position="top-center",
title: 'Failed to ingest files',
message: `Failed to ingest the following files: ${error_files.join(", ")}. Please shoot me an email: [email protected].`,
message: `Failed to ingest the following files: ${error_files.join(
', ',
)}. Please shoot me an email: [email protected].`,
color: 'red',
radius: 'lg',
icon: <IconAlertCircle />,
Expand Down
5 changes: 3 additions & 2 deletions src/components/UIUC-Components/Maintenance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Title, Text } from '@mantine/core'
import Link from 'next/link'

const Maintenance = ({ }: {
const Maintenance = ({}: {
// Prevent search engine indexing of Maintenance page (because it'll ruin our entire search results): https://github.com/vercel/next.js/discussions/12850#discussioncomment-3335807
// in _document.tsx
}) => {
Expand All @@ -24,7 +24,8 @@ const Maintenance = ({ }: {
UIUC.chat is down for maintenance
</Title>
<Text size="lg">
Our database provider, Supabase, is down. We will be back shortly after they are back online.
Our database provider, Supabase, is down. We will be back shortly
after they are back online.
</Text>
{/* <Text size="lg">
Motivation: Things to explosive product growth, accompanied by the
Expand Down
38 changes: 21 additions & 17 deletions src/components/UIUC-Components/MakeOldCoursePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const MakeOldCoursePage = ({
return (
<CannotEditCourse
course_name={currentPageName as string}
// current_email={currentEmail as string}
// current_email={currentEmail as string}
/>
)
}
Expand Down Expand Up @@ -217,9 +217,12 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
url: string,
) => {
try {
const response = await axios.delete(`https://flask-production-751b.up.railway.app/delete`, {
params: { course_name, s3_path, url },
})
const response = await axios.delete(
`https://flask-production-751b.up.railway.app/delete`,
{
params: { course_name, s3_path, url },
},
)
// Handle successful deletion, show a success message
showToastOnFileDeleted(theme)
// Refresh the page
Expand Down Expand Up @@ -301,15 +304,15 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
// style={{ outline: 'solid 1px', outlineColor: 'white' }}
onMouseEnter={(e) => {
e.currentTarget.style.backgroundColor = theme.colors.grape[8]
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
}}
onMouseLeave={(e) => {
e.currentTarget.style.backgroundColor = 'transparent'
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.gray[8]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.gray[8]
}}
>
<IconDownload className="h-5 w-5 text-gray-800" />
Expand All @@ -327,15 +330,15 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
// style={{ outline: 'solid 1px', outlineColor: theme.white }}
onMouseEnter={(e) => {
e.currentTarget.style.backgroundColor = theme.colors.grape[8]
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
}}
onMouseLeave={(e) => {
e.currentTarget.style.backgroundColor = 'transparent'
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.red[6]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.red[6]
}}
>
<IconTrash className="h-5 w-5 text-red-600" />
Expand Down Expand Up @@ -372,7 +375,8 @@ async function fetchCourseMetadata(course_name: string) {
return data.course_metadata
} else {
throw new Error(
`Error fetching course metadata: ${response.statusText || response.status
`Error fetching course metadata: ${
response.statusText || response.status
}`,
)
}
Expand Down
38 changes: 21 additions & 17 deletions src/components/UIUC-Components/MakeQueryAnalysisPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const MakeQueryAnalysisPage = ({
return (
<CannotEditCourse
course_name={currentPageName as string}
// current_email={currentEmail as string}
// current_email={currentEmail as string}
/>
)
}
Expand Down Expand Up @@ -278,9 +278,12 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
const { classes, theme } = useStyles()
const handleDelete = async (s3_path: string, course_name: string) => {
try {
const response = await axios.delete(`https://flask-production-751b.up.railway.app/delete`, {
params: { s3_path, course_name },
})
const response = await axios.delete(
`https://flask-production-751b.up.railway.app/delete`,
{
params: { s3_path, course_name },
},
)
// Handle successful deletion, show a success message
showToastOnFileDeleted(theme)
// Refresh the page
Expand Down Expand Up @@ -362,15 +365,15 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
// style={{ outline: 'solid 1px', outlineColor: 'white' }}
onMouseEnter={(e) => {
e.currentTarget.style.backgroundColor = theme.colors.grape[8]
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
}}
onMouseLeave={(e) => {
e.currentTarget.style.backgroundColor = 'transparent'
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.gray[8]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.gray[8]
}}
>
<IconDownload className="h-5 w-5 text-gray-800" />
Expand All @@ -387,15 +390,15 @@ const CourseFilesList = ({ files }: CourseFilesListProps) => {
// style={{ outline: 'solid 1px', outlineColor: theme.white }}
onMouseEnter={(e) => {
e.currentTarget.style.backgroundColor = theme.colors.grape[8]
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colorScheme === 'dark'
? theme.colors.gray[2]
: theme.colors.gray[1]
}}
onMouseLeave={(e) => {
e.currentTarget.style.backgroundColor = 'transparent'
; (e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.red[6]
;(e.currentTarget.children[0] as HTMLElement).style.color =
theme.colors.red[6]
}}
>
<IconTrash className="h-5 w-5 text-red-600" />
Expand Down Expand Up @@ -432,7 +435,8 @@ async function fetchCourseMetadata(course_name: string) {
return data.course_metadata
} else {
throw new Error(
`Error fetching course metadata: ${response.statusText || response.status
`Error fetching course metadata: ${
response.statusText || response.status
}`,
)
}
Expand Down
Loading