Commit Graph
1191 Commits
Author SHA1 Message Date
Chenyme 3bb57519dd fix: make Imagine quota refresh atomic and route-aware 2026-08-13 18:20:57 +08:00
scvxzf1 ed8fb72545 Merge branch 'main' into feat/imagine-quota-sync-after-generation 2026-08-12 23:48:10 +08:00
Chenyme 6e9eef7619 chore: bump version to v3.1.2 v3.1.2 2026-08-10 11:29:25 +08:00
Chenyme 64fe10a64b Merge pull request #880 from buddhism5080/fix/web-gateway-render-citation
fix(web): Web 上游搜索引用对齐(mgw render_citation → 客户端 citations)
2026-08-10 11:26:18 +08:00
Chenyme 24ad8d453f refactor: optimize citation offsets and extract Responses stream state 2026-08-10 11:20:00 +08:00
scv ed834ff3fe feat: sync imagine quota from upstream after generation
Imagine image/video quotas (image_pro/image_edit/video/video_720p) were
read-only snapshots that never refreshed after generation, so the
"Accounts > Grok Web" view showed stale quotas despite real consumption.
The post-generation refresh path was blocked end-to-end: imagine models
had empty catalog Mode, QueueQuotaRefresh rejected imagine modes,
runQuotaRefresh force-switched non-console modes back to weekly, and
SyncQuotaMode only supported weekly and /rest/rate-limits.

Wire imagine models into the per-generation refresh pipeline:
- catalog: assign image_pro/image_edit/video Mode to imagine models so
  QuotaMode() returns the imagine mode for routing/finalize
- SyncQuotaMode: add imagine branch calling syncImagineQuota and picking
  the requested mode's window
- QueueQuotaRefresh: accept imagine modes via new isWebImagineQuotaMode
  (reuses imagineQuotaBlockModels keys)
- runQuotaRefresh: skip the force-weekly override for imagine modes
- refreshQuotaMode: apply imagine cooldown after persisting the window
- image/video gateways: pass the catalog imagine mode (image_pro/video)
  to QueueQuotaRefresh instead of the always-weekly effectiveQuotaMode

Also surface imagine quota windows in the accounts UI with a dedicated
row (remaining/total, exhaustion, reset tooltip) and i18n labels, and
extend full SyncQuota to retain imagine windows alongside the weekly
snapshot. Routing is unchanged: getRoutingQuotaWindows keeps weekly
first, so candidate.QuotaWindow and effectiveQuotaMode stay weekly.
2026-08-09 03:34:59 +08:00
buddhism5080 4db800e8d8 fix(web): emit server_side_tool_usage on chat stream final chunk
Match non-stream chat: attach xAI tool usage next to citations on the
finish_reason chunk before [DONE].
2026-08-07 17:51:14 +08:00
buddhism5080 002b636183 fix(web): fall back annotation title to citation index
When no page/source title is known, use "1"/"2"/… instead of the URL.
2026-08-07 17:51:14 +08:00
buddhism5080 0ba5dafddc feat(web): change annotation title to page/source title
- [[N]] marker keeps numeric label
- url_citation title = page name (OpenAI-style) from SearchSources / hosted calls
- preserves [[N]] + citations + type:url

Signed-off-by: buddhism5080 <buddhism5080@users.noreply.github.com>
2026-08-07 17:51:14 +08:00
buddhism5080 d91b7f30b2 fix(web): add type:url on web_search_call action.sources
Keep existing url+title; set OpenAPI-required type:"url" so strict
Responses parsers accept sources while UI clients still get title.
2026-08-07 17:51:14 +08:00
buddhism5080 04478a0832 feat(web): map mgw tools to xAI web_search_call/x_search_call
Track tool_usage_card + tool_result as hosted search calls, emit
Responses output items and server_side_tool_usage, and stream
output_item events when search tools complete.
2026-08-07 17:51:14 +08:00
buddhism5080 541af70374 fix(web): align citations with xAI Responses/Chat format
Emit top-level citations URL lists, [[N]](url) inline markers with
numeric annotation titles, and honor include no_inline_citations /
inline_citations. Drop non-standard search_sources.
2026-08-07 17:51:14 +08:00
buddhism5080 af5ceafe8c fix(web): align citation output with OpenAI chat/responses shapes
Chat Completions keeps nested message.annotations url_citation objects
(non-stream + stream delta/final). Responses uses flat url_citation on
output_text and emits response.output_text.annotation.added mid-stream.
2026-08-07 17:51:14 +08:00
buddhism5080 9be04974c8 fix(web): parse Gateway render_citation and search tool chunks
Grok.com mgw now streams tool_usage_card / tool_result and
render_citation as response.chunk fields instead of grok:render
tokens. Collect web/X search sources and emit url_citation
annotations (with [[n]](url) markers) so clients get citations.
2026-08-07 17:51:13 +08:00
Chenyme 9fadb5b6a5 Merge pull request #877 from buddhism5080/feat/exclude-build-bot-flagged-scheduling
feat(accounts): exclude bot-risk Build accounts from scheduling
2026-08-07 17:42:51 +08:00
Chenyme 9c1e694a4c Merge remote-tracking branch 'origin/main' into pr/877
# Conflicts:
#	frontend/src/shared/i18n/index.ts
2026-08-07 17:36:54 +08:00
Chenyme 70615cbfd9 fix: harden bot-risk Build scheduling exclusion 2026-08-07 17:33:04 +08:00
Chenyme 9b1ce0b120 Merge pull request #873 from buddhism5080/fix/cli-bot-flag-source-1-2
fix(cli): treat bot_flag_source/bfs 1 and 2 as bot risk
2026-08-07 16:42:10 +08:00
Chenyme 7bc37ab612 Merge branch 'main' into fix/cli-bot-flag-source-1-2 2026-08-07 16:35:11 +08:00
Chenyme acd6860006 fix: require exact numeric Build bot-risk sources 2026-08-07 16:34:30 +08:00
Chenyme b93ccc3d4a Merge pull request #872 from 741075810/feat/media-image-ingest
feat(media): server-side image ingest (URL import + upload) for stable image-to-video input
2026-08-07 16:26:28 +08:00
Chenyme bfec9dc8c0 fix: expose validated URL guard to CodeQL 2026-08-07 16:21:57 +08:00
Chenyme 1377934334 Merge branch 'feat/media-image-ingest' of https://github.com/741075810/grok2api into pr/872 2026-08-07 16:11:10 +08:00
Chenyme fc00bbcc03 fix: harden URL image ingest against SSRF 2026-08-07 16:10:42 +08:00
Chenyme 1955803818 Merge branch 'main' into feat/media-image-ingest 2026-08-07 15:50:36 +08:00
Chenyme 44c1bbda31 feat: add transient image staging for reliable video inputs 2026-08-07 15:49:02 +08:00
Chenyme f05b552603 Merge remote-tracking branch 'origin/main' into pr/872 2026-08-07 11:54:26 +08:00
Chenyme 51f7acb7c8 Merge pull request #871 from MMortise/feature/stream-timeout
feat: 新增 Grok Build 流式空闲超时配置
2026-08-07 11:41:04 +08:00
Chenyme 76068808cd Merge remote-tracking branch 'origin/main' into pr/871
# Conflicts:
#	backend/internal/infra/provider/web/chat.go
2026-08-07 11:35:54 +08:00
Chenyme e95a5bc523 feat: add multi-Provider streaming idle timeout protection 2026-08-07 11:29:21 +08:00
Chenyme e8eb83462d Merge pull request #866 from MMortise/feature/subscribe-proxy
添加订阅代理配置并完善拉取代理信息支持
2026-08-07 10:34:58 +08:00
Chenyme 8967f964cc Merge branch 'main' into feature/subscribe-proxy 2026-08-07 10:30:04 +08:00
Chenyme 5d5090e483 fix: harden subscription proxy configuration and fetching 2026-08-07 10:29:52 +08:00
buddhism5080 f7364d777a fix(i18n): drop video/permission speculation from bot-risk tooltips 2026-08-06 23:27:59 +08:00
buddhism5080 b71e96ef9d fix(i18n): drop video/permission speculation from bot-risk tooltips 2026-08-06 23:27:55 +08:00
buddhism5080 b8b22d785f fix(accounts): reduce Build available count when excluding bot-risk
When excludeBuildBotFlaggedFromScheduling is on, account summary
available for grok_build subtracts currently schedulable bot-flagged
accounts so the accounts page routable count matches scheduling.
2026-08-06 23:19:34 +08:00
buddhism5080 f99abbe91f feat(accounts): optional exclude bot-risk Build accounts from scheduling
Add an Account maintenance toggle that removes Build accounts with
bot_flag_source/bfs in {1,2} from ProviderBuild candidate selection only.
Linked Web/Console scheduling is unchanged; accounts stay in the pool.
2026-08-06 23:01:15 +08:00
buddhism5080 a60c149b7f fix(cli): treat bot_flag_source/bfs 1 and 2 as bot risk
Numeric claim values 1 and 2 both mark Build accounts as risk-flagged
for routing and admin badges. Expose buildBotFlagSource so the UI can
use amber for source=1 and rose for source=2.
2026-08-06 22:08:38 +08:00
741075810 4ea171aff8 feat(media): server-side image ingest (URL import + upload) for stable image-to-video input 2026-08-06 22:00:37 +08:00
WuxiVIP ea18bb8622 feat: add configurable Grok Build stream idle timeout
Add a streamIdleTimeout setting (default 2m, range 30s–10m) to the Grok
Build runtime settings. When a streaming response goes silent for the
configured duration, the request context is cancelled and the read aborts
with a new upstream_stream_idle_timeout error code — instead of hanging
for ~10 minutes until the caller's context deadline fires.

The idle deadline is enforced via an idleTimeoutReadCloser body wrapper
injected at the egress transport layer, covering both the managed-client
and direct-fallback paths. Each successful Read resets the timer, so a
slow-but-steady stream is never interrupted. The wrapper uses
context.WithCancelCause so the Go transport unblocks the in-flight body
read on timeout.

Idle-timeout aborts do not degrade account health (the new error code is
excluded from isUpstreamStreamFailure) and are exempt from egress-node
cooldown, matching the existing treatment of response-header timeouts.

Mirrors the full responseHeaderTimeout pipeline: domain constants, config
struct/validation/default, settings service conversions, HTTP DTO, DB
backfill migration, egress manager atomic field + hot-reload + cache-key
fold, CLI adapter Config field, app assembly wiring, and frontend
types/model/UI/i18n.
2026-08-06 21:31:46 +08:00
WuxiVIP fea4098573 修复代理地址校验的前端 lint 错误 2026-08-06 18:30:35 +08:00
WuxiVIP 094d400115 修复订阅代理配置接口字段 2026-08-06 18:24:03 +08:00
Chenyme 9c03e4aedd Merge pull request #863 from buddhism5080/fix/cli-bfs-bot-flag-alias
fix(cli): treat JWT bfs claim as bot risk alias
2026-08-06 11:38:17 +08:00
Chenyme f630618ddd Merge branch 'main' into fix/cli-bfs-bot-flag-alias 2026-08-06 11:17:59 +08:00
Chenyme 9cfcb30dd2 Merge pull request #862 from buddhism5080/fix/console-dpop-date-skew
fix(console): align DPoP proof iat with mint response Date skew
2026-08-06 11:17:00 +08:00
Chenyme abc737145c Merge branch 'main' into fix/console-dpop-date-skew 2026-08-06 11:11:17 +08:00
Chenyme f52e1eb45d refactor: introduce shouldInvalidateConsoleClearance function 2026-08-06 11:09:50 +08:00
Chenyme b71c868e54 Merge pull request #861 from buddhism5080/fix/web-console-sync-progress-flicker
fix(accounts): stop web→console progress number flicker
2026-08-06 10:58:35 +08:00
Chenyme cd0002115e Merge branch 'main' into fix/web-console-sync-progress-flicker 2026-08-06 10:48:03 +08:00
Chenyme 558c79a024 Merge pull request #860 from MMortise/feature/opt-request-audit
feat: classify stream-failed audits as errors and add picklist filters
2026-08-06 10:47:44 +08:00