Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ WECHAT_MCP_ALLOWED_HOSTS=
# --- 群聊总结:Codex GPT 主用,DeepSeek 备用 ---
SUMMARY_PROVIDER_PRIMARY=codex
SUMMARY_PROVIDER_FALLBACK=deepseek
CODEX_SUMMARY_MODEL=gpt-5.6-sol
CODEX_SUMMARY_MODEL=gpt-6-astra
CODEX_SUMMARY_TIMEOUT_SECONDS=240
CODEX_SUMMARY_MAX_RETRIES=2
CODEX_SUMMARY_REQUEST_CONCURRENCY=2
Expand Down
2 changes: 1 addition & 1 deletion app/ai/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

策略:
- 复用 V1/V2 共用的 Codex GPT / DeepSeek 主备调用(重试/超时);
- 主模型固定使用 settings.codex_summary_model(默认 gpt-5.6-sol);
- 主模型固定使用 settings.codex_summary_model(默认 gpt-6-astra);
- 模板(templates/image_prompt/)控制最终 Prompt 的输出结构,可编辑;
- 超长聊天采用「分块 → 逐块提取事件(JSON) → 合并去重 → 按模板生成」,
避免简单暴力截断丢失重要内容;
Expand Down
2 changes: 1 addition & 1 deletion app/ai/prompt_builder_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ class PromptOutput:
success: bool
prompt: str = ""
error: str = ""
model: str = "gpt-5.6-sol"
model: str = "gpt-6-astra"
meta: dict[str, Any] | None = None # 模型调用结构化元数据(不含 API Key)
2 changes: 1 addition & 1 deletion app/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Settings(BaseSettings):
# 群聊总结主备路由:Codex GPT 主用,DeepSeek 备用。
summary_provider_primary: str = "codex"
summary_provider_fallback: str = "deepseek"
codex_summary_model: str = "gpt-5.6-sol"
codex_summary_model: str = "gpt-6-astra"
# 结构化群聊整理在高峰期可能超过 4 分钟;600 秒仍有明确上限,
# 同时避免把正常的长响应误判成不可自动恢复的结果未知。
codex_summary_timeout_seconds: int = 600
Expand Down
4 changes: 2 additions & 2 deletions app/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Group(SQLModel, table=True):
send_time: str = "08:30" # 兼容旧数据;实际发送读取全局 schedule_send_time
summary_provider: str = "" # 周报摘要 AI;空值继承全局
prompt_provider: str = "" # 日报 Prompt AI;空值继承全局
summary_model: str = "gpt-5.6-sol" # 总结主模型
prompt_model: str = "gpt-5.6-sol" # Prompt 主模型
summary_model: str = "gpt-6-astra" # 总结主模型
prompt_model: str = "gpt-6-astra" # Prompt 主模型
image_enabled: bool = True # 是否生图
send_target: str = "" # 可选人工发送目标;为空时自动跟随 wechat_group_name
ranking_template: str = "default" # 排行榜模板名
Expand Down
8 changes: 4 additions & 4 deletions app/db/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def _ensure_relationship_schema_current() -> None:
"send_time": "VARCHAR(8) NOT NULL DEFAULT '08:30'",
"summary_provider": "VARCHAR(32) NOT NULL DEFAULT ''",
"prompt_provider": "VARCHAR(32) NOT NULL DEFAULT ''",
"summary_model": "VARCHAR(64) NOT NULL DEFAULT 'gpt-5.6-sol'",
"prompt_model": "VARCHAR(64) NOT NULL DEFAULT 'gpt-5.6-sol'",
"summary_model": "VARCHAR(64) NOT NULL DEFAULT 'gpt-6-astra'",
"prompt_model": "VARCHAR(64) NOT NULL DEFAULT 'gpt-6-astra'",
"image_enabled": "BOOLEAN NOT NULL DEFAULT 1",
"send_target": "VARCHAR(256) NOT NULL DEFAULT ''",
"ranking_template": "VARCHAR(64) NOT NULL DEFAULT 'default'",
Expand Down Expand Up @@ -317,12 +317,12 @@ def _migrate_codex_summary_defaults() -> None:
session.exec(
Group.__table__.update()
.where(Group.summary_model.in_(legacy_models))
.values(summary_model="gpt-5.6-sol")
.values(summary_model="gpt-6-astra")
)
session.exec(
Group.__table__.update()
.where(Group.prompt_model.in_(legacy_models))
.values(prompt_model="gpt-5.6-sol")
.values(prompt_model="gpt-6-astra")
)
session.add(Setting(key=marker, value="done"))
session.commit()
Expand Down
2 changes: 1 addition & 1 deletion app/providers/ai/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CodexGPTProvider(DeepSeekV4FlashProvider):
"""复用既有总结编排,以 Codex GPT 执行底层文本调用。"""

name = "codex_gpt"
model = "gpt-5.6-sol"
model = "gpt-6-astra"

def __init__(self, settings: Settings):
# 不调用父类初始化:父类会把 ai_model(DeepSeek 备用模型)写入
Expand Down
6 changes: 3 additions & 3 deletions app/services/group_provider_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def normalize_history_provider(value: object) -> str:


def provider_catalog(settings: Settings) -> dict:
codex_model = str(settings.codex_summary_model or "gpt-5.6-sol").strip()
codex_model = str(settings.codex_summary_model or "gpt-6-astra").strip()
deepseek_model = str(settings.ai_model or "deepseek-v4-flash").strip()
codex_binary = shutil.which(settings.codex_path or "codex")
return {
Expand Down Expand Up @@ -76,7 +76,7 @@ def resolve_group_ai_settings(
provider = configured_provider
if not provider and configured_model:
# 旧数据库只有 model 字段:按当前受控白名单推导 Provider,不混用未知值。
if configured_model == str(settings.codex_summary_model or "gpt-5.6-sol").strip():
if configured_model == str(settings.codex_summary_model or "gpt-6-astra").strip():
provider = "codex"
elif configured_model == str(settings.ai_model or "deepseek-v4-flash").strip():
provider = "deepseek"
Expand All @@ -87,7 +87,7 @@ def resolve_group_ai_settings(
raise ValueError(f"不支持的 {capability} Provider:{configured_provider or provider}")

default_model = (
str(settings.codex_summary_model or "gpt-5.6-sol").strip()
str(settings.codex_summary_model or "gpt-6-astra").strip()
if provider == "codex"
else str(settings.ai_model or "deepseek-v4-flash").strip()
)
Expand Down
4 changes: 2 additions & 2 deletions config/groups.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ groups:
send_time: "08:30"

# 总结模型 / Prompt 主模型(DeepSeek V4 Flash 为系统级备用)
summary_model: "gpt-5.6-sol"
prompt_model: "gpt-5.6-sol"
summary_model: "gpt-6-astra"
prompt_model: "gpt-6-astra"

# 是否生图(false 时跳过生图,PROMPT_READY 后直接 READY_TO_SEND)
image_enabled: true
Expand Down
6 changes: 3 additions & 3 deletions frontend/e2e/recovery-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ test("群配置只展示后端白名单并支持两种统计规则", async ({ pa
schedule_rule: "daily_previous_day",
send_time: "08:30",
summary_provider: "codex",
summary_model: "gpt-5.6-sol",
summary_model: "gpt-6-astra",
prompt_provider: "codex",
prompt_model: "gpt-5.6-sol",
prompt_model: "gpt-6-astra",
image_enabled: true,
send_target: "",
ranking_template: "default",
Expand All @@ -110,7 +110,7 @@ test("群配置只展示后端白名单并支持两种统计规则", async ({ pa
{ provider: "wechat_cli", label: "wechat-cli", available: false, capabilities: ["history"] },
],
ai: [
{ provider: "codex", label: "Codex GPT", available: true, models: ["gpt-5.6-sol"], capabilities: ["summary", "prompt"] },
{ provider: "codex", label: "Codex GPT", available: true, models: ["gpt-6-astra"], capabilities: ["summary", "prompt"] },
{ provider: "deepseek", label: "DeepSeek", available: false, models: ["deepseek-v4-flash"], capabilities: ["summary", "prompt"] },
],
},
Expand Down
6 changes: 3 additions & 3 deletions tests/test_codex_summary_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _settings(**overrides) -> Settings:
"_env_file": None,
"summary_provider_primary": "codex",
"summary_provider_fallback": "deepseek",
"codex_summary_model": "gpt-5.6-sol",
"codex_summary_model": "gpt-6-astra",
"codex_summary_max_retries": 1,
"codex_summary_timeout_seconds": 30,
"codex_summary_request_concurrency": 1,
Expand Down Expand Up @@ -70,7 +70,7 @@ def fake_run(command, **kwargs):
assert fallback.calls == 0
assert "私密群聊正文" not in " ".join(captured["command"])
assert "私密群聊正文" in captured["input"]
assert captured["command"][captured["command"].index("--model") + 1] == "gpt-5.6-sol"
assert captured["command"][captured["command"].index("--model") + 1] == "gpt-6-astra"
assert captured["command"][captured["command"].index("--sandbox") + 1] == "read-only"
assert "--ephemeral" in captured["command"]
assert "--ignore-user-config" in captured["command"]
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_codex_not_submitted_and_deepseek_failure_returns_clear_error(monkeypatc
def test_default_factory_builds_codex_gpt_provider():
provider = build_summary_provider(_settings())
assert isinstance(provider, CodexGPTProvider)
assert provider.model == "gpt-5.6-sol"
assert provider.model == "gpt-6-astra"


@pytest.mark.parametrize(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_group_provider_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def test_group_ai_config_inherits_global_and_rejects_unknown_model():
settings = Settings(
_env_file=None,
summary_provider_primary="codex",
codex_summary_model="gpt-5.6-sol",
codex_summary_model="gpt-6-astra",
)
group = Group(display_name="群", prompt_provider="", prompt_model="")
resolved, meta = resolve_group_ai_settings(settings, group, capability="prompt")
assert meta == {
"provider": "codex",
"model": "gpt-5.6-sol",
"model": "gpt-6-astra",
"inherited": True,
"capability": "prompt",
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_default_summary_provider_is_codex_gpt():
settings = Settings(_env_file=None, summary_provider_primary="codex", ai_api_key="")
provider = PromptService(settings)._get_provider()
assert provider.name == "codex_gpt"
assert provider.model == "gpt-5.6-sol"
assert provider.model == "gpt-6-astra"


def test_v1_model_failure_does_not_degrade_to_template_in_real_runtime():
Expand All @@ -121,7 +121,7 @@ def health_check(self):
return False, "failed"

def generate_image_prompt(self, context):
return ImagePromptResult(False, error="主备都失败", provider=self.name, model="gpt-5.6-sol")
return ImagePromptResult(False, error="主备都失败", provider=self.name, model="gpt-6-astra")

service = PromptService(Settings(_env_file=None, summary_provider_primary="codex"))
service._provider = FailingProvider()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_v2_group_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_codex_summary_defaults_migrate_once_and_keep_fallback_model(tmp_path, m

with Session(engine) as session:
groups = list(session.exec(select(Group).order_by(Group.id)).all())
assert (groups[0].summary_model, groups[0].prompt_model) == ("gpt-5.6-sol", "gpt-5.6-sol")
assert (groups[0].summary_model, groups[0].prompt_model) == ("gpt-6-astra", "gpt-6-astra")
assert (groups[1].summary_model, groups[1].prompt_model) == ("custom-model", "custom-model")
assert session.get(Setting, "ai_model").value == "deepseek-v4-flash"
assert session.get(Setting, "migration_codex_summary_primary_v1").value == "done"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_v2_prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _raw_json_from_user(user: str) -> dict:


class FakeSummaryProvider:
model = "gpt-5.6-sol"
model = "gpt-6-astra"

def __init__(self, fail: Exception | None = None):
self.calls: list[tuple[str, str]] = []
Expand Down
4 changes: 2 additions & 2 deletions tests/test_v2_ranking_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ def test_group_v2_defaults():
g = Group()
assert g.schedule_rule == "daily_previous_day"
assert g.send_time == "08:30"
assert g.summary_model == "gpt-5.6-sol"
assert g.prompt_model == "gpt-5.6-sol"
assert g.summary_model == "gpt-6-astra"
assert g.prompt_model == "gpt-6-astra"
assert g.image_enabled is True
assert g.send_target == ""
assert g.ranking_template == "default"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_v2_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_startup_checks_structure(tmp_path, monkeypatch):

class FakeCodex:
def health_check(self):
return True, "主模型 gpt-5.6-sol 可用"
return True, "主模型 gpt-6-astra 可用"

monkeypatch.setattr(codex_provider, "CodexGPTProvider", lambda settings: FakeCodex())

Expand Down
4 changes: 2 additions & 2 deletions tests/test_weekly_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class FakeProvider:
name = "fake_ai"
model = "gpt-5.6-sol"
model = "gpt-6-astra"

def __init__(self, calls, *, fail=False):
self.calls = calls
Expand Down Expand Up @@ -58,7 +58,7 @@ def _group(settings, *, send=False):
wechat_group_id="weekly@chatroom",
wechat_group_name="周报当前群名",
summary_provider="codex",
summary_model="gpt-5.6-sol",
summary_model="gpt-6-astra",
wechat_send_enabled=send,
),
)
Expand Down