fix(go-models): use per call context timeouts so long streaming responses are not truncated (#15380)

### What problem does this PR solve?

Closes #15379 

Around 29 Go model providers in `internal/entity/models/` share an
`http.Client` configured with `Timeout: 120 * time.Second`, and reuse
that same client for `ChatStreamlyWithSender`. Go's
`http.Client.Timeout` is a hard ceiling on the whole request that also
covers reading the response body, so it behaves as a wall clock on
streaming. Any streamed chat response that lasts longer than 120 seconds
gets cut off in the middle with a timeout error. Long generations,
reasoning model outputs, and slow or overloaded upstreams are the common
victims.

The providers that already behave correctly (`groq`, `mistral`,
`voyage`, `anthropic`) set no client `Timeout` and instead wrap each
request in a `context.WithTimeout`. This change converges the affected
providers onto that same pattern.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Dexterity
2026-06-02 03:27:26 -04:00
committed by GitHub
parent 4018f02d96
commit 2819d0ea24
38 changed files with 805 additions and 290 deletions

View File

@@ -1101,8 +1101,10 @@ NER使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系
dropboxDescription: '连接 Dropbox同步指定账号下的文件与文件夹。',
onedriveDescription:
'连接 OneDrive 或 OneDrive for Business通过 Microsoft Graph delta 查询索引文件和文件夹。',
onedriveTenantIdTip: 'Microsoft 365 组织的 Azure Active Directory 租户 ID目录 ID。',
onedriveClientIdTip: '拥有 Files.Read.All 权限的 Azure AD 应用注册的应用程序(客户端)ID。',
onedriveTenantIdTip:
'Microsoft 365 组织的 Azure Active Directory 租户 ID目录 ID。',
onedriveClientIdTip:
'拥有 Files.Read.All 权限的 Azure AD 应用注册的应用程序客户端ID。',
onedriveClientSecretTip: '在 Azure AD 应用注册中生成的客户端密钥值。',
onedriveFolderPathTip:
'可选的子文件夹路径,用于限制索引范围(例如 /Documents/Reports。留空则索引整个云盘。',