Update app.py
Browse files
app.py
CHANGED
@@ -73,11 +73,16 @@ API_KEY = "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" # ์ฌ๊ธฐ์ P
|
|
73 |
def get_real_news_summary(company, date):
|
74 |
# OpenAI ํด๋ผ์ด์ธํธ ์ด๊ธฐํ
|
75 |
client = OpenAI(api_key=API_KEY, base_url="https://api.perplexity.ai")
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
# API ์์ฒญ์ ์ํ ๋ฉ์์ง ๊ตฌ์ฑ - ํ๊ตญ์ด๋ก๋ง ์๋ต์ ๋ฐ๋๋ก ์ง์
|
78 |
messages = [
|
79 |
{"role": "system", "content": "You are a helpful assistant that summarizes stock news strictly in Korean."},
|
80 |
-
{"role": "user", "content": f"Summarize the
|
81 |
]
|
82 |
|
83 |
try:
|
|
|
73 |
def get_real_news_summary(company, date):
|
74 |
# OpenAI ํด๋ผ์ด์ธํธ ์ด๊ธฐํ
|
75 |
client = OpenAI(api_key=API_KEY, base_url="https://api.perplexity.ai")
|
76 |
+
|
77 |
+
# ๋ ์ง ํ์์ ๋ง์ถฐ์ฃผ๊ธฐ ์ํ ์ฒ๋ฆฌ
|
78 |
+
target_date = datetime.strptime(date, '%Y-%m-%d')
|
79 |
+
start_date = (target_date - timedelta(days=1)).strftime('%Y-%m-%d')
|
80 |
+
end_date = (target_date + timedelta(days=1)).strftime('%Y-%m-%d')
|
81 |
|
82 |
# API ์์ฒญ์ ์ํ ๋ฉ์์ง ๊ตฌ์ฑ - ํ๊ตญ์ด๋ก๋ง ์๋ต์ ๋ฐ๋๋ก ์ง์
|
83 |
messages = [
|
84 |
{"role": "system", "content": "You are a helpful assistant that summarizes stock news strictly in Korean."},
|
85 |
+
{"role": "user", "content": f"Summarize the stock news for {company} between {start_date} and {end_date} in Korean. Only focus on news within this date range."}
|
86 |
]
|
87 |
|
88 |
try:
|