上下文保持技术方案
genspark2api默认会绑定模型与对话,但需注意以下操作细节:
- 会话ID传递: in
/chat/completions
The request adds theconversation_id
字段(若未提供系统会自动生成) - 消息历史维护:每次请求都需包含完整的
messages
数组(含之前对话记录) - 模型锁定:在非流式请求时设置
"fixed_model": true
参数禁用自动切换 - 超时控制: Configuration
keep_alive
参数(单位秒)延长会话保持时间
完整请求示例:{
"model": "gpt-4o",
"conversation_id": "uuid123",
"messages": [
{"role": "user", "content": "上一轮问题"},
{"role": "assistant", "content": "上一轮回答"},
{"role": "user", "content": "新问题"}
],
"fixed_model": true
}
This answer comes from the articleGenspark2api (failed)The