Skip to content

Commit

Permalink
Merge pull request #46 from tharoosha/joel-dev2
Browse files Browse the repository at this point in the history
Joel dev2
  • Loading branch information
tharoosha authored Oct 28, 2023
2 parents 175b7bd + 3aee9bd commit 2769ec7
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 397 deletions.
88 changes: 46 additions & 42 deletions frontend/src/components/YoutubePreferences.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { Link } from 'react-router-dom';
import Header from './Header';

function YoutubePreferences() {
const [categoriesName, setCategoriesName] = useState([]);
Expand Down Expand Up @@ -44,58 +45,61 @@ function YoutubePreferences() {
};

return (
<div className="AI mt--24 mb--48">
<div className="container">
<div className="AI__wrapper">
<div className=" AI__wrapper__inner__2">
<div className="AI__wrapper__inner__2__header">
<p>Please select your preferences and I will recommend you videos based on your preferences.</p>
</div>
<>
<Header />
<div className="AI mt--24 mb--48">
<div className="container">
<div className="AI__wrapper">
<div className=" AI__wrapper__inner__2">
<div className="AI__wrapper__inner__2__header">
<p>Please select your preferences and I will recommend you videos based on your preferences.</p>
</div>

<div className="preference__wrapper__inner__2__footer">
<div className="preference-suggestions">
<h2>YouTube Video Preferences</h2>
<div className="check-container">
{categoriesName.map((category) => (
<div key={category.id}>
<label>
<input type="checkbox" checked={selectedCategories.includes(category.snippet.title)} onChange={() => handleCategoryChange(category.snippet.title)} />
{category.snippet.title}
</label>
</div>
))}
<div className="preference__wrapper__inner__2__footer">
<div className="preference-suggestions">
<h2>YouTube Video Preferences</h2>
<div className="check-container">
{categoriesName.map((category) => (
<div key={category.id}>
<label>
<input type="checkbox" checked={selectedCategories.includes(category.snippet.title)} onChange={() => handleCategoryChange(category.snippet.title)} />
{category.snippet.title}
</label>
</div>
))}
</div>
</div>
</div>
</div>
<div>
<div>
<button type="submit" className="btn btn-primary" onClick={handleSubmit}>
Submit
</button>
<button
type="submit"
style={{
marginLeft: '24px',
}}
className="btn btn-secondary"
onClick={handlegetData}
>
Get Saved Data
</button>
<div
style={{
borderBottom: 50,
marginTop: '30px',
}}
>
<Link to="/yt-recommendation">Watch Recommendation Videos</Link>
<div>
<button type="submit" className="btn btn-primary" onClick={handleSubmit}>
Submit
</button>
<button
type="submit"
style={{
marginLeft: '24px',
}}
className="btn btn-secondary rem-margin-mob"
onClick={handlegetData}
>
Get Saved Data
</button>
<div
style={{
borderBottom: 50,
marginTop: '30px',
}}
>
<Link to="/yt-recommendation">Watch Recommendation Videos</Link>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</>
);
}

Expand Down
14 changes: 2 additions & 12 deletions frontend/src/pages/AI_Assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ const AI_Assistant = () => {
.post('http://localhost:5001/api/voice-input', formData)
.then((response) => {
console.log(response.data.result);
let data = response.data.result
data = String(data)
let data = response.data.result;
data = String(data);
const updatedChatLogWithVoice = [...chatLog, { user: 'User', message: data }];
setChatLog(updatedChatLogWithVoice);
// setMessage(response.data.result);
Expand All @@ -111,7 +111,6 @@ const AI_Assistant = () => {
.catch((error) => console.error(error));
// console.log(chatLog);
console.log(emotion);

})
.catch((error) => console.error(error));
};
Expand Down Expand Up @@ -141,7 +140,6 @@ const AI_Assistant = () => {
})
.catch((error) => console.error(error));


axios
.post('http://localhost:5001/api/emotion_analyze', { message: message })
.then((response) => {
Expand Down Expand Up @@ -185,14 +183,6 @@ const AI_Assistant = () => {
))}
</div>
<div className="AI__wrapper__inner__2__footer">
<div className="chat-suggestions">
<p>Chat Suggestions</p>
<div>
<label>Regenerate Response</label>
<label>Explain More</label>
<label>Expand Answer</label>
</div>
</div>
<div className="flex">
<form onSubmit={handleSubmit}>
<div className="AI__wrapper__inner__2__footer__left">
Expand Down
Loading

0 comments on commit 2769ec7

Please sign in to comment.