Skip to content

Commit 6df6932

Browse files
authored
260401 #347 ticker updater 개편 및 company names 한글 표시 자동화 (#349)
* [AI][FEAT] 한글 이름 업데이터 작성 완료 * [AI][DOCS] ticker_master_updater 삭제 * [BE] [REFACT] ticker 원본은 유지하고, 표시용 displayTicker를 분리 * [AI] [FEAT] 위키 실패 시 Wikidata fallback으로 한글명 조회 * [AI] [FIX] save_to_db 예외 처리 범위 수정 * [AI] [FEAT] 추가 티커 LLM으로 한글화
1 parent 7cf18a6 commit 6df6932

18 files changed

Lines changed: 1722 additions & 223 deletions

File tree

AI/libs/llm/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
try:
77
from .gemini import GeminiClient
88
except Exception as gemini_import_error:
9+
_gemini_import_error = gemini_import_error
10+
911
class GeminiClient: # type: ignore[no-redef]
1012
def __init__(self, *args, **kwargs):
1113
raise ImportError(
1214
"GeminiClient requires the `google-genai` package. "
1315
"Install it with `pip install -U google-genai`."
14-
) from gemini_import_error
16+
) from _gemini_import_error
1517

1618
__all__ = [
1719
"BaseLLMClient",

AI/libs/llm/gemini.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def _extract_text(self, response) -> str:
4747

4848
raise RuntimeError("Gemini response did not contain text.")
4949

50+
@staticmethod
51+
def _format_error_summary(error_text: str, max_len: int = 220) -> str:
52+
text = str(error_text or "").strip().replace("\r", " ").replace("\n", " ")
53+
text = " ".join(text.split())
54+
if len(text) <= max_len:
55+
return text
56+
return text[: max_len - 3] + "..."
57+
5058
def generate_text(self, prompt: str, system_prompt: Optional[str] = None, **kwargs) -> str:
5159
try:
5260
config = types.GenerateContentConfig(
@@ -67,7 +75,8 @@ def generate_text(self, prompt: str, system_prompt: Optional[str] = None, **kwar
6775
return text
6876
except Exception as e:
6977
self.set_last_error(e)
70-
print(f"[GeminiClient][Error] Text generation failed: {self.last_error}")
78+
summary = self._format_error_summary(self.last_error or str(e))
79+
print(f"[GeminiClient][Error] Text generation failed: {summary}")
7180
return ""
7281

7382
def get_health(self) -> bool:

AI/modules/data_collector/components/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from .event_data import EventDataCollector
99
from .market_breadth_data import MarketBreadthCollector
1010
from .market_breadth_stats import MarketBreadthStatsCollector
11+
from .ticker_updater import TickerUpdater
12+
from .company_name_korean_updater import CompanyNameKoreanUpdater
1113
# from .news_data import NewsDataCollector # 뉴스 모듈 구현 시 주석 해제
1214

1315
__all__ = [
@@ -19,5 +21,7 @@
1921
"EventDataCollector",
2022
"MarketBreadthCollector",
2123
"MarketBreadthStatsCollector",
24+
"TickerUpdater",
25+
"CompanyNameKoreanUpdater",
2226
# "NewsDataCollector", # 뉴스 모듈 구현 시 주석 해제
23-
]
27+
]

0 commit comments

Comments
 (0)