-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update backend to handle errors better Add pre user prompt and answer for GPT-3.5 understanding
- Loading branch information
Showing
17 changed files
with
4,225 additions
and
27,372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
* { | ||
margin: 0; | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; | ||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; | ||
|
||
import Home from './pages/Home/Home'; | ||
import SearchResult from './pages/SearchResult/SearchResult'; | ||
import Home from "./pages/Home/Home"; | ||
import SearchResult from "./pages/SearchResult/SearchResult"; | ||
|
||
import './App.css'; | ||
import "./App.css"; | ||
|
||
function App() { | ||
return ( | ||
<div className="app"> | ||
|
||
<Router> | ||
<Switch> | ||
|
||
<Routes> | ||
{/* Home (the one with the search on) */} | ||
<Route path="/" exact> | ||
<Home /> | ||
</Route> | ||
<Route path="/" element={<Home />} /> | ||
|
||
{/* SearchPage (The results page) */} | ||
<Route path="/search"> | ||
<SearchResult /> | ||
</Route> | ||
|
||
</Switch> | ||
<Route path="search" element={<SearchResult />} /> | ||
</Routes> | ||
</Router> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import React, { createContext, useContext, useReducer } from 'react'; | ||
import React, { createContext, useContext, useReducer } from "react"; | ||
|
||
// Preparing the data layer | ||
export const StateContext = createContext(); | ||
|
||
export const StateProvider = ({ reducer, initialState, children }) => ( | ||
<StateContext.Provider value={useReducer(reducer, initialState)}> | ||
{children} | ||
</StateContext.Provider> | ||
) | ||
<StateContext.Provider value={useReducer(reducer, initialState)}> | ||
{children} | ||
</StateContext.Provider> | ||
); | ||
|
||
// Hook which allows us to pull information from the data layer | ||
export const useStateValue = () => useContext(StateContext); | ||
export const useStateValue = () => { | ||
const context = useContext(StateContext); | ||
if (context === undefined) { | ||
throw new Error("useStateValue must be used within a StateProvider"); | ||
} | ||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { actionTypes } from "./reducer"; | ||
|
||
export const setSearchTerm = term => ({ | ||
type: actionTypes.SET_SEARCH_TERM, | ||
term, | ||
}); | ||
|
||
export const setNumResults = numResults => ({ | ||
type: actionTypes.SET_NUM_RESULTS, | ||
numResults, | ||
}); | ||
export const setOpenAIKey = openAIKey => ({ | ||
type: actionTypes.SET_OPENAI_KEY, | ||
openAIKey, | ||
}); | ||
|
||
export const setGptModel = model => ({ | ||
type: actionTypes.SET_GPT_MODEL, | ||
model, | ||
}); | ||
|
||
export const clearHistory = () => ({ | ||
type: actionTypes.CLEAR_HISTORY, | ||
}); | ||
|
||
export const setError = error => ({ | ||
type: actionTypes.SET_ERROR, | ||
error, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
.search__input { | ||
display: flex; | ||
align-items: center; | ||
border: 1px solid lightgray; | ||
height: 30px; | ||
padding: 10px 20px; | ||
border-radius: 50px; | ||
width: 75vw; | ||
max-width: 560px; | ||
margin: 0 auto; | ||
margin-top: 40px; | ||
display: flex; | ||
align-items: center; | ||
border: 1px solid lightgray; | ||
height: 30px; | ||
padding: 10px 20px; | ||
border-radius: 50px; | ||
width: 75vw; | ||
max-width: 560px; | ||
margin: 0 auto; | ||
margin-top: 40px; | ||
} | ||
|
||
.search__input > input { | ||
flex: 1; | ||
padding: 10px 20px; | ||
font-size: medium; | ||
border: none; | ||
flex: 1; | ||
padding: 10px 20px; | ||
font-size: medium; | ||
border: none; | ||
} | ||
|
||
.search__input > input:focus { | ||
outline-width: 0; | ||
outline-width: 0; | ||
} | ||
|
||
.search__inputIcon { | ||
color: gray; | ||
color: gray; | ||
} | ||
|
||
.search__buttons { | ||
margin-top: 20px; | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 20px; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.search__buttons button { | ||
margin: 5px; | ||
padding: 7px 15px; | ||
background-color: #f8f8f8; | ||
border: 1px solid #FFF; | ||
text-transform: inherit; | ||
color: #5f6368; | ||
margin: 5px; | ||
padding: 7px 15px; | ||
background-color: #f8f8f8; | ||
border: 1px solid #fff; | ||
text-transform: inherit; | ||
color: #5f6368; | ||
} | ||
|
||
.search__buttons button:hover { | ||
box-shadow: 0 1px 1px rgba(0, 0, 0, .1); | ||
background-image: -webkit-linear-gradient(top, #f8f8f8, #f1f1f1); | ||
background-color: #f8f8f8; | ||
border: 1px solid #c6c6c6; | ||
color: #222; | ||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); | ||
background-image: -webkit-linear-gradient(top, #f8f8f8, #f1f1f1); | ||
background-color: #f8f8f8; | ||
border: 1px solid #c6c6c6; | ||
color: #222; | ||
} | ||
|
||
.search__buttonHidden { | ||
display: none !important; | ||
} | ||
display: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './App'; | ||
import reducer, { initialState } from './reducer'; | ||
import { StateProvider } from './StateContext'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App"; | ||
import reducer, { initialState } from "./reducer"; | ||
import { StateProvider } from "./StateContext"; | ||
|
||
ReactDOM.render( | ||
const rootNode = document.getElementById("root"); | ||
|
||
ReactDOM.createRoot(rootNode).render( | ||
<React.StrictMode> | ||
<StateProvider initialState={initialState} reducer={reducer}> | ||
<App /> | ||
</StateProvider> | ||
</React.StrictMode>, | ||
document.getElementById('root') | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
da0314f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ajou-libra – ./
ajou-libra-alfex4936.vercel.app
ajou-libra.vercel.app
ajou-libra-git-main-alfex4936.vercel.app