mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-12-01 16:01:04 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
964e22eb91 | ||
|
|
5a5d07d1c7 | ||
|
|
a41a0498d1 | ||
|
|
9aea228fa8 | ||
|
|
25965cbfb3 | ||
|
|
fa0bedd28b | ||
|
|
1bd27ef6c8 | ||
|
|
0981996ef3 | ||
|
|
783e4578ba | ||
|
|
0db3c6a215 | ||
|
|
fe1c38aeb7 | ||
|
|
2cbdd62b4e | ||
|
|
39cc23d2f0 | ||
|
|
102131056b | ||
|
|
c94a443620 | ||
|
|
ef870690e3 |
@@ -125,7 +125,7 @@ jobs:
|
||||
run: cargo clippy --all-targets --all-features --locked -- -D warnings
|
||||
|
||||
- name: Setup nextest
|
||||
uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f # v2.90.6
|
||||
uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
|
||||
with:
|
||||
tool: cargo-nextest@0.9.143
|
||||
fallback: none
|
||||
|
||||
@@ -115,7 +115,7 @@ jobs:
|
||||
cache-bin: false
|
||||
save-if: ${{ github.event_name != 'pull_request' }}
|
||||
- name: Setup nextest
|
||||
uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f # v2.90.6
|
||||
uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
|
||||
with:
|
||||
tool: cargo-nextest@0.9.143
|
||||
fallback: none
|
||||
@@ -434,7 +434,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3
|
||||
uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Install cargo-audit
|
||||
uses: taiki-e/install-action@75a7c0f87bd666af3cdb75c5b9e9d03ab6044e6f # v2.90.6
|
||||
uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11
|
||||
with:
|
||||
tool: cargo-audit@0.22.2
|
||||
fallback: none
|
||||
|
||||
Generated
+40
-40
@@ -153,9 +153,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-compression"
|
||||
version = "0.4.52"
|
||||
version = "0.4.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ad47a740fb906fffdd891e8b6d5fde2511600f7bfaebd68939fa08a14999459"
|
||||
checksum = "0c31224bd2c09447484a1143f2fc1d871eb405789859c8e5470a3e7f95f40a18"
|
||||
dependencies = [
|
||||
"compression-codecs",
|
||||
"compression-core",
|
||||
@@ -292,9 +292,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-sdk-s3"
|
||||
version = "1.161.0"
|
||||
version = "1.162.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c63e3ca6e56670513469e992759f4a51041603fde329471b29c5c1f5eaeefe"
|
||||
checksum = "4ffd93a622eaef65d9dee213b1c8afb8b5d999aa2020fe1c9ba6a94ec5e973e4"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"aws-credential-types",
|
||||
@@ -483,9 +483,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-runtime-api"
|
||||
version = "1.22.0"
|
||||
version = "1.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0b79dbb5331ccd297686df811d50ab3f39db171f5c765372a69272a0990b014"
|
||||
checksum = "20b0ce5fd8f8ec576f6737cf9a3a02172fddad2b90b8874577a4647fab11425c"
|
||||
dependencies = [
|
||||
"aws-smithy-async",
|
||||
"aws-smithy-runtime-api-macros",
|
||||
@@ -522,9 +522,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aws-smithy-types"
|
||||
version = "1.9.4"
|
||||
version = "1.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aff4bf014c512840b2bba80a20417b723cbd6a0a65c02e2d81f50b4268aedfc7"
|
||||
checksum = "2085f9721fb3755821f8db7611a67ed15f4d6fdba6785b4db8ed7cd18eebee0f"
|
||||
dependencies = [
|
||||
"base64-simd",
|
||||
"bytes",
|
||||
@@ -842,9 +842,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.6.8"
|
||||
version = "4.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac230478587d0269d8d6998b82ae69ea51509d55df66d9e92edd1f986904cd4a"
|
||||
checksum = "50066ca966813ca8957ee15361752f19424a8ff620dbe9c8993d9f99d99b04b3"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -852,9 +852,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.6.7"
|
||||
version = "4.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d"
|
||||
checksum = "a0ed97c96ef4efb3cc84e09fa388df4463e7cc3224ec38d7b1d9e45749333590"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -864,9 +864,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.6.8"
|
||||
version = "4.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "895c9d8d2ac2dd8b8a29f3724a14e72aaaa6debcf8c38c82f97305c6a172767a"
|
||||
checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -961,9 +961,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compression-codecs"
|
||||
version = "0.4.47"
|
||||
version = "0.4.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84f840cff84d10085260e460023934d0af699e71212b09b2a41452e8bd9cda43"
|
||||
checksum = "f938fc0d88fbe2c8d6f0e1ba96ba1165d89ff698e98468cd019d92cff2ecd367"
|
||||
dependencies = [
|
||||
"compression-core",
|
||||
"flate2",
|
||||
@@ -1109,9 +1109,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.5"
|
||||
version = "1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
|
||||
checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
@@ -1888,7 +1888,7 @@ dependencies = [
|
||||
"tracing-appender",
|
||||
"tracing-subscriber",
|
||||
"wiremock",
|
||||
"yaml-rust2 0.13.0",
|
||||
"yaml-rust2 0.13.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2073,9 +2073,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118"
|
||||
checksum = "b634322c4924093fe6a6e05ecbe5717cd3c6014934455f4ae8e5cf14ba3264a8"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
@@ -2551,9 +2551,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema"
|
||||
version = "0.61.2"
|
||||
version = "0.63.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e37f27df77c7887edbc5f5a59ecd8e5ec4a669319266ec1b61068667a603183"
|
||||
checksum = "b0802aebc749a4ef12e76aee083622b100249be0dc6d2103d84bbb2f7936a1ae"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytecount",
|
||||
@@ -2579,18 +2579,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema-regex"
|
||||
version = "0.61.2"
|
||||
version = "0.63.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e41151614b6c927e21982be8bef5a26741ae5a0ae6a781eedee2aa930a980e6"
|
||||
checksum = "ba1527289dfcb1400df61b5c591218e8e30031376671f611faecb5b9a1ff4987"
|
||||
dependencies = [
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema-value"
|
||||
version = "0.61.2"
|
||||
version = "0.63.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1515b9a91134ef67d7bac95c2d76fbc7e383c4c55ee544204ceec8088f881fef"
|
||||
checksum = "a95285ab129d630f01cf2f1345c28662116340fac1a35eb0795e5dbbf0ef990d"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytecount",
|
||||
@@ -2694,9 +2694,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.19.0"
|
||||
version = "0.19.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a9f71e3591c7ec44d3e563e87bf14ddc2bada8519dca046e5b0e560cd004e2d"
|
||||
checksum = "d4e2a1b977b42ee8b53a2a4adbd1183431c493f1d1960b7ccd893e2f0b9407ba"
|
||||
dependencies = [
|
||||
"hashbrown 0.17.1",
|
||||
]
|
||||
@@ -3444,7 +3444,7 @@ dependencies = [
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"hyper-util",
|
||||
"lru 0.19.0",
|
||||
"lru 0.19.2",
|
||||
"native-tls",
|
||||
"openssl",
|
||||
"openssl-sys",
|
||||
@@ -3692,9 +3692,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redis"
|
||||
version = "1.8.2"
|
||||
version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bef8fa589dd53a8a379a7856de1365d0a1be50c6b8aebb5c01c1ec441a2c509"
|
||||
checksum = "c85db9332bbc47e826283f0a6058d747c478ed2278976279cefd22154d541b98"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"arcstr",
|
||||
@@ -3748,9 +3748,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "referencing"
|
||||
version = "0.61.2"
|
||||
version = "0.63.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a028057ef852c58a42d75e09da87b5e733f4030f4c7411728955e4f87203a577"
|
||||
checksum = "858eb92e3a3c1d120695a04d5c6e8861915ee4394b8f77c90adbf686d6ddbf6e"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"fluent-uri",
|
||||
@@ -4213,9 +4213,9 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.11.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
|
||||
checksum = "5b0e5c7d67bc53f435386b2130fdc900488c5703770f6d8a4633060e34288a27"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures 0.3.0",
|
||||
@@ -5649,9 +5649,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust2"
|
||||
version = "0.13.0"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57e5b818a27a4cd30884ea380857a5e56f7ec3ba24a3990a3cc0b95af3238e18"
|
||||
checksum = "4a8af4469040402b7fe43c26575bab9a3069f0717c4a2931ecf4fb8728ee4cec"
|
||||
dependencies = [
|
||||
"arraydeque",
|
||||
"encoding_rs",
|
||||
@@ -5777,9 +5777,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.8.0"
|
||||
version = "9.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "721c8158b9503b2660291ad3056a20f722deaeed21bb908a9a363d7e17b34f0e"
|
||||
checksum = "2d8dbe089cf6b0448b78f5fc50139ab5aaa40d08ac07cdc1baf2c13add35fcce"
|
||||
dependencies = [
|
||||
"constant_time_eq",
|
||||
"crc32fast",
|
||||
|
||||
@@ -24,7 +24,7 @@ gateway-plugin-sdk = { path = "../sdk", features = ["io"] }
|
||||
gateway-protocol = { path = "../../gateway-protocol" }
|
||||
hex = "0.4.3"
|
||||
image = { version = "0.25.8", default-features = false, features = ["bmp", "gif", "ico", "jpeg", "png", "webp"] }
|
||||
jsonschema = { version = "0.61.2", default-features = false }
|
||||
jsonschema = { version = "0.63.2", default-features = false }
|
||||
roxmltree = "0.21.1"
|
||||
semver = "1.0.27"
|
||||
secrecy = "0.10.3"
|
||||
|
||||
@@ -107,15 +107,15 @@ impl PgRequestAnalyticsRepository {
|
||||
order by pending.oldest_pending_at, pending.request_id limit ($1::bigint - (select count(*) from live))
|
||||
) select request_id, change_version from live union all select request_id, change_version from oldest")
|
||||
.bind(i64::from(batch_size)).fetch_all(&mut *transaction).await.map_err(|error| postgres_unavailable("load analytics request queue", error))?;
|
||||
let mut jobs = Vec::with_capacity(rows.len());
|
||||
let mut ids = Vec::<String>::with_capacity(rows.len());
|
||||
let mut versions = Vec::<i64>::with_capacity(rows.len());
|
||||
for row in rows {
|
||||
jobs.push(ProjectionJob { id: get(&row,"request_id")?, version: get(&row,"change_version")? });
|
||||
ids.push(get(&row,"request_id")?);
|
||||
versions.push(get(&row,"change_version")?);
|
||||
}
|
||||
self.project_batch(&mut transaction, &jobs).await?;
|
||||
result.projected_requests = jobs.len() as u64;
|
||||
self.project_batch(&mut transaction, &ids).await?;
|
||||
result.projected_requests = ids.len() as u64;
|
||||
result.backfilled_requests = self.backfill(&mut transaction, batch_size).await?;
|
||||
let ids = jobs.iter().map(|job|job.id.clone()).collect::<Vec<_>>();
|
||||
let versions = jobs.iter().map(|job|job.version).collect::<Vec<_>>();
|
||||
if result.projected_requests + result.backfilled_requests > 0 {
|
||||
publish_generation(&mut transaction, true).await?;
|
||||
}
|
||||
@@ -153,38 +153,35 @@ impl PgRequestAnalyticsRepository {
|
||||
async fn project_batch(
|
||||
&self,
|
||||
tx: &mut sqlx::Transaction<'_, Postgres>,
|
||||
jobs: &[ProjectionJob],
|
||||
ids: &[String],
|
||||
) -> StoreResult<()> {
|
||||
if jobs.is_empty() {
|
||||
if ids.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let ids = jobs.iter().map(|job| job.id.clone()).collect::<Vec<_>>();
|
||||
let versions = jobs.iter().map(|job| job.version).collect::<Vec<_>>();
|
||||
let previous = sqlx::query(sqlx::AssertSqlSafe(format!(
|
||||
"{} where mr.id=any($1::text[])",
|
||||
fact_select()
|
||||
)))
|
||||
.bind(&ids)
|
||||
.bind(ids)
|
||||
.fetch_all(&mut **tx)
|
||||
.await
|
||||
.map_err(|error| postgres_unavailable("read previous analytics contributions", error))?;
|
||||
sqlx::query("delete from request_analytics_facts where id=any($1::text[])")
|
||||
.bind(&ids)
|
||||
.bind(ids)
|
||||
.execute(&mut **tx)
|
||||
.await
|
||||
.map_err(|error| postgres_unavailable("replace analytics facts", error))?;
|
||||
sqlx::query(PROJECT_REQUEST)
|
||||
.bind(&ids)
|
||||
.bind(versions)
|
||||
.bind(ids)
|
||||
.execute(&mut **tx)
|
||||
.await
|
||||
.map_err(|error| postgres_unavailable("project analytics facts", error))?;
|
||||
self.project_billing_batch(tx, &ids).await?;
|
||||
self.project_billing_batch(tx, ids).await?;
|
||||
let current = sqlx::query(sqlx::AssertSqlSafe(format!(
|
||||
"{} where mr.id=any($1::text[])",
|
||||
fact_select()
|
||||
)))
|
||||
.bind(&ids)
|
||||
.bind(ids)
|
||||
.fetch_all(&mut **tx)
|
||||
.await
|
||||
.map_err(|error| postgres_unavailable("read current analytics contributions", error))?;
|
||||
@@ -204,7 +201,7 @@ impl PgRequestAnalyticsRepository {
|
||||
return Ok(0);
|
||||
}
|
||||
let mut query = QueryBuilder::<Postgres>::new(
|
||||
"select id,started_at,nextval('request_analytics_change_version') as version,exists(select 1 from request_analytics_facts f where f.id=model_requests.id) as projected from model_requests",
|
||||
"select id,started_at,exists(select 1 from request_analytics_facts f where f.id=model_requests.id) as projected from model_requests",
|
||||
);
|
||||
// 首批与后续批次使用两种明确的计划,避免可空游标的 OR 使通用计划退化为全索引过滤
|
||||
if let Some(start) = get::<Option<DateTime<Utc>>>(&state, "backfill_cursor_started_at")? {
|
||||
@@ -225,17 +222,14 @@ impl PgRequestAnalyticsRepository {
|
||||
.fetch_all(&mut **tx)
|
||||
.await
|
||||
.map_err(|error| postgres_unavailable("read analytics backfill batch", error))?;
|
||||
let mut jobs = Vec::with_capacity(rows.len());
|
||||
let mut ids = Vec::<String>::with_capacity(rows.len());
|
||||
for row in &rows {
|
||||
if get::<bool>(row, "projected")? {
|
||||
continue;
|
||||
}
|
||||
jobs.push(ProjectionJob {
|
||||
id: get(row, "id")?,
|
||||
version: get(row, "version")?,
|
||||
});
|
||||
ids.push(get(row, "id")?);
|
||||
}
|
||||
self.project_batch(tx, &jobs).await?;
|
||||
self.project_batch(tx, &ids).await?;
|
||||
if let Some(last) = rows.last() {
|
||||
sqlx::query("update request_analytics_build_state set backfill_cursor_started_at = $1, backfill_cursor_id = $2, coverage_start = $1 + interval '1 microsecond' where singleton")
|
||||
.bind(get::<DateTime<Utc>>(last,"started_at")?).bind(get::<String>(last,"id")?).execute(&mut **tx).await.map_err(|error| postgres_unavailable("save analytics backfill cursor", error))?;
|
||||
@@ -377,11 +371,6 @@ pub(super) fn collections(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
struct ProjectionJob {
|
||||
id: String,
|
||||
version: i64,
|
||||
}
|
||||
|
||||
async fn publish_generation(
|
||||
tx: &mut sqlx::Transaction<'_, Postgres>,
|
||||
facts_changed: bool,
|
||||
@@ -391,4 +380,4 @@ async fn publish_generation(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
const PROJECT_REQUEST: &str = "insert into request_analytics_facts (id, started_at, completed_at, client_api_key_ref, provider_account_ref, routing_group_refs, operation, provider_kind, requested_model_id, upstream_model_id, outcome, client_status_code, upstream_status_code, client_transport, upstream_transport, attempt_count, client_response_id, upstream_response_id, upstream_request_id, recovered_at, downstream_committed_at, request_kind, image_generation_requested, image_generation_succeeded, error_kind, input_tokens, output_tokens, cached_input_tokens, cache_write_input_tokens, reasoning_output_tokens, image_input_tokens, image_output_tokens, total_tokens, cost_source, cost_currency, cost_amount, first_token_ms, latency_ms, admission_decision_ms, account_selection_wait_ms, upstream_response_ms, capacity_used_slots, capacity_total_slots, source_version, ops_failure_count, ops_rate_limited_count, ops_auth_failure_count, ops_provider_5xx_count) select mr.id, mr.started_at, mr.completed_at, mr.client_api_key_ref, mr.provider_account_ref, array(select distinct group_ref from unnest(mr.routing_group_refs) group_ref order by group_ref), mr.operation, mr.provider_kind, mr.requested_model_id, mr.upstream_model_id, mr.outcome, mr.client_status_code, mr.upstream_status_code, mr.client_transport, mr.upstream_transport, mr.attempt_count, mr.client_response_id, mr.upstream_response_id, mr.upstream_request_id, mr.recovered_at, mr.downstream_committed_at, mr.request_kind, mr.image_generation_requested, mr.image_generation_succeeded, mr.error_kind, mr.input_tokens, mr.output_tokens, mr.cached_input_tokens, mr.cache_write_input_tokens, mr.reasoning_output_tokens, mr.image_input_tokens, mr.image_output_tokens, mr.total_tokens, mr.cost_source, mr.cost_currency, mr.cost_amount, mr.first_token_ms, mr.latency_ms, mr.admission_decision_ms, mr.account_selection_wait_ms, mr.upstream_response_ms, mr.capacity_used_slots, mr.capacity_total_slots, job.version, ops.failure_count, ops.rate_limited_count, ops.auth_failure_count, ops.provider_5xx_count from unnest($1::text[],$2::bigint[]) job(id,version) join model_request_observations mr on mr.id=job.id cross join lateral (select count(*)::bigint as failure_count, count(*) filter(where failure_kind in ('rate_limited','quota_exhausted') or status_code=429)::bigint as rate_limited_count, count(*) filter(where failure_kind in ('authentication','authorization','invalid_credential') or status_code in (401,403))::bigint as auth_failure_count, count(*) filter(where status_code between 500 and 599)::bigint as provider_5xx_count from ops_events where model_request_id=mr.id) ops returning id, started_at";
|
||||
const PROJECT_REQUEST: &str = "insert into request_analytics_facts (id, started_at, completed_at, client_api_key_ref, provider_account_ref, routing_group_refs, operation, provider_kind, requested_model_id, upstream_model_id, outcome, client_status_code, upstream_status_code, client_transport, upstream_transport, attempt_count, client_response_id, upstream_response_id, upstream_request_id, recovered_at, downstream_committed_at, request_kind, image_generation_requested, image_generation_succeeded, error_kind, input_tokens, output_tokens, cached_input_tokens, cache_write_input_tokens, reasoning_output_tokens, image_input_tokens, image_output_tokens, total_tokens, cost_source, cost_currency, cost_amount, first_token_ms, latency_ms, admission_decision_ms, account_selection_wait_ms, upstream_response_ms, capacity_used_slots, capacity_total_slots, ops_failure_count, ops_rate_limited_count, ops_auth_failure_count, ops_provider_5xx_count) select mr.id, mr.started_at, mr.completed_at, mr.client_api_key_ref, mr.provider_account_ref, array(select distinct group_ref from unnest(mr.routing_group_refs) group_ref order by group_ref), mr.operation, mr.provider_kind, mr.requested_model_id, mr.upstream_model_id, mr.outcome, mr.client_status_code, mr.upstream_status_code, mr.client_transport, mr.upstream_transport, mr.attempt_count, mr.client_response_id, mr.upstream_response_id, mr.upstream_request_id, mr.recovered_at, mr.downstream_committed_at, mr.request_kind, mr.image_generation_requested, mr.image_generation_succeeded, mr.error_kind, mr.input_tokens, mr.output_tokens, mr.cached_input_tokens, mr.cache_write_input_tokens, mr.reasoning_output_tokens, mr.image_input_tokens, mr.image_output_tokens, mr.total_tokens, mr.cost_source, mr.cost_currency, mr.cost_amount, mr.first_token_ms, mr.latency_ms, mr.admission_decision_ms, mr.account_selection_wait_ms, mr.upstream_response_ms, mr.capacity_used_slots, mr.capacity_total_slots, ops.failure_count, ops.rate_limited_count, ops.auth_failure_count, ops.provider_5xx_count from unnest($1::text[]) job(id) join model_request_observations mr on mr.id=job.id cross join lateral (select count(*)::bigint as failure_count, count(*) filter(where failure_kind in ('rate_limited','quota_exhausted') or status_code=429)::bigint as rate_limited_count, count(*) filter(where failure_kind in ('authentication','authorization','invalid_credential') or status_code in (401,403))::bigint as auth_failure_count, count(*) filter(where status_code between 500 and 599)::bigint as provider_5xx_count from ops_events where model_request_id=mr.id) ops returning id, started_at";
|
||||
|
||||
@@ -264,8 +264,8 @@ impl PluginStore for PgPluginStore {
|
||||
.map_err(|error| admin_store_error("plugin", error))?;
|
||||
let mut platforms = metadata.platforms.clone();
|
||||
platforms.sort();
|
||||
let row = sqlx::query("insert into plugin_artifacts (sha256, plugin_id, version, metadata_json, source_json, outbound_proxy_id, archive) values ($1,$2,$3,$4,$5,$6,$7) returning metadata_json, source_json, installed_at, accepted_at")
|
||||
.bind(&metadata.sha256).bind(&metadata.plugin_id).bind(&metadata.version)
|
||||
let row = sqlx::query("insert into plugin_artifacts (sha256, plugin_id, metadata_json, source_json, outbound_proxy_id, archive) values ($1,$2,$3,$4,$5,$6) returning metadata_json, source_json, installed_at, accepted_at")
|
||||
.bind(&metadata.sha256).bind(&metadata.plugin_id)
|
||||
.bind(sqlx::types::Json(&metadata)).bind(sqlx::types::Json(&source))
|
||||
.bind(outbound_proxy.map(|proxy| proxy.id)).bind(artifact.archive.as_ref())
|
||||
.fetch_one(&mut *transaction).await.map_err(|error| {
|
||||
|
||||
@@ -64,11 +64,14 @@ impl PgProviderAccountRepository {
|
||||
observation: &AccountCatalogObservation,
|
||||
document: &[u8],
|
||||
) -> Result<bool, CoreStoreError> {
|
||||
// 相同正文复用旧 TOAST 值,定期复查只更新账号观测,减少正文重写及 WAL
|
||||
let result = sqlx::query("insert into provider_account_model_catalogs (account_id, credential_revision, plan_type, observed_at, document, etag)
|
||||
select a.id, a.credential_revision, a.plan_type, $4, $5, $6 from provider_accounts a
|
||||
where a.id=$1 and a.credential_revision=$2 and a.plan_type is not distinct from $3 for share
|
||||
on conflict (account_id) do update set credential_revision=excluded.credential_revision, plan_type=excluded.plan_type,
|
||||
etag=excluded.etag, observed_at=excluded.observed_at, document=excluded.document
|
||||
etag=excluded.etag, observed_at=excluded.observed_at, document=case
|
||||
when provider_account_model_catalogs.document_hash=excluded.document_hash
|
||||
then provider_account_model_catalogs.document else excluded.document end
|
||||
where provider_account_model_catalogs.credential_revision < excluded.credential_revision or
|
||||
(provider_account_model_catalogs.credential_revision=excluded.credential_revision and provider_account_model_catalogs.observed_at <= excluded.observed_at)")
|
||||
.bind(observation.account_id.as_str()).bind(i64::try_from(observation.revision.get()).map_err(|_|CoreStoreError::new(CoreStoreErrorKind::InvalidData))?)
|
||||
|
||||
@@ -449,7 +449,7 @@ async fn extrema_rebuild_reads_only_its_bucket_when_history_is_large() {
|
||||
}
|
||||
drain_analytics(&pool).await;
|
||||
// 只扩充其他时间桶的事实,规划器拿到真实行数后不能再为一个分组扫描全部历史
|
||||
sqlx::query("insert into request_analytics_facts select ('history_'||n)::text as id,(f.started_at-make_interval(hours=>n/1000+2))::timestamptz,f.completed_at-make_interval(hours=>n/1000+2),f.client_api_key_ref,f.provider_account_ref,f.routing_group_refs,f.operation,f.provider_kind,f.requested_model_id,f.upstream_model_id,f.outcome,f.client_status_code,f.upstream_status_code,f.client_transport,f.upstream_transport,f.attempt_count,null,null,null,f.recovered_at,f.downstream_committed_at,f.request_kind,f.image_generation_requested,f.image_generation_succeeded,f.error_kind,f.input_tokens,f.output_tokens,f.cached_input_tokens,f.cache_write_input_tokens,f.reasoning_output_tokens,f.image_input_tokens,f.image_output_tokens,f.total_tokens,f.cost_source,f.cost_currency,f.cost_amount,f.first_token_ms,f.latency_ms,f.admission_decision_ms,f.account_selection_wait_ms,f.upstream_response_ms,f.capacity_used_slots,f.capacity_total_slots,f.standard_cost_amount,f.no_cache_cost_amount,f.source_version,f.schema_version,f.ops_failure_count,f.ops_rate_limited_count,f.ops_auth_failure_count,f.ops_provider_5xx_count from request_analytics_facts f cross join generate_series(1,300000) n where f.id='rebuild_range_2'")
|
||||
sqlx::query("insert into request_analytics_facts select ('history_'||n)::text as id,(f.started_at-make_interval(hours=>n/1000+2))::timestamptz,f.completed_at-make_interval(hours=>n/1000+2),f.client_api_key_ref,f.provider_account_ref,f.routing_group_refs,f.operation,f.provider_kind,f.requested_model_id,f.upstream_model_id,f.outcome,f.client_status_code,f.upstream_status_code,f.client_transport,f.upstream_transport,f.attempt_count,null,null,null,f.recovered_at,f.downstream_committed_at,f.request_kind,f.image_generation_requested,f.image_generation_succeeded,f.error_kind,f.input_tokens,f.output_tokens,f.cached_input_tokens,f.cache_write_input_tokens,f.reasoning_output_tokens,f.image_input_tokens,f.image_output_tokens,f.total_tokens,f.cost_source,f.cost_currency,f.cost_amount,f.first_token_ms,f.latency_ms,f.admission_decision_ms,f.account_selection_wait_ms,f.upstream_response_ms,f.capacity_used_slots,f.capacity_total_slots,f.standard_cost_amount,f.no_cache_cost_amount,f.schema_version,f.ops_failure_count,f.ops_rate_limited_count,f.ops_auth_failure_count,f.ops_provider_5xx_count from request_analytics_facts f cross join generate_series(1,300000) n where f.id='rebuild_range_2'")
|
||||
.execute(&pool).await.unwrap();
|
||||
sqlx::query("analyze request_analytics_facts")
|
||||
.execute(&pool)
|
||||
|
||||
@@ -34,7 +34,7 @@ async fn business_backup_restores_core_state_and_usage_without_request_history()
|
||||
insert into client_api_key_budget_windows values('restore_key',now(),now()+interval '1 day',now(),now()+interval '7 days',2.5,9.5);
|
||||
insert into client_api_key_charge_events(request_id,client_api_key_id,amount_usd,completed_at) values('native_a','restore_key',2.5,now());
|
||||
insert into plugin_update_sources(plugin_id,source_json) values('backup.test','{}');
|
||||
insert into plugin_artifacts(sha256,plugin_id,version,metadata_json,source_json,archive,accepted_at) values(repeat('a',64),'backup.test','1.0.0','{}','{}',decode('010203','hex'),now());
|
||||
insert into plugin_artifacts(sha256,plugin_id,metadata_json,source_json,archive,accepted_at) values(repeat('a',64),'backup.test','{\"version\":\"1.0.0\"}','{}',decode('010203','hex'),now());
|
||||
update runtime_settings set usage_retention_days=3;
|
||||
update model_requests set cost_source='provider_reported',cost_amount=0.5,cost_currency='USD';
|
||||
insert into request_analytics_1h(bucket_start,collection,dimensions,outcome,schema_version,histogram_version,counts,costs,distributions)
|
||||
|
||||
@@ -261,6 +261,55 @@ async fn bulk_catalog_restore_keeps_ten_thousand_owners_and_fences_late_writes()
|
||||
.map(|a| a.id().as_str())
|
||||
.collect::<std::collections::BTreeSet<_>>();
|
||||
assert_eq!(ids, std::collections::BTreeSet::from(["acct_1", "acct_5"]));
|
||||
// 相同正文的复查仍更新账号观测,正文变化后单独恢复,迟到写入不能撤回新目录
|
||||
let refreshed = AccountCatalogObservation {
|
||||
account_id: ProviderAccountId::new("acct_5").unwrap(),
|
||||
observed_at: SystemTime::now(),
|
||||
etag: Some("v2".into()),
|
||||
..observation.clone()
|
||||
};
|
||||
assert!(
|
||||
repo.save_account_catalog(&refreshed, &document)
|
||||
.await
|
||||
.unwrap()
|
||||
);
|
||||
let restored = repo.load_account_catalogs(&provider).await.unwrap();
|
||||
assert_eq!(restored.len(), 1);
|
||||
let owner = restored[0]
|
||||
.accounts
|
||||
.iter()
|
||||
.find(|owner| owner.account_id == refreshed.account_id)
|
||||
.unwrap();
|
||||
assert_eq!(owner.etag, refreshed.etag);
|
||||
assert_eq!(
|
||||
chrono::DateTime::<Utc>::from(owner.observed_at).timestamp_micros(),
|
||||
chrono::DateTime::<Utc>::from(refreshed.observed_at).timestamp_micros()
|
||||
);
|
||||
assert_eq!(&restored[0].document[..], &document);
|
||||
let changed = AccountCatalogObservation {
|
||||
observed_at: SystemTime::now(),
|
||||
etag: Some("v3".into()),
|
||||
..refreshed.clone()
|
||||
};
|
||||
assert!(
|
||||
repo.save_account_catalog(&changed, b"changed")
|
||||
.await
|
||||
.unwrap()
|
||||
);
|
||||
assert!(
|
||||
!repo
|
||||
.save_account_catalog(&refreshed, &document)
|
||||
.await
|
||||
.unwrap()
|
||||
);
|
||||
let restored = repo.load_account_catalogs(&provider).await.unwrap();
|
||||
assert_eq!(restored.len(), 2);
|
||||
let changed_group = restored
|
||||
.iter()
|
||||
.find(|group| &group.document[..] == b"changed")
|
||||
.unwrap();
|
||||
assert_eq!(changed_group.accounts.len(), 1);
|
||||
assert_eq!(changed_group.accounts[0].account_id, changed.account_id);
|
||||
database.close().await;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ lru = "0.19.0"
|
||||
# hyper-util 固定到包含 SOCKS IPv6 修复的正式版
|
||||
# 升级前须重复采样 ClientHello,核对算法、扩展集合及排序约束、key_share 与 ALPN。
|
||||
aws-lc-rs = "=1.18.1"
|
||||
h2 = "=0.4.20"
|
||||
h2 = "=0.4.21"
|
||||
hyper = { version = "=1.11.1", default-features = false }
|
||||
hyper-rustls = "=0.27.7"
|
||||
hyper-util = { version = "=0.1.21", features = ["client-legacy", "http1", "tokio"] }
|
||||
|
||||
@@ -17,7 +17,7 @@ pub(super) const WEBSOCKET_SEND_TIMEOUT: Duration = Duration::from_secs(5 * 60);
|
||||
pub(super) enum PumpCommand {
|
||||
Upload {
|
||||
text: tungstenite::Utf8Bytes,
|
||||
deadline: tokio::time::Instant,
|
||||
admission_deadline: tokio::time::Instant,
|
||||
accepted:
|
||||
oneshot::Sender<oneshot::Receiver<Result<UploadOutcome, CodexWebSocketExchangeError>>>,
|
||||
},
|
||||
|
||||
@@ -340,13 +340,13 @@ impl PumpedWebSocket {
|
||||
&self,
|
||||
text: tungstenite::Utf8Bytes,
|
||||
) -> Result<UploadOutcome, CodexWebSocketExchangeError> {
|
||||
let deadline = Instant::now() + WEBSOCKET_SEND_TIMEOUT;
|
||||
let admission_deadline = Instant::now() + WEBSOCKET_SEND_TIMEOUT;
|
||||
let (accepted, admission) = tokio::sync::oneshot::channel();
|
||||
let result = tokio::time::timeout_at(deadline, async {
|
||||
let result = tokio::time::timeout_at(admission_deadline, async {
|
||||
self.tx_command
|
||||
.send(PumpCommand::Upload {
|
||||
text,
|
||||
deadline,
|
||||
admission_deadline,
|
||||
accepted,
|
||||
})
|
||||
.await
|
||||
@@ -359,7 +359,7 @@ impl PumpedWebSocket {
|
||||
.map_err(|_| CodexWebSocketExchangeError::SendTimeout {
|
||||
timeout: WEBSOCKET_SEND_TIMEOUT,
|
||||
})??;
|
||||
// 接单后由 pump 执行同一截止时间,调用方不能先超时并丢弃已经读到的上游回复
|
||||
// 接单后由 pump 监测分片写入,调用方等待最终发送结果或已读到的上游回复
|
||||
result
|
||||
.await
|
||||
.unwrap_or_else(|_| Err(tungstenite::Error::ConnectionClosed.into()))
|
||||
@@ -648,36 +648,45 @@ async fn handle_command(
|
||||
PumpCommand::Send { message, ack } => (message, ack),
|
||||
PumpCommand::Upload {
|
||||
text,
|
||||
deadline,
|
||||
admission_deadline,
|
||||
accepted,
|
||||
} => {
|
||||
let (ack, result) = tokio::sync::oneshot::channel();
|
||||
if closed.load(Ordering::Acquire)
|
||||
|| Instant::now() >= deadline
|
||||
|| Instant::now() >= admission_deadline
|
||||
|| accepted.send(result).is_err()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let mut upload = super::upload::Upload::new(messages, pending.is_some());
|
||||
let write = tokio::time::timeout_at(deadline, upload.send(inner, text)).await;
|
||||
if let Some(activity) = upload.last_activity {
|
||||
record_activity(lifecycle, activity);
|
||||
}
|
||||
let (error, metric_reason) = match write {
|
||||
Ok(Ok(())) => {
|
||||
let mut frames = super::upload::text_frames(text);
|
||||
let (error, metric_reason) = loop {
|
||||
let Some(frame) = frames.next() else {
|
||||
let _ = ack.send(Ok(UploadOutcome::Flushed));
|
||||
return None;
|
||||
};
|
||||
// 只有正文分片写出并刷新后才开始下一个窗口,入站心跳不会延长写入等待
|
||||
let write =
|
||||
tokio::time::timeout(WEBSOCKET_SEND_TIMEOUT, upload.send_frame(inner, frame))
|
||||
.await;
|
||||
if let Some(activity) = upload.last_activity.take() {
|
||||
record_activity(lifecycle, activity);
|
||||
}
|
||||
Ok(Err(error)) => {
|
||||
let reason = transport_metric_reason(&error);
|
||||
(CodexWebSocketExchangeError::Transport(error), reason)
|
||||
match write {
|
||||
Ok(Ok(())) => {}
|
||||
Ok(Err(error)) => {
|
||||
let reason = transport_metric_reason(&error);
|
||||
break (CodexWebSocketExchangeError::Transport(error), reason);
|
||||
}
|
||||
Err(_) => {
|
||||
break (
|
||||
CodexWebSocketExchangeError::SendTimeout {
|
||||
timeout: WEBSOCKET_SEND_TIMEOUT,
|
||||
},
|
||||
"send_timeout",
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(_) => (
|
||||
CodexWebSocketExchangeError::SendTimeout {
|
||||
timeout: WEBSOCKET_SEND_TIMEOUT,
|
||||
},
|
||||
"send_timeout",
|
||||
),
|
||||
};
|
||||
let reason = upload
|
||||
.close
|
||||
|
||||
@@ -127,44 +127,42 @@ impl<'a> Upload<'a> {
|
||||
Poll::Pending
|
||||
}
|
||||
|
||||
pub(super) async fn send(
|
||||
pub(super) async fn send_frame(
|
||||
&mut self,
|
||||
socket: &mut RawWsStream,
|
||||
text: Utf8Bytes,
|
||||
frame: Message,
|
||||
) -> Result<(), Error> {
|
||||
for frame in text_frames(text) {
|
||||
let mut frame = Some(frame);
|
||||
let mut first_poll = true;
|
||||
let result = poll_fn(|cx| {
|
||||
let read_first = std::mem::take(&mut first_poll);
|
||||
if read_first {
|
||||
let _ = self.poll_incoming(socket, cx, false)?;
|
||||
}
|
||||
let write = (|| {
|
||||
if frame.is_some() {
|
||||
ready!(socket.poll_ready_unpin(cx))?;
|
||||
}
|
||||
if let Some(frame) = frame.take() {
|
||||
let result = socket.start_send_unpin(frame);
|
||||
// I/O 错误可能发生在首帧头已部分写出之后
|
||||
self.started |= matches!(result, Ok(()) | Err(Error::Io(_)));
|
||||
result?;
|
||||
}
|
||||
socket.poll_flush_unpin(cx)
|
||||
})();
|
||||
if !read_first && write.is_pending() {
|
||||
let _ = self.poll_incoming(socket, cx, false)?;
|
||||
}
|
||||
write
|
||||
})
|
||||
.await;
|
||||
if let Err(error) = result {
|
||||
if self.started && !matches!(error, Error::ConnectionClosed) {
|
||||
// 只取已就绪的回复,不能为了等待假设的 Close 延长写入期限
|
||||
let _ = poll_fn(|cx| self.poll_incoming(socket, cx, true)).await;
|
||||
}
|
||||
return Err(error);
|
||||
let mut frame = Some(frame);
|
||||
let mut first_poll = true;
|
||||
let result = poll_fn(|cx| {
|
||||
let read_first = std::mem::take(&mut first_poll);
|
||||
if read_first {
|
||||
let _ = self.poll_incoming(socket, cx, false)?;
|
||||
}
|
||||
let write = (|| {
|
||||
if frame.is_some() {
|
||||
ready!(socket.poll_ready_unpin(cx))?;
|
||||
}
|
||||
if let Some(frame) = frame.take() {
|
||||
let result = socket.start_send_unpin(frame);
|
||||
// I/O 错误可能发生在首帧头已部分写出之后
|
||||
self.started |= matches!(result, Ok(()) | Err(Error::Io(_)));
|
||||
result?;
|
||||
}
|
||||
socket.poll_flush_unpin(cx)
|
||||
})();
|
||||
if !read_first && write.is_pending() {
|
||||
let _ = self.poll_incoming(socket, cx, false)?;
|
||||
}
|
||||
write
|
||||
})
|
||||
.await;
|
||||
if let Err(error) = result {
|
||||
if self.started && !matches!(error, Error::ConnectionClosed) {
|
||||
// 只取已就绪的回复,不能为了等待假设的 Close 延长写入期限
|
||||
let _ = poll_fn(|cx| self.poll_incoming(socket, cx, true)).await;
|
||||
}
|
||||
return Err(error);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -364,6 +364,49 @@ fn large_upload_client(addr: std::net::SocketAddr) -> (CodexBackendClient, Codex
|
||||
(client, request)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn fragmented_upload_can_outlast_five_minutes_with_write_progress() {
|
||||
let socket = tokio::net::TcpSocket::new_v4().unwrap();
|
||||
socket.set_recv_buffer_size(65536).unwrap();
|
||||
socket.bind("127.0.0.1:0".parse().unwrap()).unwrap();
|
||||
let listener = socket.listen(1).unwrap();
|
||||
let (client, request) = large_upload_client(listener.local_addr().unwrap());
|
||||
let (completed, received) = tokio::sync::oneshot::channel();
|
||||
let server = tokio::spawn(async move {
|
||||
let (mut socket, _) = listener.accept().await.unwrap();
|
||||
upgrade_raw_socket(&mut socket, false).await;
|
||||
let mut frames = 0;
|
||||
loop {
|
||||
let frame = read_client_frame(&mut socket).await;
|
||||
frames += 1;
|
||||
if frames == 1 || frames == 8 {
|
||||
// 两次推进之间排空多个正文分片,让总耗时超过发送时限
|
||||
tokio::time::pause();
|
||||
tokio::time::sleep(Duration::from_secs(170)).await;
|
||||
tokio::time::resume();
|
||||
}
|
||||
if frame.first_byte == 0x80 {
|
||||
break;
|
||||
}
|
||||
assert!(matches!(frame.first_byte, 0x00 | 0x01));
|
||||
}
|
||||
assert!(frames > 8);
|
||||
write_server_text_frame(
|
||||
&mut socket,
|
||||
&completed_websocket_response("resp_slow_upload", 1, 1),
|
||||
)
|
||||
.await;
|
||||
received.await.unwrap();
|
||||
});
|
||||
let response = client
|
||||
.create_response(&request, request_context("slow-upload", None))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(response.body.contains("resp_slow_upload"));
|
||||
completed.send(()).unwrap();
|
||||
server.await.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn fragmented_upload_sends_pong_before_final_continuation() {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
@@ -517,12 +560,12 @@ async fn upload_timeout_delivers_buffered_upstream_error() {
|
||||
.expect("peer error and following Ping should be read during upload");
|
||||
// Pong 证明此前的业务错误已经入队,保留连接直到写超时和错误交付均已完成
|
||||
tokio::time::pause();
|
||||
tokio::time::advance(Duration::from_secs(301)).await;
|
||||
tokio::time::resume();
|
||||
timeout(Duration::from_secs(5), released)
|
||||
// 已进入内核的分片仍可刷新时限,让时钟在停读后随实际等待自动推进
|
||||
timeout(Duration::from_secs(610), released)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("stalled upload must deliver the buffered error")
|
||||
.unwrap();
|
||||
tokio::time::resume();
|
||||
});
|
||||
let mut response = client
|
||||
.create_response_stream(&request, request_context("upload_timeout_reply", None))
|
||||
|
||||
@@ -49,3 +49,4 @@ e115a71b80faa08be4cf4f8747eec01e7b855ad3d8aa9622ca70b57300847b54 0046_account_a
|
||||
44a24ba1bab7630881b4eeac66806231d3a7040dd72a99b0475e1a0f20cfc540 0049_client_key_validity_and_proxy_test_targets.sql
|
||||
c62495a0aff26b149381370fe1eea656091ab8d9d7d55aee27be4f56d5885fd3 0050_prompt_rewrite_rules.sql
|
||||
c4cc50c137deabae7895b97a8a8681c618f2b856276455d591475a02956ee373 0051_account_platform_icons.sql
|
||||
5911268734a4dddf099e747bdc684ef184b5861dd6fec0482c8da5f0eb35104c 0052_storage_write_efficiency.sql
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-- 投影以源快照重算,精确版本确认由持久队列承担
|
||||
alter table request_analytics_facts drop column source_version;
|
||||
|
||||
-- 制品读取统一使用元数据版本,平台表继续约束同版本同平台的包身份
|
||||
alter table plugin_artifacts
|
||||
add constraint plugin_artifacts_metadata_version_ck check (
|
||||
metadata_json ? 'version'
|
||||
and jsonb_typeof(metadata_json->'version') = 'string'
|
||||
and length(metadata_json->>'version') between 1 and 128
|
||||
),
|
||||
drop column version;
|
||||
|
||||
-- 费用事件按请求去重、按 Key 和完成时间重算,复合索引覆盖现行读取
|
||||
drop index client_api_key_charge_events_client_api_key_id;
|
||||
|
||||
-- 删除制品时按摘要级联清理所有实例的历史配置
|
||||
create index plugin_version_configurations_artifact_sha256_idx
|
||||
on plugin_version_configurations (artifact_sha256);
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
# 版本严格一致。升级数据库版本时只需同步修改这里与 deploy/compose.yaml。
|
||||
ARG POSTGRES_IMAGE=postgres:18-bookworm@sha256:194e55feb2597b1465dbee81cc9fd8d204566cd2eb42c8d22fd6c931a38781b1
|
||||
|
||||
FROM node:26.13.1-bookworm-slim@sha256:5df79989ed685e09f0a98019db4cebfb22fb9df1a53c0161664a011f7ff6b0f1 AS frontend-builder
|
||||
FROM node:26.13.1-bookworm-slim@sha256:0042e17d232a87a2cd485be1da7900fca4d10a4ad11b29e9285da1d2e54798c9 AS frontend-builder
|
||||
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml frontend/pnpm-workspace.yaml ./
|
||||
@@ -41,7 +41,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
# 备份客户端来源:与 compose 服务端同一固定镜像,版本一致。
|
||||
FROM ${POSTGRES_IMAGE} AS pg-client
|
||||
|
||||
FROM debian:bookworm-slim@sha256:734a72b3d6142a71993b4bc580ca01d8ca687f77a2c422d96a961d3376b179bc AS runtime-base
|
||||
FROM debian:bookworm-slim@sha256:e67eeead736ff7bbe258ef088bff683635c561b1fcfefad0806c1df4ab49ce0e AS runtime-base
|
||||
|
||||
ENV TZ=UTC
|
||||
|
||||
|
||||
+2
-1
@@ -705,7 +705,8 @@ OpenAI Responses 上游 WS 按握手响应头 `x-codex-websocket-max-message-byt
|
||||
该上限只属于当前上游连接;响应头缺失或无效时不预判超限。显式 warmup 保持 WS 合同,超限时
|
||||
返回 `websocket_message_too_large`,不重复发送或改用 HTTP
|
||||
|
||||
上传期间网关持续读取上游帧并回复 Ping。上游在本次请求开始发送后、首条响应文本前返回关闭码
|
||||
每次正文分片写入并刷新后重新计时,连续 300 秒未完成一个分片会触发 `send_timeout`。
|
||||
上传期间网关持续读取上游帧并回复 Ping,心跳不会重置上传计时。上游在本次请求开始发送后、首条响应文本前返回关闭码
|
||||
1009 时,采用与握手超限相同的传输选择。显式 warmup 保留上游关闭错误。收到响应文本(含元数据)后
|
||||
再收到 1009,网关保留原错误,避免重复执行。单独的断管或 TCP 重置按传输失败处理
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
"build:source": "vue-tsc -p tsconfig.source.json --noEmit && vite build --mode source"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codex-proxy/ui": "github:zyycn/codex-proxy-ui#v0.14.0",
|
||||
"@codex-proxy/ui": "github:zyycn/codex-proxy-ui#6ae11ac8b3509307a7efd54e6e4c2fc8fae98b89",
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
||||
"@lobehub/icons-vue": "1.2.0",
|
||||
"@lucide/vue": "^1.77.0",
|
||||
"@vueuse/core": "^15.0.0",
|
||||
"@vueuse/integrations": "^15.0.0",
|
||||
"@lucide/vue": "^1.83.0",
|
||||
"@vueuse/core": "^15.1.0",
|
||||
"@vueuse/integrations": "^15.1.0",
|
||||
"axios": "^1.21.1",
|
||||
"circle-flags": "2.8.3",
|
||||
"css-tree": "^3.2.1",
|
||||
@@ -34,8 +34,8 @@
|
||||
"semver": "^7.8.6",
|
||||
"sortablejs": "^1.15.7",
|
||||
"vue": "^3.5.46",
|
||||
"vue-i18n": "11.4.23",
|
||||
"vue-router": "^5.5.1"
|
||||
"vue-i18n": "11.4.24",
|
||||
"vue-router": "^5.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^10.0.0",
|
||||
@@ -43,17 +43,17 @@
|
||||
"@intlify/unplugin-vue-i18n": "11.2.8",
|
||||
"@tailwindcss/vite": "^4.3.5",
|
||||
"@types/css-tree": "^3.2.0",
|
||||
"@types/node": "^26.6.6",
|
||||
"@types/node": "^26.6.11",
|
||||
"@types/semver": "^7.8.0",
|
||||
"@types/sortablejs": "^1.15.9",
|
||||
"@vitejs/plugin-vue": "^6.0.11",
|
||||
"@vue/tsconfig": "^0.9.1",
|
||||
"eslint": "^10.15.0",
|
||||
"eslint": "^10.16.0",
|
||||
"eslint-plugin-format": "^2.0.1",
|
||||
"eslint-plugin-vuejs-accessibility": "^2.6.3",
|
||||
"tailwindcss": "^4.3.5",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.3.8",
|
||||
"vite": "^8.4.0",
|
||||
"vue-tsc": "3.3.14"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+383
-459
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { AccountRequestBar } from './account-usage-window/presenter'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
bars: AccountRequestBar[]
|
||||
label: string
|
||||
showNativeTooltip?: boolean
|
||||
}>(),
|
||||
{
|
||||
showNativeTooltip: true,
|
||||
},
|
||||
)
|
||||
defineProps<{
|
||||
bars: AccountRequestBar[]
|
||||
label: string
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,13 +12,11 @@ withDefaults(
|
||||
class="flex items-stretch gap-px overflow-hidden rounded-full"
|
||||
role="img"
|
||||
:aria-label="label"
|
||||
:title="showNativeTooltip ? label : undefined"
|
||||
>
|
||||
<span
|
||||
v-for="bar in bars"
|
||||
:key="bar.key"
|
||||
class="relative min-w-0 flex-1 bg-z-border-secondary"
|
||||
:title="showNativeTooltip ? bar.title : undefined"
|
||||
>
|
||||
<span
|
||||
class="absolute inset-x-0 bottom-0 bg-z-green-solid"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useTimeAgoIntl } from '@vueuse/core'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const props = defineProps<{ value: string | null, fullDisplay: string | null }>()
|
||||
const props = defineProps<{ value: string | null }>()
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
const shortTimeUnits: Record<string, string> = {
|
||||
sec: 's',
|
||||
@@ -26,5 +26,5 @@ const display = useTimeAgoIntl(() => props.value ?? 0, {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span v-if="value" class="whitespace-nowrap" :title="fullDisplay ?? undefined">{{ display }}</span>
|
||||
<span v-if="value" class="whitespace-nowrap">{{ display }}</span>
|
||||
</template>
|
||||
|
||||
@@ -22,7 +22,7 @@ const showAuthenticationKind = computed(() => props.authenticationKind !== undef
|
||||
const sizeClasses = {
|
||||
xs: { gap: 'gap-0.75', container: 'size-4.5 rounded-md', icon: 'size-2.5' },
|
||||
sm: { gap: 'gap-1', container: 'size-5 rounded-md', icon: 'size-3' },
|
||||
md: { gap: 'gap-2', container: 'size-7 rounded-lg', icon: 'size-3.5' },
|
||||
md: { gap: 'gap-2', container: 'size-7 rounded-lg', icon: 'size-3.25' },
|
||||
}
|
||||
const classes = computed(() => sizeClasses[props.size])
|
||||
|
||||
@@ -34,7 +34,6 @@ const authenticationLabel = computed(() => formatAuthenticationLabel(props.authe
|
||||
<span
|
||||
class="inline-flex shrink-0 items-center justify-center bg-z-fill-secondary/80 text-z-text"
|
||||
:class="classes.container"
|
||||
:title="platform.label"
|
||||
>
|
||||
<component :is="platform.icon" v-if="platform.icon" :class="classes.icon" />
|
||||
<span v-else class="text-[10px] font-heavy text-z-text-quaternary">?</span>
|
||||
@@ -46,7 +45,6 @@ const authenticationLabel = computed(() => formatAuthenticationLabel(props.authe
|
||||
v-if="showAuthenticationKind"
|
||||
class="inline-flex shrink-0 items-center justify-center bg-z-fill-secondary/80 text-z-text"
|
||||
:class="classes.container"
|
||||
:title="authenticationLabel"
|
||||
>
|
||||
<component :is="authenticationIconComponent" v-if="authenticationIconComponent" :class="classes.icon" />
|
||||
<span v-else class="text-[10px] font-heavy text-z-text-quaternary">?</span>
|
||||
|
||||
@@ -38,6 +38,7 @@ function selectProvider(value: string) {
|
||||
|
||||
<template>
|
||||
<ZSegmented
|
||||
:class="{ '[&_svg]:size-3.25': display === 'icon' }"
|
||||
:model-value="provider"
|
||||
:options="options"
|
||||
:display="display"
|
||||
|
||||
@@ -102,7 +102,6 @@ function focusSelection() {
|
||||
:key="id"
|
||||
:model-value="selected.includes(id)"
|
||||
:label="id"
|
||||
:title="id"
|
||||
class="min-w-0"
|
||||
@update:model-value="select(id, $event)"
|
||||
>
|
||||
|
||||
@@ -317,7 +317,6 @@ watch(search, () => {
|
||||
v-if="mode === 'allowlist' && imageModelPresets.length"
|
||||
variant="plain"
|
||||
:aria-label="t('accounts.modelAccess.addImageModels')"
|
||||
:title="t('accounts.modelAccess.addImageModels')"
|
||||
:disabled="disabled || allImageModelsSelected"
|
||||
@click="addModels(imageModelPresets)"
|
||||
>
|
||||
|
||||
@@ -12,7 +12,6 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
class="peer-badge relative isolate inline-flex max-w-full shrink-0 cursor-default items-center gap-0.5 overflow-hidden rounded-md bg-z-cyan-container-strong py-0.5 pr-1.25 pl-0.75 align-middle text-z-cyan-on-container"
|
||||
:class="size === 'xs' ? 'h-4.5' : 'h-5'"
|
||||
:aria-label="t('accounts.upstream.link')"
|
||||
:title="t('accounts.upstream.link')"
|
||||
>
|
||||
<AppBrandMark variant="glyph" class="relative size-4 shrink-0" aria-hidden="true" />
|
||||
<span class="font-mono text-[10px] leading-none font-heavy tracking-wider [text-box:trim-both_cap_alphabetic]">CPR</span>
|
||||
|
||||
@@ -79,7 +79,6 @@ const paletteClass = computed(() => {
|
||||
v-else-if="wrap"
|
||||
class="line-clamp-3 max-w-full py-0.75 text-center leading-4 text-balance wrap-anywhere whitespace-normal"
|
||||
:class="sizes[size].text"
|
||||
:title="displayText || undefined"
|
||||
>
|
||||
<span class="box-decoration-clone rounded-md px-1.25 py-0.75" :class="paletteClass">
|
||||
{{ displayText }}
|
||||
@@ -90,7 +89,6 @@ const paletteClass = computed(() => {
|
||||
v-else
|
||||
class="inline-flex min-w-0 max-w-full items-center justify-center gap-1 rounded-full whitespace-nowrap leading-none shadow-z-tertiary"
|
||||
:class="[sizes[size].text, sizes[size].singleLine, paletteClass]"
|
||||
:title="displayText || undefined"
|
||||
>
|
||||
<span class="truncate">{{ displayText }}</span>
|
||||
<span v-if="count !== undefined" class="shrink-0 tabular-nums">{{ count }}</span>
|
||||
|
||||
@@ -13,13 +13,11 @@ const props = withDefaults(
|
||||
variant?: AccountUsageWindowVariant
|
||||
showLocalValue?: boolean
|
||||
showPercentage?: boolean
|
||||
showNativeTooltip?: boolean
|
||||
}>(),
|
||||
{
|
||||
variant: 'detail',
|
||||
showLocalValue: true,
|
||||
showPercentage: true,
|
||||
showNativeTooltip: true,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -39,7 +37,6 @@ const view = computed(() => resolveAccountUsageWindowPresentation({
|
||||
<span
|
||||
class="min-w-0"
|
||||
:class="view.classes.label"
|
||||
:title="showNativeTooltip ? view.labelTooltip : undefined"
|
||||
>
|
||||
{{ view.label }}
|
||||
</span>
|
||||
@@ -51,7 +48,6 @@ const view = computed(() => resolveAccountUsageWindowPresentation({
|
||||
v-if="view.quota.localUsageVisible"
|
||||
class="text-right text-z-text-quaternary"
|
||||
:class="view.classes.value"
|
||||
:title="showNativeTooltip ? t('accounts.quota.usageInThisWindow', { localUsageDisplay: view.quota.localUsageDisplay }) : undefined"
|
||||
>
|
||||
{{ view.quota.localUsageDisplay }}
|
||||
</span>
|
||||
@@ -59,7 +55,6 @@ const view = computed(() => resolveAccountUsageWindowPresentation({
|
||||
v-if="showPercentage && view.quota.valueVisible"
|
||||
class="text-right"
|
||||
:class="[view.classes.value, view.quota.percentTextClass]"
|
||||
:title="showNativeTooltip ? t('accounts.quota.quotaUsed', { rate: window.usedPercentDisplay }) : undefined"
|
||||
>
|
||||
{{ window.usedPercentDisplay }}
|
||||
</span>
|
||||
@@ -123,7 +118,6 @@ const view = computed(() => resolveAccountUsageWindowPresentation({
|
||||
class="col-span-full"
|
||||
:bars="view.local.requestBars"
|
||||
:label="view.local.timelineTitle"
|
||||
:show-native-tooltip="showNativeTooltip"
|
||||
:class="[view.classes.trackShape, view.classes.trackOffset]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -10,7 +10,6 @@ type AccountUsageWindowMode = 'quota' | 'local' | 'unknown'
|
||||
|
||||
interface AccountRequestBucket {
|
||||
bucketStart: string
|
||||
label: string
|
||||
requestCount: number
|
||||
}
|
||||
|
||||
@@ -18,7 +17,6 @@ export interface AccountRequestBar {
|
||||
key: string
|
||||
requestCount: number
|
||||
height: string
|
||||
title: string
|
||||
}
|
||||
|
||||
interface AccountLocalUsage {
|
||||
@@ -38,7 +36,6 @@ interface AccountUsageWindowVariantDefinition {
|
||||
trackShapeClass: string
|
||||
minimumBarWidth: string
|
||||
compactValues: boolean
|
||||
labelTooltip: boolean
|
||||
showResetTime: boolean
|
||||
}
|
||||
|
||||
@@ -63,7 +60,6 @@ const variantDefinitions: Record<
|
||||
trackShapeClass: 'h-1.5 w-full overflow-hidden rounded-full',
|
||||
minimumBarWidth: '6px',
|
||||
compactValues: false,
|
||||
labelTooltip: true,
|
||||
showResetTime: false,
|
||||
},
|
||||
compact: {
|
||||
@@ -75,7 +71,6 @@ const variantDefinitions: Record<
|
||||
trackShapeClass: 'h-1 w-full overflow-hidden rounded-full',
|
||||
minimumBarWidth: '3px',
|
||||
compactValues: true,
|
||||
labelTooltip: true,
|
||||
showResetTime: false,
|
||||
},
|
||||
detail: {
|
||||
@@ -87,7 +82,6 @@ const variantDefinitions: Record<
|
||||
trackShapeClass: 'h-2 overflow-hidden rounded-full',
|
||||
minimumBarWidth: '8px',
|
||||
compactValues: false,
|
||||
labelTooltip: false,
|
||||
showResetTime: true,
|
||||
},
|
||||
}
|
||||
@@ -141,7 +135,6 @@ export function resolveAccountUsageWindowPresentation(
|
||||
? quotaWindowLabel(input.window, false)
|
||||
: fullLabel,
|
||||
ariaLabel: fullLabel,
|
||||
labelTooltip: definition.labelTooltip ? fullLabel : undefined,
|
||||
classes: {
|
||||
root: definition.rootClass,
|
||||
header: definition.headerClass,
|
||||
@@ -213,7 +206,6 @@ function requestBuckets(value: unknown) {
|
||||
return [
|
||||
{
|
||||
bucketStart: item.bucketStart,
|
||||
label: item.label,
|
||||
requestCount: item.requestCount,
|
||||
},
|
||||
]
|
||||
@@ -437,6 +429,5 @@ function requestTimeline(buckets: NonNullable<AccountLocalUsage['requestBuckets'
|
||||
height: bucket.requestCount === 0
|
||||
? '0'
|
||||
: `${Math.max(25, Math.round(bucket.requestCount / maximum * 100))}%`,
|
||||
title: bucket.label,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
<template v-else-if="preview">
|
||||
<code class="break-all text-z-sm text-z-text">{{ preview.userAgent }}</code>
|
||||
<div class="flex flex-wrap items-end gap-x-3 gap-y-1">
|
||||
<p v-if="preview.error && preview.versionSource !== 'custom'" :title="preview.error" class="m-0 text-z-sm text-z-warning">
|
||||
<p v-if="preview.error && preview.versionSource !== 'custom'" class="m-0 text-z-sm text-z-warning">
|
||||
{{ t('settings.clientProfile.updateFailedUseLastVersion') }}
|
||||
</p>
|
||||
<p class="m-0 ms-auto text-end text-z-xs text-z-text-tertiary">
|
||||
|
||||
@@ -151,7 +151,6 @@ function itemValueClass(tone?: string, accent?: boolean) {
|
||||
<span
|
||||
v-if="speedMode"
|
||||
class="inline-flex h-4 items-center rounded-full bg-z-warning-container px-0.5 text-z-warning-on-container"
|
||||
:title="speedModeLabel"
|
||||
role="img"
|
||||
:aria-label="speedModeLabel"
|
||||
>
|
||||
|
||||
@@ -12,7 +12,6 @@ const clientIp = computed(() => usageClientIp(props.record))
|
||||
<template>
|
||||
<span
|
||||
class="inline-flex h-6 max-w-full items-center rounded-full bg-z-blue-container px-2.5 font-mono text-z-sm leading-none font-bold text-z-blue-on-container"
|
||||
:title="clientIp"
|
||||
>
|
||||
<span class="min-w-0 truncate">
|
||||
{{ clientIp }}
|
||||
|
||||
@@ -31,20 +31,19 @@ const summary = computed(() => usageErrorSummary(props.record))
|
||||
:class="origin.className"
|
||||
role="img"
|
||||
:aria-label="origin.label"
|
||||
:title="origin.hint ? `${origin.label} · ${origin.hint}` : origin.label"
|
||||
>
|
||||
<component :is="originIcons[origin.kind]" class="size-3.5" aria-hidden="true" />
|
||||
</span>
|
||||
<span class="truncate">
|
||||
<span class="font-emphasis">{{ outcome }}</span>
|
||||
<span v-if="record.upstreamStatusCode != null" class="ms-1.5 font-mono" :title="t('usage.error.upstreamStatusCode')">
|
||||
<span v-if="record.upstreamStatusCode != null" class="ms-1.5 font-mono">
|
||||
{{ t('usage.error.upstreamHttpStatus', { status: record.upstreamStatusCode }) }}
|
||||
</span>
|
||||
<span v-if="record.clientStatusCode != null && record.clientStatusCode !== record.upstreamStatusCode" class="ms-1.5 font-mono" :title="t('usage.error.clientStatusCode')">
|
||||
<span v-if="record.clientStatusCode != null && record.clientStatusCode !== record.upstreamStatusCode" class="ms-1.5 font-mono">
|
||||
{{ t('usage.error.clientHttpStatus', { status: record.clientStatusCode }) }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="record.recovered" class="inline-flex shrink-0 text-z-success-text" role="img" :aria-label="t('usage.error.recovered')" :title="t('usage.error.recovered')">
|
||||
<span v-if="record.recovered" class="inline-flex shrink-0 text-z-success-text" role="img" :aria-label="t('usage.error.recovered')">
|
||||
<CheckCheck class="size-4" :stroke-width="2.25" aria-hidden="true" />
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { UsageModelRecord } from './presenter'
|
||||
import { CornerDownRight } from '@lucide/vue'
|
||||
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { usageModelDisplay } from './presenter'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -12,21 +11,18 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const modelDisplay = computed(() => usageModelDisplay(props.record))
|
||||
const { t } = useI18n({ useScope: 'global' })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inline-grid max-w-full gap-1">
|
||||
<code
|
||||
class="block max-w-full truncate font-mono text-z-sm leading-none font-heavy text-z-text"
|
||||
:title="t('usage.status.requestedModel', { model: modelDisplay.primary })"
|
||||
>
|
||||
{{ modelDisplay.primary }}
|
||||
</code>
|
||||
<div
|
||||
v-if="modelDisplay.secondary"
|
||||
class="flex min-w-0 max-w-full items-center gap-1.25 text-z-text-secondary"
|
||||
:title="t('usage.status.mappedModel', { secondary: modelDisplay.secondary })"
|
||||
>
|
||||
<CornerDownRight
|
||||
class="size-3.25 shrink-0 text-z-blue-text"
|
||||
|
||||
@@ -3,15 +3,12 @@ import type { UsagePerformanceRecord } from './presenter'
|
||||
|
||||
import { computed } from 'vue'
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { usagePerformanceDetails } from './presenter'
|
||||
|
||||
const props = defineProps<{
|
||||
record: UsagePerformanceRecord
|
||||
}>()
|
||||
|
||||
const { t } = useI18n({ useScope: 'global' })
|
||||
|
||||
const performance = computed(() => usagePerformanceDetails(props.record))
|
||||
</script>
|
||||
|
||||
@@ -19,7 +16,7 @@ const performance = computed(() => usagePerformanceDetails(props.record))
|
||||
<div class="grid justify-items-end gap-y-1.5 whitespace-nowrap font-mono text-z-sm leading-none font-heavy tabular-nums">
|
||||
<span class="text-z-text">{{ performance.throughputDisplay }}</span>
|
||||
<span class="text-z-xs text-z-text-secondary">
|
||||
<span :title="t('usage.performance.ttftHelp')" class="text-z-text-quaternary">TTFT</span>
|
||||
<span class="text-z-text-quaternary">TTFT</span>
|
||||
{{ performance.firstTokenDisplay }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,6 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
<span
|
||||
v-if="record.subagentKind"
|
||||
class="inline-flex shrink-0 text-z-purple-text"
|
||||
:title="t('usage.reasoning.subagentRequest')"
|
||||
:aria-label="t('usage.reasoning.subagentRequest')"
|
||||
>
|
||||
<Bot class="size-3.5" stroke-width="2.2" />
|
||||
@@ -32,7 +31,6 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
<span
|
||||
v-if="record.subagentKind === 'review'"
|
||||
class="inline-flex shrink-0 text-z-purple-text"
|
||||
:title="t('usage.reasoning.reviewSubagentRequest')"
|
||||
:aria-label="t('usage.reasoning.reviewSubagentRequest')"
|
||||
>
|
||||
<SquareDashedBottomCode class="size-3.25" stroke-width="2.2" />
|
||||
|
||||
@@ -17,11 +17,10 @@ const routeLabel = computed(() => {
|
||||
|
||||
<template>
|
||||
<div class="inline-flex max-w-full items-center gap-1.5 whitespace-nowrap">
|
||||
<code class="min-w-0 truncate font-mono text-z-sm font-emphasis" :title="record.route ?? undefined">{{ routeLabel }}</code>
|
||||
<code class="min-w-0 truncate font-mono text-z-sm font-emphasis">{{ routeLabel }}</code>
|
||||
<span
|
||||
v-if="record.compact"
|
||||
class="inline-flex shrink-0 text-z-orange-text"
|
||||
:title="t('usage.route.compressionRequest')"
|
||||
:aria-label="t('usage.route.compressionRequest')"
|
||||
>
|
||||
<Minimize2 class="size-3.5" stroke-width="2.4" />
|
||||
|
||||
@@ -6,11 +6,11 @@ const parts = computed(() => props.value?.split(' '))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<time v-if="parts?.length === 2" :datetime="datetime" :title="value" class="grid gap-1 font-mono tabular-nums">
|
||||
<time v-if="parts?.length === 2" :datetime="datetime" class="grid gap-1 font-mono tabular-nums">
|
||||
<span class="text-z-sm font-bold text-z-text">{{ parts[1] }}</span>
|
||||
<span class="text-z-xs text-z-text-tertiary">{{ parts[0] }}</span>
|
||||
</time>
|
||||
<span v-else class="block truncate font-mono text-z-sm leading-none font-bold text-z-text-secondary" :title="value">
|
||||
<span v-else class="block truncate font-mono text-z-sm leading-none font-bold text-z-text-secondary">
|
||||
{{ value || '—' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +18,7 @@ const description = computed(() => t('usage.transportDirection', {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="inline-flex items-center overflow-hidden rounded-full" tabindex="0" :aria-label="description" :title="description">
|
||||
<span class="inline-flex items-center overflow-hidden rounded-full" tabindex="0" :aria-label="description">
|
||||
<UsageTransportBadge :transport="upstream" joined />
|
||||
<UsageTransportBadge v-if="upstreamLabel !== clientLabel" :transport="client" joined />
|
||||
</span>
|
||||
|
||||
@@ -50,7 +50,6 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
<template #clientApiKeyName="{ displayValue }">
|
||||
<span
|
||||
class="block max-w-full truncate font-mono text-z-sm leading-none font-bold text-z-text"
|
||||
:title="String(displayValue)"
|
||||
>
|
||||
{{ displayValue }}
|
||||
</span>
|
||||
@@ -66,14 +65,12 @@ const { t } = useI18n({ useScope: 'global' })
|
||||
<template #accountEmail="{ row }">
|
||||
<span
|
||||
class="block max-w-full truncate font-mono text-z-sm leading-none font-bold text-z-text"
|
||||
:title="usageAccountText(row)"
|
||||
>
|
||||
{{ usageAccountText(row) }}
|
||||
</span>
|
||||
<span
|
||||
v-if="row.accountNotes?.trim()"
|
||||
class="mt-1 block max-w-full truncate text-z-xs font-emphasis text-z-text-quaternary"
|
||||
:title="row.accountNotes"
|
||||
>
|
||||
{{ row.accountNotes }}
|
||||
</span>
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
"geminiModels": "Gemini models",
|
||||
"claudeGptModels": "Claude and GPT models"
|
||||
},
|
||||
"usageInThisWindow": "Usage in this window: {localUsageDisplay}",
|
||||
"quotaUsed": "Quota used: {rate}",
|
||||
"resets": "Resets: {resetAtDisplay}",
|
||||
"unobserved": "Awaiting quota data",
|
||||
"dailyRequests": "Daily requests",
|
||||
@@ -43,7 +41,6 @@
|
||||
"autoUsePointsHelp": "Use available credits when the subscription limit is reached",
|
||||
"quotaPoints": "Credits",
|
||||
"point": "credits",
|
||||
"requestsInThisWindow": "Requests in this window: {requestDisplay}",
|
||||
"requestCount": "Requests: {requestDisplay}",
|
||||
"statisticalRange": "Statistical range",
|
||||
"rolling": "Rolling {duration}",
|
||||
@@ -65,11 +62,7 @@
|
||||
"rollingWindow": "Rolling window",
|
||||
"windowConsumption": "Window consumption",
|
||||
"resetTime": "Reset time",
|
||||
"localTokens": "Locally accumulated tokens",
|
||||
"totalTokensFor": "Total tokens for {windowLabelDisplay}",
|
||||
"usageRateHelp": "Current usage percentage for the most recently used quota",
|
||||
"usageRate": "Usage rate",
|
||||
"moreGroups": "{count} more quota groups, expand the account to view them",
|
||||
"windows": {
|
||||
"fiveHour": "5h limit",
|
||||
"daily": "Daily limit",
|
||||
@@ -149,14 +142,11 @@
|
||||
},
|
||||
"credentials": {
|
||||
"accountName": "Account name",
|
||||
"baseUrlHelp": "Enter the API base URL, endpoint paths are appended automatically",
|
||||
"apiPrefix": "API prefix",
|
||||
"apiKeyPlaceholder": "Leave blank to keep the current key",
|
||||
"enterUpstreamKey": "Enter the upstream key",
|
||||
"protocolLabel": "Upstream protocol",
|
||||
"transportLabel": "Transport",
|
||||
"webSocketHelp": "WS requires upstream support for Responses WebSocket",
|
||||
"messagesTransportHelp": "Messages upstreams use HTTP/SSE",
|
||||
"validation": {
|
||||
"urlLength": "Upstream API URL must not exceed 2,048 characters",
|
||||
"urlFormat": "Enter an HTTP or HTTPS URL without credentials, query parameters, or a fragment",
|
||||
@@ -333,7 +323,6 @@
|
||||
"reasoning": "Reasoning",
|
||||
"modelUsageRanking": "Model usage",
|
||||
"totalTokens": "Total tokens",
|
||||
"totalCharge": "Total cost",
|
||||
"totalCharges": "Total cost",
|
||||
"noModelUsageYet": "No model usage yet",
|
||||
"windows": {
|
||||
@@ -466,9 +455,7 @@
|
||||
"tokenActivityStatisticsMethod": "Token activity statistics method",
|
||||
"noTokenActivityYet": "No token activity yet",
|
||||
"noDailyActivity": "Daily token activity was not available for this request",
|
||||
"tokenActivityHeatmap": "Token activity heatmap, {rangeLabel}",
|
||||
"weekOfTokens": "Week of {dateDisplay}: {value} tokens",
|
||||
"throughTokens": "Through {dateDisplay}: {value} tokens"
|
||||
"tokenActivityHeatmap": "Token activity heatmap, {rangeLabel}"
|
||||
},
|
||||
"metrics": {
|
||||
"cumulativeNumberOfTokens": "Total tokens",
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
"totalCacheHits": "Total cache hits",
|
||||
"totalCache": "Total cache"
|
||||
},
|
||||
"comparedWithYesterday": "vs. yesterday",
|
||||
"trends": {
|
||||
"title": "Trends",
|
||||
"metric": "Trend indicator",
|
||||
@@ -80,19 +79,13 @@
|
||||
"clientIdentity": {
|
||||
"clientMode": "Client mode",
|
||||
"versionPolicy": "Version policy",
|
||||
"notChecked": "Not checked yet",
|
||||
"customVersion": "Custom version",
|
||||
"active": "Active",
|
||||
"activeDescription": "New requests using the global settings use this identity",
|
||||
"upToDate": "Up to date",
|
||||
"versionUpToDate": "Version matches",
|
||||
"upToDateDescription": "The active version matches the latest official release",
|
||||
"updateAvailable": "Update available",
|
||||
"latestRelease": "Latest official version: {releaseLabel}",
|
||||
"checkFailed": "Check failed",
|
||||
"checkFailedDescription": "Official version check failed",
|
||||
"pending": "Pending check",
|
||||
"pendingDescription": "Official releases have not been checked yet",
|
||||
"verifiedAt": "Profile verified: {verifiedAt}",
|
||||
"checkedAt": "Release checked: {checkedAt}",
|
||||
"clientId": "Client ID",
|
||||
|
||||
@@ -56,11 +56,9 @@
|
||||
"model": "Model",
|
||||
"other": "Other models ({count})",
|
||||
"unknownModel": "Unspecified model",
|
||||
"knownCost": "Known USD costs only",
|
||||
"costShare": "Cost share",
|
||||
"peakRequests": "Peak daily requests",
|
||||
"activeDays": "Active days",
|
||||
"includesEstimate": "Includes estimated costs",
|
||||
"empty": "No usage in this period",
|
||||
"missing": "No known values for this metric"
|
||||
},
|
||||
|
||||
@@ -131,10 +131,6 @@
|
||||
"regionalConflict": "Regional conflict",
|
||||
"parsingFailed": "Parsing failed",
|
||||
"exitNotRecognized": "Exit not recognized",
|
||||
"ipv4AndIpv6EgressTimeZonesAre": "IPv4 and IPv6 egress time zones are inconsistent",
|
||||
"exitLocation": "Exit location: {label} · {timezone}",
|
||||
"detectHelp": "Resolve the exit location when testing proxies",
|
||||
"customLocation": "Custom location: {customLabel} · {timezone}",
|
||||
"custom": "Custom: {customLabel}"
|
||||
},
|
||||
"fields": {
|
||||
@@ -154,7 +150,6 @@
|
||||
"selectProxy": "Select proxy {name}",
|
||||
"credentialsSaved": "Proxy credentials saved",
|
||||
"underTest": "Under test",
|
||||
"ms": "{message} ({latencyMs} ms)",
|
||||
"notTested": "Not tested",
|
||||
"viewAccountsAssociatedWith": "View the {count} accounts associated with {name}",
|
||||
"disable": "Disable “{name}”?",
|
||||
|
||||
@@ -472,8 +472,6 @@
|
||||
},
|
||||
"storage": {
|
||||
"s3StorageConfiguration": "S3 storage configuration",
|
||||
"connectionTestPassed": "Connection test passed",
|
||||
"connectionTestHasNotPassed": "Connection test has not passed",
|
||||
"testing": "Testing",
|
||||
"endpointAddress": "Endpoint address",
|
||||
"endpointHelp": "HTTPS endpoint for the S3-compatible service",
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
"total": "Total"
|
||||
},
|
||||
"performance": {
|
||||
"ttftHelp": "TTFT: time to first token",
|
||||
"upstreamRateHelp": "Output tokens ÷ upstream response time, including reasoning tokens",
|
||||
"localRateHelp": "≈ indicates the local average rate: output tokens ÷ total request time, including waits, retries, and network time",
|
||||
"concurrency": "Concurrency",
|
||||
@@ -129,7 +128,6 @@
|
||||
"stable": "Stable",
|
||||
"future": "Future",
|
||||
"status": {
|
||||
"mappedModel": "Model sent upstream after gateway mapping: {secondary}",
|
||||
"firstOutputWaiting": "First output",
|
||||
"reasoningToText": "Reasoning → Text",
|
||||
"firstOneIsOutputToText": "First output → Text",
|
||||
@@ -148,8 +146,7 @@
|
||||
"upstreamPerformance": "Upstream performance",
|
||||
"requestObservation": "Request observation",
|
||||
"transport": "Transport",
|
||||
"cancelled": "Cancelled",
|
||||
"requestedModel": "Requested model: {model}"
|
||||
"cancelled": "Cancelled"
|
||||
},
|
||||
"balanceUnavailable": "Balance unavailable",
|
||||
"quota": "Quota",
|
||||
@@ -234,14 +231,11 @@
|
||||
"groupBy": "By {resultDimensionLabel}",
|
||||
"diagnosticDimension": "Diagnostic dimension",
|
||||
"noDiagnosticDataYet": "No diagnostic data yet",
|
||||
"successful": "Successful: {count}",
|
||||
"retryRate": "Retry rate: {rate}",
|
||||
"retries": "Retries: {count}",
|
||||
"loading": "Loading diagnostics",
|
||||
"empty": "No diagnostics in this range",
|
||||
"download": "Download",
|
||||
"errors": "Errors: {count}",
|
||||
"errorRate": "Error rate: {rate}"
|
||||
"errors": "Errors: {count}"
|
||||
},
|
||||
"cost": {
|
||||
"savings": "Savings",
|
||||
@@ -254,14 +248,11 @@
|
||||
"costEfficiency": "Costs",
|
||||
"description": "Costs, cache savings, tier premiums",
|
||||
"costView": "Cost view",
|
||||
"tierPremium": "Tier premium",
|
||||
"perSuccessfulRequest": "Cost/success",
|
||||
"costCoverage": "Cost coverage",
|
||||
"loading": "Loading costs",
|
||||
"empty": "No cost or cache savings data in this range",
|
||||
"premium": "Premium",
|
||||
"coverage": "Coverage",
|
||||
"perSuccessfulRequestHelp": "Cost per successful request"
|
||||
"coverage": "Coverage"
|
||||
},
|
||||
"error": {
|
||||
"noDetails": "No detailed error message was recorded",
|
||||
@@ -276,7 +267,6 @@
|
||||
"upstreamModel": "Upstream model",
|
||||
"clientTransfer": "Client transfer",
|
||||
"upstreamTransport": "Upstream transport",
|
||||
"clientStatusCode": "Client status code",
|
||||
"upstreamStatusCode": "Upstream status code",
|
||||
"requestId": "Request ID",
|
||||
"upstreamRequestId": "Upstream request ID",
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
"geminiModels": "Gemini 模型",
|
||||
"claudeGptModels": "Claude 和 GPT 模型"
|
||||
},
|
||||
"usageInThisWindow": "窗口消耗:{localUsageDisplay}",
|
||||
"quotaUsed": "额度已使用:{rate}",
|
||||
"resets": "重置时间: {resetAtDisplay}",
|
||||
"unobserved": "额度待观测",
|
||||
"dailyRequests": "日请求",
|
||||
@@ -43,7 +41,6 @@
|
||||
"autoUsePointsHelp": "订阅额度耗尽后,使用可用点数继续请求",
|
||||
"quotaPoints": "额度点数",
|
||||
"point": "点",
|
||||
"requestsInThisWindow": "窗口请求:{requestDisplay} 次",
|
||||
"requestCount": "{requestDisplay} 次",
|
||||
"statisticalRange": "统计范围",
|
||||
"rolling": "滚动 {duration}",
|
||||
@@ -65,11 +62,7 @@
|
||||
"rollingWindow": "滚动窗口",
|
||||
"windowConsumption": "窗口消耗",
|
||||
"resetTime": "重置时间",
|
||||
"localTokens": "本地累计总 Token",
|
||||
"totalTokensFor": "{windowLabelDisplay}总 Token",
|
||||
"usageRateHelp": "最近使用额度的当前已用比例",
|
||||
"usageRate": "使用率",
|
||||
"moreGroups": "另有 {count} 个额度组,可展开账号查看",
|
||||
"windows": {
|
||||
"fiveHour": "5小时额度",
|
||||
"daily": "日额度",
|
||||
@@ -149,14 +142,11 @@
|
||||
},
|
||||
"credentials": {
|
||||
"accountName": "账号名称",
|
||||
"baseUrlHelp": "填写 API 前缀,接口路径会自动追加",
|
||||
"apiPrefix": "API 前缀",
|
||||
"apiKeyPlaceholder": "留空保留当前密钥",
|
||||
"enterUpstreamKey": "输入上游密钥",
|
||||
"protocolLabel": "上游协议",
|
||||
"transportLabel": "传输方式",
|
||||
"webSocketHelp": "WS 需要上游支持 Responses WebSocket",
|
||||
"messagesTransportHelp": "Messages 上游使用 HTTP/SSE",
|
||||
"validation": {
|
||||
"urlLength": "上游 API 地址不能超过 2048 个字符",
|
||||
"urlFormat": "请输入不含认证、查询参数或片段的 HTTP 或 HTTPS 地址",
|
||||
@@ -333,7 +323,6 @@
|
||||
"reasoning": "推理",
|
||||
"modelUsageRanking": "模型用量",
|
||||
"totalTokens": "总 Token",
|
||||
"totalCharge": "总计费",
|
||||
"totalCharges": "总计费:",
|
||||
"noModelUsageYet": "暂无模型用量",
|
||||
"windows": {
|
||||
@@ -466,9 +455,7 @@
|
||||
"tokenActivityStatisticsMethod": "Token 活动统计方式",
|
||||
"noTokenActivityYet": "暂无 Token 活动",
|
||||
"noDailyActivity": "本次未获取到每日 Token 活动",
|
||||
"tokenActivityHeatmap": "Token 活动热力图,{rangeLabel}",
|
||||
"weekOfTokens": "{dateDisplay}所在周:{value} Tokens",
|
||||
"throughTokens": "截至{dateDisplay}:{value} Tokens"
|
||||
"tokenActivityHeatmap": "Token 活动热力图,{rangeLabel}"
|
||||
},
|
||||
"metrics": {
|
||||
"cumulativeNumberOfTokens": "累计 Token 数",
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
"totalCacheHits": "总缓存命中",
|
||||
"totalCache": "总缓存"
|
||||
},
|
||||
"comparedWithYesterday": "较昨日",
|
||||
"trends": {
|
||||
"title": "使用趋势",
|
||||
"metric": "趋势指标",
|
||||
@@ -80,19 +79,13 @@
|
||||
"clientIdentity": {
|
||||
"clientMode": "运行模式",
|
||||
"versionPolicy": "版本策略",
|
||||
"notChecked": "尚未检查",
|
||||
"customVersion": "固定自定义",
|
||||
"active": "当前生效",
|
||||
"activeDescription": "跟随通用设置的新请求使用此身份",
|
||||
"upToDate": "制品一致",
|
||||
"versionUpToDate": "版本一致",
|
||||
"upToDateDescription": "当前生效版本与官方最新发布一致",
|
||||
"updateAvailable": "发现新版",
|
||||
"latestRelease": "官方最新版本 {releaseLabel}",
|
||||
"checkFailed": "检查失败",
|
||||
"checkFailedDescription": "官方版本检查失败",
|
||||
"pending": "待检查",
|
||||
"pendingDescription": "尚未检查官方发布渠道",
|
||||
"verifiedAt": "画像核验 {verifiedAt}",
|
||||
"checkedAt": "发布检查 {checkedAt}",
|
||||
"clientId": "客户端 ID",
|
||||
|
||||
@@ -56,11 +56,9 @@
|
||||
"model": "模型",
|
||||
"other": "其他 {count} 个模型",
|
||||
"unknownModel": "未记录模型",
|
||||
"knownCost": "仅含已知美元费用",
|
||||
"costShare": "费用占比",
|
||||
"peakRequests": "单日最高请求数",
|
||||
"activeDays": "活跃天数",
|
||||
"includesEstimate": "含本地估算",
|
||||
"empty": "此期间没有用量记录",
|
||||
"missing": "此指标暂无已知数值"
|
||||
},
|
||||
|
||||
@@ -131,10 +131,6 @@
|
||||
"regionalConflict": "地区冲突",
|
||||
"parsingFailed": "解析失败",
|
||||
"exitNotRecognized": "出口未识别",
|
||||
"ipv4AndIpv6EgressTimeZonesAre": "IPv4 与 IPv6 出口时区不一致",
|
||||
"exitLocation": "出口地区:{label} · {timezone}",
|
||||
"detectHelp": "测试代理时解析出口地区",
|
||||
"customLocation": "自定义位置:{customLabel} · {timezone}",
|
||||
"custom": "自定义:{customLabel}"
|
||||
},
|
||||
"fields": {
|
||||
@@ -154,7 +150,6 @@
|
||||
"selectProxy": "选择代理 {name}",
|
||||
"credentialsSaved": "代理凭据已保存",
|
||||
"underTest": "测试中",
|
||||
"ms": "{message}(耗时 {latencyMs} ms)",
|
||||
"notTested": "未测试",
|
||||
"viewAccountsAssociatedWith": "查看 {name} 的 {count} 个关联账号",
|
||||
"disable": "确定禁用“{name}”吗?",
|
||||
|
||||
@@ -472,8 +472,6 @@
|
||||
},
|
||||
"storage": {
|
||||
"s3StorageConfiguration": "S3 存储配置",
|
||||
"connectionTestPassed": "已通过连接测试",
|
||||
"connectionTestHasNotPassed": "尚未通过连接测试",
|
||||
"testing": "测试中",
|
||||
"endpointAddress": "端点地址",
|
||||
"endpointHelp": "S3 兼容服务的 HTTPS 地址",
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
"total": "总耗时"
|
||||
},
|
||||
"performance": {
|
||||
"ttftHelp": "TTFT:首个 Token 耗时",
|
||||
"upstreamRateHelp": "输出 Token ÷ 上游响应耗时,输出包含推理 Token",
|
||||
"localRateHelp": "≈ 为本地平均速率:输出 Token ÷ 请求总耗时,包含等待、重试和网络耗时",
|
||||
"concurrency": "并发",
|
||||
@@ -129,7 +128,6 @@
|
||||
"stable": "稳定",
|
||||
"future": "未来",
|
||||
"status": {
|
||||
"mappedModel": "网关映射后发送给上游的模型:{secondary}",
|
||||
"firstOutputWaiting": "首个输出等待",
|
||||
"reasoningToText": "推理到正文",
|
||||
"firstOneIsOutputToText": "首个输出到正文",
|
||||
@@ -148,8 +146,7 @@
|
||||
"upstreamPerformance": "上游性能",
|
||||
"requestObservation": "请求观测",
|
||||
"transport": "传输观测",
|
||||
"cancelled": "已取消",
|
||||
"requestedModel": "请求模型:{model}"
|
||||
"cancelled": "已取消"
|
||||
},
|
||||
"balanceUnavailable": "未提供余额",
|
||||
"quota": "额度",
|
||||
@@ -234,14 +231,11 @@
|
||||
"groupBy": "按{resultDimensionLabel}聚合",
|
||||
"diagnosticDimension": "诊断维度",
|
||||
"noDiagnosticDataYet": "暂无诊断数据",
|
||||
"successful": "成功 {count}",
|
||||
"retryRate": "重试率 {rate}",
|
||||
"retries": "重试 {count}",
|
||||
"loading": "正在加载诊断数据",
|
||||
"empty": "当前范围暂无诊断数据",
|
||||
"download": "下载",
|
||||
"errors": "错误 {count} 次",
|
||||
"errorRate": "错误率 {rate}"
|
||||
"errors": "错误 {count} 次"
|
||||
},
|
||||
"cost": {
|
||||
"savings": "节省",
|
||||
@@ -254,14 +248,11 @@
|
||||
"costEfficiency": "成本效率",
|
||||
"description": "费用、缓存节省与服务层溢价",
|
||||
"costView": "成本视图",
|
||||
"tierPremium": "层级溢价",
|
||||
"perSuccessfulRequest": "每次成功请求",
|
||||
"costCoverage": "费用覆盖",
|
||||
"loading": "正在加载费用数据",
|
||||
"empty": "当前范围暂无费用或缓存节省数据",
|
||||
"premium": "溢价",
|
||||
"coverage": "覆盖率",
|
||||
"perSuccessfulRequestHelp": "每次成功请求的费用"
|
||||
"coverage": "覆盖率"
|
||||
},
|
||||
"error": {
|
||||
"noDetails": "未记录具体错误消息",
|
||||
@@ -276,7 +267,6 @@
|
||||
"upstreamModel": "上游模型",
|
||||
"clientTransfer": "客户端传输",
|
||||
"upstreamTransport": "上游传输",
|
||||
"clientStatusCode": "客户端状态码",
|
||||
"upstreamStatusCode": "上游状态码",
|
||||
"requestId": "请求 ID",
|
||||
"upstreamRequestId": "上游请求 ID",
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
"geminiModels": "Gemini 模型",
|
||||
"claudeGptModels": "Claude 和 GPT 模型"
|
||||
},
|
||||
"usageInThisWindow": "窗口消耗:{localUsageDisplay}",
|
||||
"quotaUsed": "額度已使用:{rate}",
|
||||
"resets": "重置時間: {resetAtDisplay}",
|
||||
"unobserved": "額度待觀測",
|
||||
"dailyRequests": "日請求",
|
||||
@@ -43,7 +41,6 @@
|
||||
"autoUsePointsHelp": "訂閱額度耗盡後,使用可用點數繼續請求",
|
||||
"quotaPoints": "額度點數",
|
||||
"point": "點",
|
||||
"requestsInThisWindow": "窗口請求:{requestDisplay} 次",
|
||||
"requestCount": "{requestDisplay} 次",
|
||||
"statisticalRange": "統計範圍",
|
||||
"rolling": "滾動 {duration}",
|
||||
@@ -65,11 +62,7 @@
|
||||
"rollingWindow": "滾動窗口",
|
||||
"windowConsumption": "窗口消耗",
|
||||
"resetTime": "重置時間",
|
||||
"localTokens": "本地累計總 Token",
|
||||
"totalTokensFor": "{windowLabelDisplay}總 Token",
|
||||
"usageRateHelp": "最近使用額度的當前已用比例",
|
||||
"usageRate": "使用率",
|
||||
"moreGroups": "另有 {count} 個額度組,可展開賬號查看",
|
||||
"windows": {
|
||||
"fiveHour": "5小時額度",
|
||||
"daily": "日額度",
|
||||
@@ -149,14 +142,11 @@
|
||||
},
|
||||
"credentials": {
|
||||
"accountName": "賬號名稱",
|
||||
"baseUrlHelp": "填寫 API 前綴,接口路徑會自動追加",
|
||||
"apiPrefix": "API 前綴",
|
||||
"apiKeyPlaceholder": "留空保留當前密鑰",
|
||||
"enterUpstreamKey": "輸入上游密鑰",
|
||||
"protocolLabel": "上游協議",
|
||||
"transportLabel": "傳輸方式",
|
||||
"webSocketHelp": "WS 需要上游支持 Responses WebSocket",
|
||||
"messagesTransportHelp": "Messages 上游使用 HTTP/SSE",
|
||||
"validation": {
|
||||
"urlLength": "上游 API 地址不能超過 2048 個字符",
|
||||
"urlFormat": "請輸入不含認證、查詢參數或片段的 HTTP 或 HTTPS 地址",
|
||||
@@ -333,7 +323,6 @@
|
||||
"reasoning": "推理",
|
||||
"modelUsageRanking": "模型用量",
|
||||
"totalTokens": "總 Token",
|
||||
"totalCharge": "總計費",
|
||||
"totalCharges": "總計費:",
|
||||
"noModelUsageYet": "暫無模型用量",
|
||||
"windows": {
|
||||
@@ -466,9 +455,7 @@
|
||||
"tokenActivityStatisticsMethod": "Token 活動統計方式",
|
||||
"noTokenActivityYet": "暫無 Token 活動",
|
||||
"noDailyActivity": "本次未獲取到每日 Token 活動",
|
||||
"tokenActivityHeatmap": "Token 活動熱力圖,{rangeLabel}",
|
||||
"weekOfTokens": "{dateDisplay}所在周:{value} Tokens",
|
||||
"throughTokens": "截至{dateDisplay}:{value} Tokens"
|
||||
"tokenActivityHeatmap": "Token 活動熱力圖,{rangeLabel}"
|
||||
},
|
||||
"metrics": {
|
||||
"cumulativeNumberOfTokens": "累計 Token 數",
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
"totalCacheHits": "總緩存命中",
|
||||
"totalCache": "總緩存"
|
||||
},
|
||||
"comparedWithYesterday": "較昨日",
|
||||
"trends": {
|
||||
"title": "使用趨勢",
|
||||
"metric": "趨勢指標",
|
||||
@@ -80,19 +79,13 @@
|
||||
"clientIdentity": {
|
||||
"clientMode": "運行模式",
|
||||
"versionPolicy": "版本策略",
|
||||
"notChecked": "尚未檢查",
|
||||
"customVersion": "固定自定義",
|
||||
"active": "當前生效",
|
||||
"activeDescription": "跟隨通用設置的新請求使用此身份",
|
||||
"upToDate": "製品一致",
|
||||
"versionUpToDate": "版本一致",
|
||||
"upToDateDescription": "當前生效版本與官方最新發布一致",
|
||||
"updateAvailable": "發現新版",
|
||||
"latestRelease": "官方最新版本 {releaseLabel}",
|
||||
"checkFailed": "檢查失敗",
|
||||
"checkFailedDescription": "官方版本檢查失敗",
|
||||
"pending": "待檢查",
|
||||
"pendingDescription": "尚未檢查官方發佈渠道",
|
||||
"verifiedAt": "畫像覈驗 {verifiedAt}",
|
||||
"checkedAt": "發佈檢查 {checkedAt}",
|
||||
"clientId": "客戶端 ID",
|
||||
|
||||
@@ -56,11 +56,9 @@
|
||||
"model": "模型",
|
||||
"other": "其他 {count} 個模型",
|
||||
"unknownModel": "未記錄模型",
|
||||
"knownCost": "僅含已知美元費用",
|
||||
"costShare": "費用佔比",
|
||||
"peakRequests": "單日最高請求數",
|
||||
"activeDays": "活躍天數",
|
||||
"includesEstimate": "含本機估算",
|
||||
"empty": "此期間沒有用量記錄",
|
||||
"missing": "此指標暫無已知數值"
|
||||
},
|
||||
|
||||
@@ -131,10 +131,6 @@
|
||||
"regionalConflict": "地區衝突",
|
||||
"parsingFailed": "解析失敗",
|
||||
"exitNotRecognized": "出口未識別",
|
||||
"ipv4AndIpv6EgressTimeZonesAre": "IPv4 與 IPv6 出口時區不一致",
|
||||
"exitLocation": "出口地區:{label} · {timezone}",
|
||||
"detectHelp": "測試代理時解析出口地區",
|
||||
"customLocation": "自定義位置:{customLabel} · {timezone}",
|
||||
"custom": "自定義:{customLabel}"
|
||||
},
|
||||
"fields": {
|
||||
@@ -154,7 +150,6 @@
|
||||
"selectProxy": "選擇代理 {name}",
|
||||
"credentialsSaved": "代理憑據已保存",
|
||||
"underTest": "測試中",
|
||||
"ms": "{message}(耗時 {latencyMs} ms)",
|
||||
"notTested": "未測試",
|
||||
"viewAccountsAssociatedWith": "查看 {name} 的 {count} 個關聯賬號",
|
||||
"disable": "確定禁用“{name}”嗎?",
|
||||
|
||||
@@ -472,8 +472,6 @@
|
||||
},
|
||||
"storage": {
|
||||
"s3StorageConfiguration": "S3 存儲配置",
|
||||
"connectionTestPassed": "已通過連接測試",
|
||||
"connectionTestHasNotPassed": "尚未通過連接測試",
|
||||
"testing": "測試中",
|
||||
"endpointAddress": "端點地址",
|
||||
"endpointHelp": "S3 兼容服務的 HTTPS 地址",
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
"total": "總耗時"
|
||||
},
|
||||
"performance": {
|
||||
"ttftHelp": "TTFT:首個 Token 耗時",
|
||||
"upstreamRateHelp": "輸出 Token ÷ 上游響應耗時,輸出包含推理 Token",
|
||||
"localRateHelp": "≈ 為本地平均速率:輸出 Token ÷ 請求總耗時,包含等待、重試和網絡耗時",
|
||||
"concurrency": "並發",
|
||||
@@ -129,7 +128,6 @@
|
||||
"stable": "穩定",
|
||||
"future": "未來",
|
||||
"status": {
|
||||
"mappedModel": "網關映射後發送給上游的模型:{secondary}",
|
||||
"firstOutputWaiting": "首個輸出等待",
|
||||
"reasoningToText": "推理到正文",
|
||||
"firstOneIsOutputToText": "首個輸出到正文",
|
||||
@@ -148,8 +146,7 @@
|
||||
"upstreamPerformance": "上游性能",
|
||||
"requestObservation": "請求觀測",
|
||||
"transport": "傳輸觀測",
|
||||
"cancelled": "已取消",
|
||||
"requestedModel": "請求模型:{model}"
|
||||
"cancelled": "已取消"
|
||||
},
|
||||
"balanceUnavailable": "未提供餘額",
|
||||
"quota": "額度",
|
||||
@@ -234,14 +231,11 @@
|
||||
"groupBy": "按{resultDimensionLabel}聚合",
|
||||
"diagnosticDimension": "診斷維度",
|
||||
"noDiagnosticDataYet": "暫無診斷數據",
|
||||
"successful": "成功 {count}",
|
||||
"retryRate": "重試率 {rate}",
|
||||
"retries": "重試 {count}",
|
||||
"loading": "正在加載診斷數據",
|
||||
"empty": "當前範圍暫無診斷數據",
|
||||
"download": "下載",
|
||||
"errors": "錯誤 {count} 次",
|
||||
"errorRate": "錯誤率 {rate}"
|
||||
"errors": "錯誤 {count} 次"
|
||||
},
|
||||
"cost": {
|
||||
"savings": "節省",
|
||||
@@ -254,14 +248,11 @@
|
||||
"costEfficiency": "成本效率",
|
||||
"description": "費用、緩存節省與服務層溢價",
|
||||
"costView": "成本視圖",
|
||||
"tierPremium": "層級溢價",
|
||||
"perSuccessfulRequest": "每次成功請求",
|
||||
"costCoverage": "費用覆蓋",
|
||||
"loading": "正在加載費用數據",
|
||||
"empty": "當前範圍暫無費用或緩存節省數據",
|
||||
"premium": "溢價",
|
||||
"coverage": "覆蓋率",
|
||||
"perSuccessfulRequestHelp": "每次成功請求的費用"
|
||||
"coverage": "覆蓋率"
|
||||
},
|
||||
"error": {
|
||||
"noDetails": "未記錄具體錯誤消息",
|
||||
@@ -276,7 +267,6 @@
|
||||
"upstreamModel": "上游模型",
|
||||
"clientTransfer": "客戶端傳輸",
|
||||
"upstreamTransport": "上游傳輸",
|
||||
"clientStatusCode": "客戶端狀態碼",
|
||||
"upstreamStatusCode": "上游狀態碼",
|
||||
"requestId": "請求 ID",
|
||||
"upstreamRequestId": "上游請求 ID",
|
||||
|
||||
@@ -288,7 +288,6 @@ watch(
|
||||
</div>
|
||||
<p
|
||||
class="mt-2 mb-0 h-[1em] truncate font-mono text-z leading-none font-bold text-z-text"
|
||||
:title="item.title || item.value"
|
||||
>
|
||||
<ZSkeleton
|
||||
v-if="loading || ((checking || changingChannel) && item.key === 'latest')"
|
||||
@@ -393,7 +392,6 @@ watch(
|
||||
</div>
|
||||
<span
|
||||
class="inline-flex h-6 items-center gap-1.5 rounded-full bg-z-fill-quaternary px-2 text-z-xs leading-none font-bold text-z-text-secondary"
|
||||
:title="updateStreamError || undefined"
|
||||
>
|
||||
<i
|
||||
class="size-1.5 rounded-full"
|
||||
|
||||
@@ -102,7 +102,6 @@ function resolveSummaryItems(input: SystemUpdatePresentationInput) {
|
||||
value: input.loading
|
||||
? '...'
|
||||
: versionLabel(input.updateInfo?.currentVersion ?? input.version?.version),
|
||||
title: input.updateInfo?.currentVersion ?? input.version?.version,
|
||||
},
|
||||
{
|
||||
key: 'latest',
|
||||
@@ -110,20 +109,17 @@ function resolveSummaryItems(input: SystemUpdatePresentationInput) {
|
||||
value: input.updateInfo?.warning
|
||||
? t('systemUpdate.status.unconfirmedVersion')
|
||||
: versionLabel(input.updateInfo?.latestVersion),
|
||||
title: input.updateInfo?.warning ? undefined : input.updateInfo?.latestVersion,
|
||||
releaseUrl: input.updateInfo?.releaseUrl,
|
||||
},
|
||||
{
|
||||
key: 'build',
|
||||
label: t('systemUpdate.build'),
|
||||
value: buildTypeLabel(input.updateInfo?.buildType),
|
||||
title: input.updateInfo?.buildType,
|
||||
},
|
||||
{
|
||||
key: 'deployment',
|
||||
label: t('systemUpdate.deployment'),
|
||||
value: deploymentModeLabel(input.version?.deploymentMode),
|
||||
title: input.version?.deploymentMode,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ function updateProtocol(protocol: string) {
|
||||
<template>
|
||||
<ZFormItem class="col-span-full" prop="connection.base_url" :rules="rules.base_url" :show-message="Boolean(form.base_url.trim())" :label="t('common.fields.baseUrl')" required>
|
||||
<template #extra>
|
||||
<span class="text-z-xs text-z-text-quaternary" :title="t('accounts.credentials.baseUrlHelp')">{{ t('accounts.credentials.apiPrefix') }}</span>
|
||||
<span class="text-z-xs text-z-text-quaternary">{{ t('accounts.credentials.apiPrefix') }}</span>
|
||||
</template>
|
||||
<ZInput v-model="form.base_url" type="url" placeholder="https://api.example.com/v1" :disabled="disabled" autocomplete="off" />
|
||||
</ZFormItem>
|
||||
@@ -51,7 +51,7 @@ function updateProtocol(protocol: string) {
|
||||
<ZSegmented class="w-full" :model-value="form.protocol" :aria-label="t('accounts.credentials.protocolLabel')" :options="protocolOptions" :disabled="disabled" @update:model-value="updateProtocol" />
|
||||
</ZFormItem>
|
||||
<ZFormItem prop="connection.transport" :rules="rules.transport" :show-message="false" :label="t('accounts.credentials.transportLabel')">
|
||||
<ZSegmented v-model="form.transport" class="w-full" :aria-label="t('accounts.credentials.transportLabel')" :options="transportOptions" :disabled="disabled" :title="form.protocol === 'messages' ? t('accounts.credentials.messagesTransportHelp') : t('accounts.credentials.webSocketHelp')" />
|
||||
<ZSegmented v-model="form.transport" class="w-full" :aria-label="t('accounts.credentials.transportLabel')" :options="transportOptions" :disabled="disabled" />
|
||||
</ZFormItem>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -162,7 +162,6 @@ function connectionLogClass(tone: string) {
|
||||
</p>
|
||||
<p
|
||||
class="mt-1.5 mb-0 truncate font-mono text-z-sm font-emphasis text-z-text"
|
||||
:title="model || '-'"
|
||||
>
|
||||
{{ model || '-' }}
|
||||
</p>
|
||||
|
||||
@@ -119,7 +119,6 @@ const groupOptions = computed(() => [
|
||||
<ZMenuItem
|
||||
:loading="exportingAccounts"
|
||||
:disabled="Boolean(exportDisabledReason)"
|
||||
:title="exportDisabledReason || undefined"
|
||||
:aria-description="exportDisabledReason || undefined"
|
||||
@click="(close(), emit('exportSelected'))"
|
||||
>
|
||||
|
||||
@@ -37,13 +37,6 @@ const displayTitle = computed(() => {
|
||||
|
||||
const visibleNotes = computed(() => props.showNotes ? props.account.notes : undefined)
|
||||
|
||||
const identityTitle = computed(() => {
|
||||
const email = emailText.value
|
||||
return email && email !== displayTitle.value
|
||||
? `${displayTitle.value}\n${email}`
|
||||
: displayTitle.value
|
||||
})
|
||||
|
||||
const secondaryText = computed(() => {
|
||||
if (visibleNotes.value)
|
||||
return visibleNotes.value
|
||||
@@ -80,7 +73,7 @@ const avatarToneClass = computed(() => {
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="min-w-0 truncate text-z font-heavy text-z-text" :title="identityTitle">
|
||||
<span class="min-w-0 truncate text-z font-heavy text-z-text">
|
||||
{{ displayTitle }}
|
||||
</span>
|
||||
<AccountPlanBadge v-if="showPlan" class="shrink-0" :upstream="account.upstream" :authentication-kind="account.authenticationKind" :plan-type="account.planType" :plan-type-display="account.planTypeDisplay" size="sm" />
|
||||
|
||||
@@ -133,14 +133,14 @@ const modelUsageColumns = computed(() => (defineTableColumns<AccountModelUsage>(
|
||||
<div class="ml-auto flex items-baseline gap-4">
|
||||
<div v-if="hasUsageSummary" class="flex items-baseline gap-1.5 whitespace-nowrap">
|
||||
<Sigma class="size-3.5 self-center text-z-text-tertiary" :stroke-width="1.75" />
|
||||
<span :title="t('accounts.usage.totalTokens')">
|
||||
<span>
|
||||
<span class="sr-only">{{ t('accounts.usage.totalTokens') }}</span>
|
||||
<span class="font-mono text-z-sm font-emphasis tabular-nums text-z-text">
|
||||
{{ account.usage.totalTokensDisplay }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="mx-0.5 text-[10px] leading-none font-emphasis text-z-text-quaternary"> / </span>
|
||||
<span :title="t('accounts.usage.totalCharge')">
|
||||
<span>
|
||||
<span class="sr-only">{{ t('accounts.usage.totalCharges') }}</span>
|
||||
<span class="font-mono text-z-sm font-heavy tabular-nums text-z-green-text">
|
||||
{{ totalBillingDisplay }}
|
||||
@@ -165,7 +165,7 @@ const modelUsageColumns = computed(() => (defineTableColumns<AccountModelUsage>(
|
||||
</span>
|
||||
</template>
|
||||
<template #lastUsedAt="{ row }">
|
||||
<LastUsedAtCell :value="row.lastUsedAt" :full-display="row.lastUsedAtFullDisplay" />
|
||||
<LastUsedAtCell :value="row.lastUsedAt" />
|
||||
</template>
|
||||
</ZTable>
|
||||
</div>
|
||||
|
||||
+1
-2
@@ -60,13 +60,12 @@ const columns = computed(() => (defineTableColumns<AccountConcurrencyEntry>([
|
||||
<template #key="{ row }">
|
||||
<span
|
||||
class="block truncate font-emphasis text-z-text"
|
||||
:title="[row.clientKeyName, row.clientKeyId].filter(Boolean).join('\n') || undefined"
|
||||
>
|
||||
{{ row.clientKeyName ?? row.clientKeyId ?? '—' }}
|
||||
</span>
|
||||
</template>
|
||||
<template #model="{ displayValue }">
|
||||
<span class="text-z font-normal text-z-text-secondary" :title="String(displayValue)">{{ displayValue }}</span>
|
||||
<span class="text-z font-normal text-z-text-secondary">{{ displayValue }}</span>
|
||||
</template>
|
||||
<template #startedAtDisplay="{ displayValue }">
|
||||
<span class="text-z">{{ displayValue }}</span>
|
||||
|
||||
@@ -124,7 +124,7 @@ watch(hasAttention, (value) => {
|
||||
<p class="col-span-2 col-start-2 row-start-2 min-w-0 text-xs leading-relaxed wrap-anywhere text-z-text-secondary sm:col-span-1 sm:col-start-3 sm:row-start-1">
|
||||
{{ itemDescription(item) }}
|
||||
</p>
|
||||
<span class="col-start-3 row-start-1 inline-flex items-center justify-self-end sm:col-start-4" :title="itemStates[item.status].label">
|
||||
<span class="col-start-3 row-start-1 inline-flex items-center justify-self-end sm:col-start-4">
|
||||
<template v-if="item.status === 'succeeded' || item.status === 'failed'">
|
||||
<Check v-if="item.status === 'succeeded'" class="size-4 text-z-success-text" aria-hidden="true" />
|
||||
<X v-else class="size-4 text-z-error-text" aria-hidden="true" />
|
||||
|
||||
@@ -17,12 +17,10 @@ const metrics = computed(() => [
|
||||
{
|
||||
label: t('accounts.profile.metrics.cumulativeNumberOfTokens'),
|
||||
value: formatMetric(props.profile?.summary.totalTextTokens),
|
||||
title: formatExact(props.profile?.summary.totalTextTokens),
|
||||
},
|
||||
{
|
||||
label: t('accounts.profile.metrics.peakNumberOfTokens'),
|
||||
value: formatMetric(props.profile?.summary.peakTokens),
|
||||
title: formatExact(props.profile?.summary.peakTokens),
|
||||
},
|
||||
{
|
||||
label: t('accounts.profile.metrics.maximumChatDuration'),
|
||||
@@ -44,12 +42,6 @@ function formatMetric(value: number | null | undefined) {
|
||||
: formatCompactNumber(value)
|
||||
}
|
||||
|
||||
function formatExact(value: number | null | undefined) {
|
||||
return value == null
|
||||
? undefined
|
||||
: `${formatInteger(value)} Tokens`
|
||||
}
|
||||
|
||||
function formatDays(value: number | null | undefined) {
|
||||
return value == null
|
||||
? '—'
|
||||
@@ -87,7 +79,7 @@ function formatDuration(value: number | null | undefined) {
|
||||
<section class="@container min-w-0 py-1" :aria-label="t('accounts.profile.metrics.cumulativeActivitySummary')" :aria-busy="loading">
|
||||
<dl class="grid grid-cols-2 gap-y-4 @sm:grid-cols-3 @[34rem]:grid-cols-5">
|
||||
<div v-for="metric in metrics" :key="metric.label" class="min-w-0 px-2 text-center sm:px-3">
|
||||
<dd class="m-0 font-mono text-z-lg leading-tight font-heavy whitespace-nowrap tabular-nums text-z-text" :title="metric.title">
|
||||
<dd class="m-0 font-mono text-z-lg leading-tight font-heavy whitespace-nowrap tabular-nums text-z-text">
|
||||
<ZSkeleton v-if="loading && !profile" shape="text" class="mx-auto h-4 w-14" />
|
||||
<template v-else>
|
||||
{{ metric.value }}
|
||||
|
||||
@@ -77,7 +77,7 @@ watch(
|
||||
class="mt-1.5 grid min-w-0 gap-0.5 text-z-xs font-semibold text-z-text-secondary"
|
||||
>
|
||||
<span v-if="username" class="truncate">{{ username }}</span>
|
||||
<span v-if="accountIdentity" class="truncate" :title="accountIdentity">{{ accountIdentity }}</span>
|
||||
<span v-if="accountIdentity" class="truncate">{{ accountIdentity }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ZEmpty, ZSegmented } from '@codex-proxy/ui'
|
||||
import { computed, shallowRef } from 'vue'
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { buildProfileActivityGrid, profileActivityCellLabel } from './activity'
|
||||
import { buildProfileActivityGrid } from './activity'
|
||||
|
||||
const props = defineProps<{
|
||||
calendar: ProfileActivityCalendar | null
|
||||
@@ -91,7 +91,6 @@ const monthLabels = computed(() =>
|
||||
:key="cell.date"
|
||||
class="aspect-square rounded-[3px] transition-colors motion-reduce:transition-none"
|
||||
:class="cell.isFuture ? 'invisible' : levelClasses[cell.level]"
|
||||
:title="profileActivityCellLabel(cell, mode)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { ProfileActivityCalendar } from '@/api'
|
||||
import { t } from '@/i18n'
|
||||
import { formatCompactNumber } from '@/utils/format'
|
||||
|
||||
export type ProfileActivityMode = 'daily' | 'weekly' | 'cumulative'
|
||||
export type ProfileActivityLevel = 0 | 1 | 2 | 3 | 4
|
||||
@@ -33,12 +31,3 @@ export function buildProfileActivityGrid(calendar: ProfileActivityCalendar | nul
|
||||
}
|
||||
return { weeks, rangeLabel: calendar?.rangeLabel ?? '' }
|
||||
}
|
||||
|
||||
export function profileActivityCellLabel(cell: { dateDisplay: string, value: number }, mode: ProfileActivityMode) {
|
||||
const value = formatCompactNumber(cell.value)
|
||||
if (mode === 'weekly')
|
||||
return t('accounts.profile.activity.weekOfTokens', { dateDisplay: cell.dateDisplay, value })
|
||||
if (mode === 'cumulative')
|
||||
return t('accounts.profile.activity.throughTokens', { dateDisplay: cell.dateDisplay, value })
|
||||
return `${cell.dateDisplay}:${value} Tokens`
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ const testHint = computed(() => selectedProxy.value?.enabled === false
|
||||
<ZSelect v-model="selection" class="w-full" :class="{ '**:[[role=combobox]]:pr-28': selectedTest?.success }" :options="options" :disabled="disabled || loading" :aria-label="t('accounts.proxy.outboundTunnel')">
|
||||
<template #option="{ option, selected }">
|
||||
<span class="min-w-0 truncate" :class="option.description ? 'max-w-1/2 shrink-0' : 'flex-1'">{{ option.label }}</span>
|
||||
<span v-if="option.description" class="min-w-0 flex-1 truncate font-normal" :class="option.disabled ? 'text-z-text-disabled' : 'text-z-text-tertiary'" :title="option.description">
|
||||
<span v-if="option.description" class="min-w-0 flex-1 truncate font-normal" :class="option.disabled ? 'text-z-text-disabled' : 'text-z-text-tertiary'">
|
||||
{{ option.description }}
|
||||
</span>
|
||||
<AccountProxyTestBadge class="ml-auto" :result="optionTests[option.value]" in-option />
|
||||
|
||||
@@ -20,13 +20,6 @@ const emit = defineEmits<{ accountUpdated: [account: Account] }>()
|
||||
|
||||
const { t } = useI18n({ useScope: 'global' })
|
||||
const accountLabel = computed(() => accountIdentityLabel(props.account))
|
||||
const accountTitle = computed(() => {
|
||||
const email = props.account.email?.trim()
|
||||
return email && email !== accountLabel.value
|
||||
? `${accountLabel.value}\n${email}`
|
||||
: accountLabel.value
|
||||
})
|
||||
|
||||
const open = defineModel<boolean>({ default: false })
|
||||
const period = ref('weekly')
|
||||
const explanationOpen = ref(false)
|
||||
@@ -95,7 +88,7 @@ function handleExplanationKeydown(event: KeyboardEvent) {
|
||||
<div class="flex flex-wrap items-center gap-x-4 gap-y-2.5">
|
||||
<div class="flex min-w-0 flex-[1_1_12rem] items-center gap-2">
|
||||
<ProviderIconGroup :platform-icon="account.platformIcon" :provider="account.provider" class="shrink-0" />
|
||||
<strong class="min-w-0 truncate text-z font-emphasis text-z-text" :title="accountTitle">{{ accountLabel }}</strong>
|
||||
<strong class="min-w-0 truncate text-z font-emphasis text-z-text">{{ accountLabel }}</strong>
|
||||
<AccountPlanBadge :upstream="account.upstream" :authentication-kind="account.authenticationKind" :plan-type="account.planType" :plan-type-display="account.planTypeDisplay" size="sm" class="max-w-1/2 shrink-0" />
|
||||
</div>
|
||||
<ZSegmented v-model="period" :aria-label="t('accounts.quotaForecast.forecastPeriod')" :options="options" size="small" class="basis-36 grow sm:grow-0" />
|
||||
|
||||
@@ -54,7 +54,6 @@ const items = computed(() => props.windows.map((window) => {
|
||||
<h4
|
||||
v-if="grouped && label && windows[0]?.limitId !== 'codex'"
|
||||
class="m-0 truncate text-z-xs leading-4 font-heavy text-z-text-secondary"
|
||||
:title="label"
|
||||
>
|
||||
{{ label }}
|
||||
</h4>
|
||||
@@ -71,7 +70,6 @@ const items = computed(() => props.windows.map((window) => {
|
||||
</span>
|
||||
<strong
|
||||
class="shrink-0 font-mono font-heavy tabular-nums text-z-text"
|
||||
:title="t('accounts.quota.requestsInThisWindow', { requestDisplay: item.requestDisplay })"
|
||||
>
|
||||
{{ t('accounts.quota.requestCount', { requestDisplay: item.requestDisplay }) }}
|
||||
</strong>
|
||||
@@ -87,7 +85,6 @@ const items = computed(() => props.windows.map((window) => {
|
||||
<span class="shrink-0 font-emphasis">{{ t('accounts.quota.statisticalRange') }}</span>
|
||||
<span
|
||||
class="min-w-0 truncate font-mono font-emphasis tabular-nums"
|
||||
:title="t('accounts.quota.rolling', { duration: item.durationDisplay })"
|
||||
>
|
||||
{{ t('accounts.quota.rolling', { duration: item.durationDisplay }) }}
|
||||
</span>
|
||||
@@ -95,7 +92,7 @@ const items = computed(() => props.windows.map((window) => {
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="flex min-w-0 items-baseline justify-between gap-2 text-z-xs leading-3.5">
|
||||
<span class="min-w-0 truncate font-bold text-z-text-quaternary" :title="item.observationDisplay || undefined">
|
||||
<span class="min-w-0 truncate font-bold text-z-text-quaternary">
|
||||
{{ item.label }}
|
||||
</span>
|
||||
<span class="flex shrink-0 items-baseline gap-1.5 font-mono font-heavy tabular-nums">
|
||||
@@ -108,14 +105,12 @@ const items = computed(() => props.windows.map((window) => {
|
||||
<strong
|
||||
v-if="item.localUsageDisplay"
|
||||
class="text-z-text-quaternary"
|
||||
:title="t('accounts.quota.usageInThisWindow', { localUsageDisplay: item.localUsageDisplay })"
|
||||
>
|
||||
{{ item.localUsageDisplay }}
|
||||
</strong>
|
||||
<strong
|
||||
v-if="!item.amountUsedDisplay || item.usedPercent !== null"
|
||||
:class="item.percentTextClass"
|
||||
:title="item.usedPercent === null ? undefined : t('accounts.quota.quotaUsed', { rate: item.quotaValueDisplay })"
|
||||
>
|
||||
{{ item.quotaValueDisplay }}
|
||||
</strong>
|
||||
@@ -140,7 +135,7 @@ const items = computed(() => props.windows.map((window) => {
|
||||
|
||||
<p class="m-0 flex min-w-0 items-center justify-between gap-2 text-[10px] leading-3.5 text-z-text-tertiary">
|
||||
<span class="shrink-0 font-emphasis">{{ t('common.actions.reset') }}</span>
|
||||
<span class="min-w-0 truncate font-mono font-emphasis tabular-nums" :title="item.resetAtDisplay">
|
||||
<span class="min-w-0 truncate font-mono font-emphasis tabular-nums">
|
||||
{{ item.resetAtDisplay }}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
@@ -26,17 +26,17 @@ const plans = computed(() => {
|
||||
<PoolChart v-if="nodes.length" :nodes="nodes" />
|
||||
<div v-if="pool || upstream?.maxConcurrency != null || upstream?.requestsPerMinute != null" class="flex min-h-5 min-w-0 flex-wrap items-end justify-between gap-x-3 gap-y-1.5">
|
||||
<div class="flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-z-xs leading-none tabular-nums text-z-text-secondary">
|
||||
<span v-if="pool" class="inline-flex items-center gap-1 whitespace-nowrap" :title="t('accounts.upstream.readyAccounts')">
|
||||
<span v-if="pool" class="inline-flex items-center gap-1 whitespace-nowrap">
|
||||
<Users aria-hidden="true" :stroke-width="1.75" class="size-2.75 text-z-text-tertiary" />
|
||||
<span class="sr-only">{{ t('accounts.upstream.readyAccounts') }}</span>
|
||||
<strong class="font-heavy" :class="pool.states.ready > 0 ? 'text-z-success-text' : 'text-z-text'">{{ pool.states.ready }}</strong>
|
||||
<span class="text-z-text-quaternary">/ {{ pool.accountCount }}</span>
|
||||
</span>
|
||||
<span v-if="upstream?.maxConcurrency != null" class="inline-flex items-center gap-1" :title="t('accounts.upstream.keyConcurrency')">
|
||||
<span v-if="upstream?.maxConcurrency != null" class="inline-flex items-center gap-1">
|
||||
<Network aria-hidden="true" :stroke-width="1.75" class="size-2.25 text-z-text-tertiary" />
|
||||
<span class="sr-only">{{ t('accounts.upstream.keyConcurrency') }}</span>{{ upstream.maxConcurrency || '∞' }}
|
||||
</span>
|
||||
<span v-if="upstream?.requestsPerMinute != null" class="inline-flex items-center gap-1" :title="t('accounts.upstream.keyRpm')">
|
||||
<span v-if="upstream?.requestsPerMinute != null" class="inline-flex items-center gap-1">
|
||||
<Gauge aria-hidden="true" :stroke-width="1.75" class="size-2.75 text-z-text-tertiary" />
|
||||
<span class="sr-only">{{ t('accounts.upstream.keyRpm') }}</span>{{ upstream.requestsPerMinute || '∞' }}
|
||||
</span>
|
||||
|
||||
@@ -69,9 +69,6 @@ const lastRefreshed = computed(() => {
|
||||
})
|
||||
: undefined
|
||||
})
|
||||
const refreshTitle = computed(() => props.account.upstream?.observedAt
|
||||
? props.account.upstream.observedAtDisplay
|
||||
: lastRefreshed.value)
|
||||
watch(hasPersonalInfo, (available) => {
|
||||
if (!available)
|
||||
profileOpen.value = false
|
||||
@@ -89,7 +86,7 @@ watch(hasPersonalInfo, (available) => {
|
||||
class="col-span-2 row-start-2 m-0 flex min-w-0 items-center gap-1.5 text-z-xs font-emphasis text-z-text-secondary"
|
||||
>
|
||||
<AccountPlanBadge v-if="hasPlanBadge" :upstream="account.upstream" :authentication-kind="account.authenticationKind" :plan-type="account.planType" :plan-type-display="account.planTypeDisplay" size="sm" class="shrink-0" />
|
||||
<span v-if="lastRefreshed" class="min-w-0 truncate" :title="refreshTitle">{{ lastRefreshed }}</span>
|
||||
<span v-if="lastRefreshed" class="min-w-0 truncate">{{ lastRefreshed }}</span>
|
||||
</p>
|
||||
<div v-if="hasActions" class="col-start-2 row-start-1 flex items-center gap-0.5 [&_svg]:size-3.5 [&_svg]:stroke-2">
|
||||
<QuotaActionButton
|
||||
|
||||
@@ -54,7 +54,6 @@ const hasQuotaWindow = computed(() => props.windows.some(window => typeof window
|
||||
variant="compact"
|
||||
:show-local-value="false"
|
||||
:show-percentage="false"
|
||||
:show-native-tooltip="false"
|
||||
/>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
@@ -41,15 +41,6 @@ const recentUsageEntry = computed(() => recentlyUsedQuotaEntry(
|
||||
))
|
||||
const currentUsageWindow = computed(() => representativeQuotaWindow(recentUsageEntry.value))
|
||||
const currentUsageDisplay = computed(() => currentUsageWindow.value?.usedPercentDisplay ?? '—')
|
||||
const summaryValue = computed(() => {
|
||||
return {
|
||||
value: props.account.usage.totalTokensDisplay,
|
||||
label: t('common.units.tokens'),
|
||||
title: props.account.authenticationKind === 'api_key'
|
||||
? t('accounts.quota.localTokens')
|
||||
: t('accounts.quota.totalTokensFor', { windowLabelDisplay: usageWindowLabels.value[props.account.usage.windowKind] }),
|
||||
}
|
||||
})
|
||||
const currentUsageTextClass = computed(() => currentUsageWindow.value
|
||||
? quotaWindowPresentation(currentUsageWindow.value, '2px').percentTextClass
|
||||
: 'text-z-text-quaternary')
|
||||
@@ -65,19 +56,17 @@ const additionalEntryCount = computed(() => Math.max(summaryEntries.value.length
|
||||
<span
|
||||
v-if="localUsageOnly || hasTokenUsage"
|
||||
class="flex min-w-0 items-baseline gap-1 font-mono tabular-nums"
|
||||
:title="summaryValue.title"
|
||||
>
|
||||
<strong class="truncate text-z-xs font-heavy text-z-text">
|
||||
{{ summaryValue.value }}
|
||||
{{ account.usage.totalTokensDisplay }}
|
||||
</strong>
|
||||
<span class="shrink-0 text-[9px] font-emphasis tracking-[0.02em] text-z-text-quaternary">
|
||||
{{ summaryValue.label }}
|
||||
{{ t('common.units.tokens') }}
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="currentUsageWindow"
|
||||
class="ml-auto flex shrink-0 items-baseline gap-1 text-[9px] font-emphasis text-z-text-quaternary"
|
||||
:title="t('accounts.quota.usageRateHelp')"
|
||||
>
|
||||
<span>{{ t('accounts.quota.usageRate') }}</span>
|
||||
<strong class="font-mono font-heavy tabular-nums" :class="currentUsageTextClass">
|
||||
@@ -110,7 +99,6 @@ const additionalEntryCount = computed(() => Math.max(summaryEntries.value.length
|
||||
<span
|
||||
v-if="additionalEntryCount > 0"
|
||||
class="grid h-5 min-w-5 shrink-0 place-items-center rounded-z bg-current/10 px-1 font-mono text-[9px] font-heavy tabular-nums text-z-text-tertiary"
|
||||
:title="t('accounts.quota.moreGroups', { count: additionalEntryCount })"
|
||||
>
|
||||
+{{ additionalEntryCount }}
|
||||
</span>
|
||||
|
||||
@@ -341,7 +341,7 @@ const {
|
||||
</template>
|
||||
|
||||
<template #lastUsedAt="{ row }">
|
||||
<LastUsedAtCell :value="row.usage.lastUsedAt" :full-display="row.usage.lastUsedAtFullDisplay" />
|
||||
<LastUsedAtCell :value="row.usage.lastUsedAt" />
|
||||
</template>
|
||||
|
||||
<template #actions="{ row }">
|
||||
|
||||
@@ -72,7 +72,7 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="inline-flex items-center gap-1.75" :aria-label="statusLabel" :title="statusLabel">
|
||||
<span class="inline-flex items-center gap-1.75" :aria-label="statusLabel">
|
||||
<span class="relative inline-flex size-2 shrink-0 items-center justify-center">
|
||||
<span ref="heartbeatRing" class="absolute size-2 rounded-full bg-z-success opacity-0" />
|
||||
<span ref="heartbeatDot" class="relative size-1.5 rounded-full bg-z-success" />
|
||||
|
||||
@@ -32,7 +32,6 @@ const avatarToneClass = computed(() =>
|
||||
<span
|
||||
class="inline-flex size-9 items-center justify-center rounded-lg shadow-z-tertiary"
|
||||
:class="avatarToneClass"
|
||||
:title="platform.label"
|
||||
>
|
||||
<component :is="platform.icon" v-if="platform.icon" class="size-3.5" />
|
||||
<span v-else class="text-z-xs font-heavy">?</span>
|
||||
@@ -41,7 +40,6 @@ const avatarToneClass = computed(() =>
|
||||
|
||||
<span
|
||||
class="absolute -right-1 -bottom-1 inline-flex size-4 items-center justify-center rounded-[5px] bg-z-bg-container text-z-text shadow-z-tertiary"
|
||||
:title="authenticationLabel"
|
||||
>
|
||||
<component :is="authenticationIconComponent" v-if="authenticationIconComponent" class="size-2.5" />
|
||||
<span v-else class="text-[8px] font-heavy text-z-text-quaternary">?</span>
|
||||
@@ -59,7 +57,6 @@ const avatarToneClass = computed(() =>
|
||||
<span
|
||||
v-if="secondaryText"
|
||||
class="mt-0.5 block min-w-0 truncate font-mono text-z-xs font-emphasis text-z-text-quaternary"
|
||||
:title="secondaryText"
|
||||
>
|
||||
{{ secondaryText }}
|
||||
</span>
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { MetricCardView } from './cards'
|
||||
import { ZCard, ZMotionIcon } from '@codex-proxy/ui'
|
||||
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import AnimatedMetricValue from '@/components/AnimatedMetricValue.vue'
|
||||
import BaseChart from '@/components/base-chart/index.vue'
|
||||
@@ -17,8 +16,6 @@ const props = defineProps<{
|
||||
metric: MetricCardView
|
||||
}>()
|
||||
|
||||
const { t } = useI18n({ useScope: 'global' })
|
||||
|
||||
const trendToneClasses: Record<MetricTone, string> = {
|
||||
normal: 'bg-z-text-tertiary',
|
||||
info: 'bg-z-info-text',
|
||||
@@ -102,7 +99,6 @@ const sparklineOption = computed<EChartsOption | null>(() => {
|
||||
</strong>
|
||||
<i
|
||||
v-if="metric.trend && metric.trend.direction !== 'flat'"
|
||||
:title="t('dashboard.comparedWithYesterday')"
|
||||
class="mb-1.25 block size-3"
|
||||
:class="[
|
||||
trendToneClasses[metric.trend.tone],
|
||||
|
||||
@@ -86,7 +86,6 @@ function selectKind(value: string) {
|
||||
</span>
|
||||
<strong
|
||||
class="truncate font-mono text-z-xl leading-none font-heavy tabular-nums text-z-text"
|
||||
:title="item.value"
|
||||
>
|
||||
{{ item.value }}
|
||||
</strong>
|
||||
|
||||
@@ -50,15 +50,6 @@ const versionParts = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const releaseLabel = computed(() => {
|
||||
const release = profile.value?.release
|
||||
if (!release?.latestVersion)
|
||||
return t('dashboard.clientIdentity.notChecked')
|
||||
return release.latestBuild
|
||||
? `${release.latestVersion} · Build ${release.latestBuild}`
|
||||
: release.latestVersion
|
||||
})
|
||||
|
||||
const releaseStatus = computed(() => {
|
||||
const current = profile.value
|
||||
if (!current?.release) {
|
||||
@@ -66,7 +57,6 @@ const releaseStatus = computed(() => {
|
||||
label: current?.attributes.some(item => item.key === 'version_policy' && item.value === 'fixed')
|
||||
? t('dashboard.clientIdentity.customVersion')
|
||||
: t('dashboard.clientIdentity.active'),
|
||||
title: t('dashboard.clientIdentity.activeDescription'),
|
||||
tone: 'bg-z-info-container text-z-info-on-container',
|
||||
icon: ShieldCheck,
|
||||
}
|
||||
@@ -76,7 +66,6 @@ const releaseStatus = computed(() => {
|
||||
if (status === 'aligned') {
|
||||
return {
|
||||
label: identity.value?.alignedLabel,
|
||||
title: t('dashboard.clientIdentity.upToDateDescription'),
|
||||
tone: 'bg-z-success-container text-z-success-on-container',
|
||||
icon: CheckCircle2,
|
||||
}
|
||||
@@ -84,7 +73,6 @@ const releaseStatus = computed(() => {
|
||||
if (status === 'review_required') {
|
||||
return {
|
||||
label: t('dashboard.clientIdentity.updateAvailable'),
|
||||
title: t('dashboard.clientIdentity.latestRelease', { releaseLabel: releaseLabel.value }),
|
||||
tone: 'bg-z-warning-container text-z-warning-on-container',
|
||||
icon: TriangleAlert,
|
||||
}
|
||||
@@ -92,14 +80,12 @@ const releaseStatus = computed(() => {
|
||||
if (status === 'check_failed') {
|
||||
return {
|
||||
label: t('dashboard.clientIdentity.checkFailed'),
|
||||
title: current.release.error || t('dashboard.clientIdentity.checkFailedDescription'),
|
||||
tone: 'bg-z-error-container text-z-error-on-container',
|
||||
icon: TriangleAlert,
|
||||
}
|
||||
}
|
||||
return {
|
||||
label: t('dashboard.clientIdentity.pending'),
|
||||
title: t('dashboard.clientIdentity.pendingDescription'),
|
||||
tone: 'bg-z-cyan-container text-z-cyan-on-container',
|
||||
icon: RefreshCw,
|
||||
}
|
||||
@@ -172,12 +158,11 @@ const runtimeEnvironment = computed(() => {
|
||||
<span class="inline-flex size-7 shrink-0 items-center justify-center rounded-lg bg-z-fill-tertiary">
|
||||
<Box class="size-3.75 text-z-text-secondary" />
|
||||
</span>
|
||||
<span class="truncate text-z-xs leading-none font-heavy" :title="profile.product">{{ profile.product }}</span>
|
||||
<span class="truncate text-z-xs leading-none font-heavy">{{ profile.product }}</span>
|
||||
</div>
|
||||
<span
|
||||
class="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-z-sm leading-none font-bold"
|
||||
:class="releaseStatus.tone"
|
||||
:title="releaseStatus.title"
|
||||
>
|
||||
<component :is="releaseStatus.icon" class="size-3.5" />
|
||||
{{ releaseStatus.label }}
|
||||
@@ -245,7 +230,7 @@ const runtimeEnvironment = computed(() => {
|
||||
v-if="verifiedLabel || checkedLabel"
|
||||
class="flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-1 text-[10px] leading-none font-emphasis text-z-text-quaternary"
|
||||
>
|
||||
<span v-if="verifiedLabel" :title="profile.userAgent">{{ verifiedLabel }}</span>
|
||||
<span v-if="verifiedLabel">{{ verifiedLabel }}</span>
|
||||
<span v-if="checkedLabel">{{ checkedLabel }}</span>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
@@ -99,7 +99,7 @@ const metrics = computed<MetricItem[]>(() => {
|
||||
|
||||
<dl v-else class="m-0 flex items-center gap-2.5 whitespace-nowrap text-xs leading-none">
|
||||
<div v-for="metric in metrics" :key="metric.label" class="inline-flex min-w-0 items-center gap-1">
|
||||
<dt class="flex items-center" :class="toneClasses[metric.tone]" :title="metric.label">
|
||||
<dt class="flex items-center" :class="toneClasses[metric.tone]">
|
||||
<component :is="metric.icon" v-if="metric.icon" class="size-3 shrink-0" />
|
||||
<span class="sr-only">{{ metric.label }}</span>
|
||||
</dt>
|
||||
|
||||
@@ -116,7 +116,6 @@ const { allSelected, indeterminate, selectedRowKeys, toggleSelection, toggleAll
|
||||
:class="row.fastMode !== 'disabled'
|
||||
? 'bg-z-warning-container text-z-warning-on-container'
|
||||
: 'bg-z-fill-tertiary text-z-text-tertiary'"
|
||||
:title="fastModeLabel(row.fastMode)"
|
||||
role="img"
|
||||
:aria-label="fastModeLabel(row.fastMode)"
|
||||
>
|
||||
@@ -127,7 +126,6 @@ const { allSelected, indeterminate, selectedRowKeys, toggleSelection, toggleAll
|
||||
<span
|
||||
v-if="!row.allowImageGeneration"
|
||||
class="inline-flex size-4 shrink-0 items-center justify-center rounded-full bg-z-fill-tertiary text-z-text-tertiary"
|
||||
:title="t('groups.page.imageGenerationDisabled')"
|
||||
role="img"
|
||||
:aria-label="t('groups.page.imageGenerationDisabled')"
|
||||
>
|
||||
@@ -144,7 +142,6 @@ const { allSelected, indeterminate, selectedRowKeys, toggleSelection, toggleAll
|
||||
<span
|
||||
class="mx-auto block size-4 rounded-sm"
|
||||
:style="{ backgroundColor: row.color }"
|
||||
:title="row.color"
|
||||
:aria-label="t('groups.page.colorLabel', { color: row.color })"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -42,7 +42,7 @@ async function logout() {
|
||||
<ZPageHeader :title="t('usage.header.title')">
|
||||
<template #description>
|
||||
<span class="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5">
|
||||
<span class="min-w-0 truncate text-z font-semibold text-z-text" :title="name">
|
||||
<span class="min-w-0 truncate text-z font-semibold text-z-text">
|
||||
{{ name || t('usage.header.currentKey') }}
|
||||
</span>
|
||||
<span v-if="prefix" class="inline-flex shrink-0 items-center gap-1.5 rounded-z-sm bg-z-fill-tertiary px-2 py-0.5 text-z-text-secondary" :aria-label="t('usage.header.keyPrefix')">
|
||||
|
||||
@@ -36,11 +36,6 @@ const metrics = computed(() => [
|
||||
: item.percentage
|
||||
? `${item.value.toFixed(1)}%`
|
||||
: formatCompactNumber(item.value),
|
||||
exact: item.value === null
|
||||
? '—'
|
||||
: item.percentage
|
||||
? `${item.value.toFixed(1)}%`
|
||||
: formatInteger(item.value),
|
||||
})))
|
||||
</script>
|
||||
|
||||
@@ -85,7 +80,7 @@ const metrics = computed(() => [
|
||||
<component :is="item.icon" class="size-4.5 shrink-0" :class="item.tone" aria-hidden="true" />
|
||||
{{ item.label }}
|
||||
</dt>
|
||||
<dd class="mx-0 mt-5 mb-0 truncate font-mono text-2xl leading-[1.05] font-heavy tabular-nums text-z-text" :title="item.exact">
|
||||
<dd class="mx-0 mt-5 mb-0 truncate font-mono text-2xl leading-[1.05] font-heavy tabular-nums text-z-text">
|
||||
{{ item.display }}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -8,10 +8,10 @@ defineProps<{
|
||||
|
||||
<template>
|
||||
<div class="grid min-w-0 gap-1">
|
||||
<strong class="truncate text-z text-z-text" :title="apiKey.name">
|
||||
<strong class="truncate text-z text-z-text">
|
||||
{{ apiKey.name }}
|
||||
</strong>
|
||||
<span v-if="apiKey.label" class="truncate text-z-xs font-emphasis text-z-text-quaternary" :title="apiKey.label">
|
||||
<span v-if="apiKey.label" class="truncate text-z-xs font-emphasis text-z-text-quaternary">
|
||||
{{ apiKey.label }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -127,9 +127,6 @@ const columns = computed(() => defineTableColumns<KeyModelRow>([
|
||||
<template #empty>
|
||||
<span v-if="!error && result" class="text-z-sm text-z-text-secondary">{{ t('keys.statistics.empty') }}</span>
|
||||
</template>
|
||||
<template #costUsd="{ row, displayValue }">
|
||||
<span :title="[row.totals.hasEstimatedCost && t('keys.statistics.includesEstimate'), row.totals.hasMissingCost && t('keys.statistics.knownCost')].filter(Boolean).join(' · ') || undefined">{{ displayValue }}</span>
|
||||
</template>
|
||||
</ZTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -116,8 +116,8 @@ function loadMore(direction: string) {
|
||||
>
|
||||
<template #option="{ option }">
|
||||
<ProviderIconGroup :platform-icon="(option as ReferenceAccountOption).platformIcon" :provider="(option as ReferenceAccountOption).provider" size="sm" class="shrink-0" />
|
||||
<span class="min-w-0 truncate" :class="{ 'max-w-1/2 shrink-0': option.description }" :title="option.label">{{ option.label }}</span>
|
||||
<span v-if="option.description" class="min-w-0 flex-1 truncate font-normal text-z-text-tertiary" :title="option.description">{{ option.description }}</span>
|
||||
<span class="min-w-0 truncate" :class="{ 'max-w-1/2 shrink-0': option.description }">{{ option.label }}</span>
|
||||
<span v-if="option.description" class="min-w-0 flex-1 truncate font-normal text-z-text-tertiary">{{ option.description }}</span>
|
||||
</template>
|
||||
<template v-if="error" #empty>
|
||||
<div role="status" class="flex items-center justify-between gap-2 p-2 text-z-sm text-z-text-secondary">
|
||||
|
||||
@@ -235,7 +235,7 @@ watch([showFormModal, showBatchEdit], ([editor, batch]) => {
|
||||
<ApiKeyStatusBadge :api-key="row" />
|
||||
</template>
|
||||
<template #lastUsedAt="{ row }">
|
||||
<LastUsedAtCell :value="row.lastUsedAt" :full-display="row.lastUsedAtFullDisplay" />
|
||||
<LastUsedAtCell :value="row.lastUsedAt" />
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<ApiKeyActions
|
||||
|
||||
@@ -82,7 +82,6 @@ watch(() => props.disabled, (value) => {
|
||||
ref="trigger"
|
||||
type="button"
|
||||
:disabled="disabled"
|
||||
:title="selectedAsset?.name"
|
||||
:aria-label="selectedAsset ? t('plugins.assets.pluginPackage', { name: selectedAsset.name }) : t('plugins.assets.selectPluginPackage')"
|
||||
aria-haspopup="listbox"
|
||||
:aria-expanded="open"
|
||||
@@ -112,7 +111,6 @@ watch(() => props.disabled, (value) => {
|
||||
type="button"
|
||||
role="option"
|
||||
tabindex="-1"
|
||||
:title="asset.name"
|
||||
:aria-selected="selected === asset.name"
|
||||
:disabled="disabled"
|
||||
class="flex w-full min-w-0 items-center gap-3 rounded-z-sm border-0 px-3 py-2.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-z-control-outline focus-visible:ring-inset"
|
||||
|
||||
@@ -74,7 +74,7 @@ watch(() => hidden.value.length, (count) => {
|
||||
</div>
|
||||
</div>
|
||||
<ZTag v-for="entry in visible" :key="entry.capability" size="small" :type="primary ? 'primary' : 'default'" class="shrink-0">
|
||||
<span :title="`${entry.label} · ${entry.id}`">{{ entry.label }}</span>
|
||||
<span>{{ entry.label }}</span>
|
||||
</ZTag>
|
||||
<ZPopover v-if="hidden.length" v-model="open" trigger="hover-click" placement="top" class="shrink-0">
|
||||
<template #reference>
|
||||
@@ -92,7 +92,7 @@ watch(() => hidden.value.length, (count) => {
|
||||
</template>
|
||||
<div :id="contentId" role="tooltip" class="flex max-w-72 flex-wrap gap-1.5 p-3">
|
||||
<ZTag v-for="entry in hidden" :key="entry.capability" size="small" :type="primary ? 'primary' : 'default'">
|
||||
<span :title="entry.id">{{ entry.label }}</span>
|
||||
<span>{{ entry.label }}</span>
|
||||
</ZTag>
|
||||
</div>
|
||||
</ZPopover>
|
||||
|
||||
@@ -136,7 +136,7 @@ const columns = computed(() => (defineTableColumns<(typeof rows.value)[number]>(
|
||||
<div class="grid min-w-0 flex-1 gap-1">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<strong class="truncate text-z-sm">{{ plugin.artifact.metadata.displayName }}</strong>
|
||||
<ZTag size="small" class="shrink-0" :title="plugin.versionTitle" :aria-label="plugin.versionTitle">
|
||||
<ZTag size="small" class="shrink-0" :aria-label="plugin.versionTitle">
|
||||
<span class="block max-w-28 truncate">{{ plugin.versionLabel }}</span>
|
||||
</ZTag>
|
||||
</div>
|
||||
@@ -168,7 +168,7 @@ const columns = computed(() => (defineTableColumns<(typeof rows.value)[number]>(
|
||||
<div class="grid min-w-0 gap-1">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<strong class="truncate">{{ row.artifact.metadata.displayName }}</strong>
|
||||
<ZTag size="small" class="shrink-0" :title="row.versionTitle" :aria-label="row.versionTitle">
|
||||
<ZTag size="small" class="shrink-0" :aria-label="row.versionTitle">
|
||||
<span class="block max-w-28 truncate">{{ row.versionLabel }}</span>
|
||||
</ZTag>
|
||||
</div>
|
||||
|
||||
@@ -52,10 +52,10 @@ function openView(view: PluginManagementView) {
|
||||
<Blocks class="size-4" />
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<h2 class="m-0 truncate text-z-lg font-heavy text-z-text" :title="view.name">
|
||||
<h2 class="m-0 truncate text-z-lg font-heavy text-z-text">
|
||||
{{ view.name }}
|
||||
</h2>
|
||||
<p class="mt-1 mb-0 truncate font-mono text-z-xs text-z-text-quaternary" :title="view.target.instanceId">
|
||||
<p class="mt-1 mb-0 truncate font-mono text-z-xs text-z-text-quaternary">
|
||||
{{ t('plugins.extensions.configuration', { value: shortPluginInstanceId(view.target.instanceId) }) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -620,7 +620,7 @@ watch(
|
||||
{{ t('plugins.installation.parsingCompleted') }}
|
||||
</span>
|
||||
</div>
|
||||
<p class="mt-1 mb-0 break-all font-mono text-z-xs text-z-text-secondary" :title="`SHA-256 ${verified.metadata.sha256}`">
|
||||
<p class="mt-1 mb-0 break-all font-mono text-z-xs text-z-text-secondary">
|
||||
{{ verified.metadata.pluginId }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user