98 lines
4.7 KiB
Python
98 lines
4.7 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""
|
||
新闻智能跟踪系统 - 全局配置
|
||
所有环境相关配置集中在此,便于迁移与扩展。
|
||
后期接入真实数据源时,只需在 sources 适配层实现 fetch() 即可,其余逻辑不变。
|
||
"""
|
||
import os
|
||
|
||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||
DATA_DIR = os.path.join(BASE_DIR, "data")
|
||
LOG_DIR = os.path.join(BASE_DIR, "logs")
|
||
STATIC_DIR = os.path.join(BASE_DIR, "static")
|
||
TEMPLATE_DIR = os.path.join(BASE_DIR, "templates")
|
||
DB_PATH = os.path.join(DATA_DIR, "news_tracker.db")
|
||
|
||
os.makedirs(DATA_DIR, exist_ok=True)
|
||
os.makedirs(LOG_DIR, exist_ok=True)
|
||
|
||
# ---------------- 服务 ----------------
|
||
SERVICE_PORT = 16100
|
||
SERVICE_HOST = "0.0.0.0"
|
||
SERVICE_NAME = "新闻智能跟踪系统"
|
||
|
||
# ---------------- 大模型(DeepSeek) ----------------
|
||
LLM_BASE_URL = "https://api.deepseek.com"
|
||
LLM_API_KEY = "sk-edb9df58ff574f8c98df1cd6a425e97c"
|
||
LLM_MODEL = "deepseek-v4-flash" # 推理型,分析质量高
|
||
LLM_TIMEOUT = 120
|
||
LLM_MAX_TOKENS = 1500
|
||
LLM_TEMPERATURE = 0.3
|
||
|
||
# ---------------- 邮件通知(默认值,可在设置区修改) ----------------
|
||
MAIL_DEFAULTS = {
|
||
"smtp_host": "mail.tphai.com",
|
||
"smtp_port": 587,
|
||
"smtp_user": "hz4th_coder@tphai.com",
|
||
"smtp_pass": "hz4th_coder@!",
|
||
"smtp_mode": "plain", # plain(无加密) / starttls / ssl
|
||
"email_to": "wlq@tphai.com",
|
||
"sender_name": "新闻智能跟踪",
|
||
}
|
||
|
||
# ---------------- 自动化(默认值,可在设置区修改) ----------------
|
||
AUTO_DEFAULTS = {
|
||
"auto_collect": 1, # 是否自动定时采集
|
||
"scan_interval_min": 30, # 采集扫描间隔(分钟)
|
||
"realtime_threshold": 80, # 总分 >= 该值 → 实时邮件通知
|
||
"llm_threshold": 60, # 规则分 >= 该值 → 进入 LLM 深度分析
|
||
"realtime_enabled": 1, # 是否启用实时重要资讯邮件
|
||
"summary_enabled": 1, # 是否启用每日汇总
|
||
"summary_time": "10:00", # 每日汇总时间
|
||
"summary_window_hours": 24, # 汇总窗口(往前 N 小时)
|
||
"max_summary_items": 15, # 汇总邮件最多条目数
|
||
}
|
||
|
||
# ---------------- 默认兴趣画像(可在网页修改) ----------------
|
||
DEFAULT_KEYWORDS = [
|
||
("大模型", 8), ("人工智能", 6), ("AI", 6), ("芯片", 7), ("GPU", 6),
|
||
("算力", 6), ("开源", 6), ("智能体", 7), ("Agent", 6), ("多模态", 6),
|
||
("自动驾驶", 6), ("机器人", 5), ("具身智能", 6), ("推理", 4), ("数据中心", 5),
|
||
("融资", 5), ("IPO", 5), ("收购", 6), ("政策", 4), ("监管", 6),
|
||
("制裁", 7), ("禁令", 8), ("安全", 4), ("量子计算", 5), ("人才", 3),
|
||
("裁员", 5), ("突破", 5), ("新模型", 8), ("发布会", 5),
|
||
]
|
||
|
||
DEFAULT_DOMAINS = [
|
||
("AI模型与算法", 9), ("芯片与硬件", 8), ("云计算与算力", 6),
|
||
("政策与监管", 7), ("投融资", 6), ("企业动态", 5),
|
||
("学术研究", 4), ("开源生态", 6),
|
||
]
|
||
|
||
DEFAULT_COMPANIES = [
|
||
"OpenAI", "Anthropic", "Google", "Microsoft", "Meta", "NVIDIA",
|
||
"AMD", "苹果", "Apple", "亚马逊", "Amazon", "Tesla", "特斯拉",
|
||
"华为", "百度", "阿里巴巴", "阿里", "腾讯", "字节跳动", "DeepSeek",
|
||
"智谱", "月之暗面", "Kimi", "MiniMax", "商汤", "科大讯飞", "阿里云",
|
||
"台积电", "TSMC", "三星", "英特尔", "Intel", "高通", "中芯国际",
|
||
"英伟达", "Mistral", "xAI", "Grok", "百度文心", "通义千问", "豆包",
|
||
]
|
||
|
||
# 内置数据源模板(首次初始化时写入,可在网页管理)
|
||
DEFAULT_SOURCES = [
|
||
{"name": "OpenAI 官方动态", "type": "公司动态", "url": "https://openai.com/news",
|
||
"description": "OpenAI 官方新闻与产品发布", "weight": 1.0},
|
||
{"name": "AI 科技媒体(模拟)", "type": "科技媒体", "url": "https://example.com/ai-news",
|
||
"description": "综合 AI 领域科技媒体(模拟数据源)", "weight": 0.8},
|
||
{"name": "arXiv 学术论文", "type": "学术论文", "url": "https://arxiv.org/list/cs.AI/recent",
|
||
"description": "人工智能领域最新论文", "weight": 0.6},
|
||
{"name": "GitHub 开源趋势", "type": "开源社区", "url": "https://github.com/trending",
|
||
"description": "开源项目趋势与发布", "weight": 0.7},
|
||
{"name": "政策与监管", "type": "政策法规", "url": "https://example.com/policy",
|
||
"description": "各国 AI 政策、监管与出口管制动态", "weight": 0.9},
|
||
{"name": "行业报告与调研", "type": "行业报告", "url": "https://example.com/report",
|
||
"description": "行业数据报告、市场调研", "weight": 0.7},
|
||
{"name": "科技投资动态", "type": "投融资", "url": "https://example.com/funding",
|
||
"description": "AI 领域融资、并购、IPO 动态", "weight": 0.9},
|
||
]
|