Files
AlphaPulse/backend/alembic/versions/20261014_5c2e8f1a7b3d_provider_reasoning_effort.py
eezd b549f3f441 Replace temperature with reasoning effort and retry in-stream errors
- Providers get a default reasoning effort (low..max, empty = not sent);
  chat can override it per message. OpenAI sends reasoning_effort,
  Claude sends output_config.effort with adaptive thinking, and thinking
  blocks are replayed during the tool loop.
- Show a thinking indicator while waiting for model output.
- Surface in-stream upstream errors (e.g. overloaded) instead of
  breaking the SSE stream, and retry them up to 3 times when nothing
  has been emitted yet.
2026-10-14 15:12:27 +08:00

32 lines
949 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""provider reasoning effort replaces temperature
Revision ID: 5c2e8f1a7b3d
Revises: 8349ae014ddd
Create Date: 2026-10-14 14:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '5c2e8f1a7b3d'
down_revision: Union[str, Sequence[str], None] = '8349ae014ddd'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# 用户决定不再设置 temperature(2026-10-14),改为思考强度
op.drop_column('ai_providers', 'temperature')
op.add_column('ai_providers', sa.Column('reasoning_effort', sa.String(length=8), nullable=True))
def downgrade() -> None:
"""Downgrade schema."""
op.drop_column('ai_providers', 'reasoning_effort')
op.add_column('ai_providers', sa.Column('temperature', sa.Float(), nullable=True))