回滚
This commit is contained in:
parent
72223ef412
commit
2f2a3cce41
4 changed files with 5 additions and 257 deletions
|
|
@ -27,9 +27,6 @@ from routes.common import (
|
|||
build_openai_target,
|
||||
build_responses_target,
|
||||
build_route_context,
|
||||
ensure_responses_cache_control,
|
||||
attach_previous_response_id,
|
||||
remember_response_id,
|
||||
inject_instructions_anthropic,
|
||||
inject_instructions_cc,
|
||||
inject_instructions_responses,
|
||||
|
|
@ -250,8 +247,6 @@ def _handle_responses_backend(ctx: RouteContext, payload: dict[str, Any], turn:
|
|||
payload = dict(payload)
|
||||
payload['model'] = ctx.upstream_model
|
||||
payload = inject_instructions_responses(payload, ctx.custom_instructions, ctx.instructions_position)
|
||||
payload = ensure_responses_cache_control(payload)
|
||||
payload = attach_previous_response_id(payload)
|
||||
url, headers = build_responses_target(ctx)
|
||||
payload = apply_body_modifications(payload, ctx.body_modifications)
|
||||
headers = apply_header_modifications(headers, ctx.header_modifications)
|
||||
|
|
@ -279,7 +274,6 @@ def _handle_responses_non_stream(
|
|||
|
||||
response_data = resp.json()
|
||||
attach_upstream_response(turn, response_data)
|
||||
remember_response_id(payload, response_data)
|
||||
response_data['model'] = ctx.client_model
|
||||
return _finalize_responses_response(
|
||||
response_data,
|
||||
|
|
@ -319,10 +313,6 @@ def _handle_responses_stream(
|
|||
extracted_usage = _extract_responses_usage(event_data)
|
||||
if extracted_usage:
|
||||
last_usage = extracted_usage
|
||||
if event_type == 'response.completed':
|
||||
response_obj = event_data.get('response') if isinstance(event_data, dict) else None
|
||||
if isinstance(response_obj, dict):
|
||||
remember_response_id(payload, response_obj)
|
||||
if event_count < 10:
|
||||
_dbg(
|
||||
f'上游事件#{event_count} 类型={event_type} 数据='
|
||||
|
|
@ -639,22 +629,4 @@ def _finalize_responses_response(
|
|||
attach_client_response(turn, response_data)
|
||||
finalize_turn(turn, usage=response_data.get('usage'))
|
||||
|
||||
output_items = response_data.get('output', [])
|
||||
if isinstance(output_items, list):
|
||||
for item in output_items:
|
||||
if not isinstance(item, dict) or item.get('type') != 'reasoning':
|
||||
continue
|
||||
summary = item.get('summary', [])
|
||||
if not isinstance(summary, list):
|
||||
continue
|
||||
reasoning_text = ''.join(
|
||||
part.get('text', '')
|
||||
for part in summary
|
||||
if isinstance(part, dict) and part.get('type') == 'summary_text'
|
||||
)
|
||||
if reasoning_text:
|
||||
cc_messages = responses_to_cc(request.get_json(silent=True, force=True) or {}).get('messages', [])
|
||||
thinking_cache.store_from_response(cc_messages, reasoning_text)
|
||||
break
|
||||
|
||||
return jsonify(response_data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue