feat: AI 웹 스크래퍼 프로젝트의 초기 구조와 핵심 기능 구현

This commit is contained in:
2025-08-28 10:23:24 +09:00
commit fdf330143f
10 changed files with 797 additions and 0 deletions

53
AI_Web_Scraper/main.py Normal file
View File

@@ -0,0 +1,53 @@
import sys
import json
from model_downloader import download_model
from ai_agent import AIAgent
import argparse
def main():
parser = argparse.ArgumentParser(description='AI 웹 정보 수집 시스템')
parser.add_argument('--topics', nargs='+', help='수집할 주제 목록', default=None)
parser.add_argument('--config', default='./config.json', help='설정 파일 경로')
parser.add_argument('--auto-topics', action='store_true', help='AI가 스스로 주제를 선정하여 조사')
args = parser.parse_args()
print("AI 웹 정보 수집 시스템 시작")
# 1. 모델 다운로드 (필요한 경우)
print("모델 확인 중...")
model, tokenizer = download_model(args.config)
if model is None:
print("모델 다운로드 실패. 프로그램을 종료합니다.")
sys.exit(1)
# 2. AI 에이전트 초기화
print("AI 에이전트 초기화 중...")
agent = AIAgent(args.config)
# 3. 주제 결정
if args.auto_topics or args.topics is None:
print("AI가 스스로 주제를 선정합니다...")
topics = agent.generate_topics(num_topics=3)
print(f"선정된 주제: {topics}")
else:
topics = args.topics
# 4. 정보 수집 실행
print(f"다음 주제들에 대해 정보를 수집합니다: {topics}")
results = agent.collect_information(topics)
# 5. 결과 출력
print("\n=== 수집 결과 ===")
for result in results:
print(f"주제: {result['topic']}")
print(f"응답: {result['response']}")
print("-" * 50)
# 6. 정리
agent.close()
print("프로그램 완료")
if __name__ == "__main__":
main()