-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5eeaa40
commit a8c21b2
Showing
10 changed files
with
2,275 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
secret.txt | ||
|
||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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,2 +1,3 @@ | ||
from chatgpt_linebot.modules.gpt import chat_completion | ||
from chatgpt_linebot.modules.horoscope import Horoscope | ||
from chatgpt_linebot.modules.youtube_recommend import recommend_videos |
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,27 @@ | ||
import json | ||
import random | ||
|
||
import g4f | ||
|
||
from chatgpt_linebot.prompts import youtube_recommend_template | ||
|
||
path = './data/favorite_videos.json' | ||
|
||
with open(path, 'r', encoding='utf-8') as file: | ||
favorite_videos = json.load(file) | ||
|
||
|
||
def recommend_videos(): | ||
"""Recommend youtube videos randomly""" | ||
push_video = random.sample(favorite_videos, 3) | ||
|
||
prompt = f"{youtube_recommend_template}{push_video}" | ||
|
||
try: | ||
response = g4f.ChatCompletion.create( | ||
model=g4f.models.default, | ||
messages=[{"role": "user", "content": prompt}], | ||
) | ||
return response | ||
except Exception as e: | ||
print(e) |
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 +1 @@ | ||
from .template import girlfriend, horoscope_template | ||
from .template import girlfriend, horoscope_template, youtube_recommend_template |
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.