Skip to content

Commit

Permalink
file path auto adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
waveBoom committed Apr 24, 2024
1 parent e6a55cc commit 1a36475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/daily_hot_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import feedparser
import html2text
import concurrent.futures

import os
from app.gpt import get_answer_from_llama_web

with open("app/data/hot_news_rss.json", "r") as f:
current_file_path = os.path.abspath(__file__)
current_dir_path = os.path.dirname(current_file_path)
hot_news_file_path = os.path.join(current_dir_path, "data", "hot_news_rss.json")

with open(hot_news_file_path, "r") as f:
rss_urls = json.load(f)

TODAY = today = date.today()
Expand Down
10 changes: 8 additions & 2 deletions app/slash_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import json
import os

with open("app/data/prompt.json", "r") as f:

current_file_path = os.path.abspath(__file__)
current_dir_path = os.path.dirname(current_file_path)
slash_propmt_file_path = os.path.join(current_dir_path, "data", "prompt.json")

with open(slash_propmt_file_path, "r") as f:
prompt_data = json.load(f)

def register_slack_slash_commands(slack_app):
Expand Down Expand Up @@ -256,4 +262,4 @@ def handle_command_gpt_as_regex_master(ack, say, command):
text=f"<@{user_id}>, let's talk!",
blocks=blocks,
reply_broadcast=True
)
)

0 comments on commit 1a36475

Please sign in to comment.