Skip to content

Commit

Permalink
change ai model + update time estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremySpence272 committed Sep 5, 2024
1 parent 2e3b724 commit b2a7cf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
13 changes: 11 additions & 2 deletions client/src/pages/Generate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Detail = {
summary: string;
format: "video" | "article";
link?: string;
timeEstimate?: number;
};

type Subtopic = {
Expand Down Expand Up @@ -218,6 +219,9 @@ const Generate: React.FC = () => {
link: resourceData
? resourceData.video_url || resourceData.article_url
: "No resource found",
timeEstimate: resourceData
? resourceData.duration || 10
: "No resource found",
};
}),
};
Expand Down Expand Up @@ -485,7 +489,10 @@ const Generate: React.FC = () => {

subtopics.forEach((subtopic, i) => {
let details: CardDetails = {
timeEstimate: 40,
timeEstimate: subtopic.detail_list!.reduce(
(total, detail) => total + (detail.timeEstimate || 0),
0
),
notes: subtopic.summary,
checklist: [],
};
Expand Down Expand Up @@ -724,7 +731,9 @@ const Generate: React.FC = () => {
position="relative"
>
<Heading as="h6" size="sm">
{detail.name}
{detail.name}{" "}
{detail.timeEstimate &&
` ~ (${detail.timeEstimate} mins)`}
</Heading>
<Text pr={8} mt={1}>
{detail.summary}
Expand Down
10 changes: 6 additions & 4 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def get_subtopic_details():
Instead, rephrase the text to exclude these characters."""

response = client.chat.completions.create(
model="gpt-3.5-turbo",
model="gpt-4o-mini",
messages=[
{
"role": "system",
Expand Down Expand Up @@ -725,7 +725,7 @@ def refine_subtopics():
print(f"Instructions: {instructions}")

response = client.chat.completions.create(
model="gpt-3.5-turbo",
model="gpt-4o-mini",
messages=[
{
"role": "system",
Expand Down Expand Up @@ -801,12 +801,13 @@ def get_youtube_tutorial(topic):

if result['result']:
video = result['result'][0]
duration = int(video['duration'].split(':')[0])
return {
'topic': topic,
'video_url': video['link'],
'title': video['title'],
'description': video['descriptionSnippet'][0]['text'] if video['descriptionSnippet'] else 'No description available',
'duration': video['duration']
'duration': duration
}
else:
return {
Expand Down Expand Up @@ -837,7 +838,8 @@ def get_bing_article(topic):
'topic': topic,
'article_url': item['url'],
'title': item['name'],
'snippet': item['snippet']
'snippet': item['snippet'],
'duration': 10
}
else:
return {
Expand Down

0 comments on commit b2a7cf7

Please sign in to comment.