Commit
af28bec
ยท
verified ยท
1 Parent(s): aee3e85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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 latest stock news for {company} on {date} in Korean. If there's no specific news for that date, provide the most recent relevant information in Korean."}
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: