From 7a35325f1b4533c2305af779876a809359941f36 Mon Sep 17 00:00:00 2001 From: reoring Date: Mon, 9 Nov 2026 11:24:20 +0900 Subject: [PATCH] catalog listing: measure bounds in UTF-8 bytes like the Cloud store; shorten over-long Japanese alt text --- catalog/listing.yaml | 130 ++++++++++++++++++++-------------------- hack/catalog-listing.ts | 9 +-- 2 files changed, 70 insertions(+), 69 deletions(-) diff --git a/catalog/listing.yaml b/catalog/listing.yaml index 6eecc01..1fb94d4 100644 --- a/catalog/listing.yaml +++ b/catalog/listing.yaml @@ -22,69 +22,69 @@ locales: Inference には GPU ノードが必要です。ブランチごとに NVIDIA GPU を 1 基使うため、本番とステージングの両方を動かすと 2 基になります。必要な数はインストール前のダイアログに表示されます。モデルはアプリに同梱されていてインターネットに接続せずに動くので、プロンプトと応答はプロジェクトの中で処理されます。Inference に専用の画面はなく、インストール・更新・削除はマーケットプレイスから行います。 highlights: - - screenshot: marketplace-detail - locales: - en: - title: OpenAI-compatible chat API - body: Existing code for OpenAI-compatible APIs works with /v1/chat/completions and /v1/models. Replies can be streamed, and the model name can be omitted. - ja: - title: OpenAI 互換のチャット API - body: OpenAI 互換の API 向けに書いたコードを、そのまま /v1/chat/completions と /v1/models に向けられます。応答はストリーミングでも受け取れ、モデル名は省略できます。 - - screenshot: install-gpu - locales: - en: - title: See the GPU count before installing - body: The install dialog lists the NVIDIA GPUs each branch needs and the total, so you know what the Project must provide before the app starts. - ja: - title: 必要な GPU をインストール前に確認 - body: インストールのダイアログに、ブランチごとに必要な NVIDIA GPU の数と合計が表示されます。アプリを動かす前に、プロジェクトに用意すべき数が分かります。 - - screenshot: install-production-only - locales: - en: - title: One GPU with production only - body: Staging runs as a separate copy with its own GPU. Choose production only to run a single copy on one GPU. - ja: - title: 本番だけなら GPU は 1 基 - body: ステージングは専用の GPU を使う別のコピーとして動きます。「本番のみ」を選ぶと、1 基の GPU で 1 つだけ動かせます。 - - screenshot: version-select - locales: - en: - title: Pin a version or follow updates - body: Pick the version at install time and either keep it pinned or let new versions in the same release line install automatically. - ja: - title: バージョンは固定も自動更新も選べます - body: インストール時にバージョンを選び、そのまま固定するか、同じリリースラインの新しいバージョンを自動で入れるかを決められます。 - - screenshot: catalog-card - locales: - en: - title: Stays inside the Project - body: The model ships with the app and runs without internet access. With AI Gateway installed, chat requests can be routed to Inference under the Project AI policy. - ja: - title: プロジェクトの中で完結 - body: モデルはアプリに同梱されており、インターネットに接続せずに動きます。AI Gateway を入れていれば、プロジェクトの AI ポリシーに沿ってチャットのリクエストを Inference に振り分けられます。 +- screenshot: marketplace-detail + locales: + en: + title: OpenAI-compatible chat API + body: Existing code for OpenAI-compatible APIs works with /v1/chat/completions and /v1/models. Replies can be streamed, and the model name can be omitted. + ja: + title: OpenAI 互換のチャット API + body: OpenAI 互換の API 向けに書いたコードを、そのまま /v1/chat/completions と /v1/models に向けられます。応答はストリーミングでも受け取れ、モデル名は省略できます。 +- screenshot: install-gpu + locales: + en: + title: See the GPU count before installing + body: The install dialog lists the NVIDIA GPUs each branch needs and the total, so you know what the Project must provide before the app starts. + ja: + title: 必要な GPU をインストール前に確認 + body: インストールのダイアログに、ブランチごとに必要な NVIDIA GPU の数と合計が表示されます。アプリを動かす前に、プロジェクトに用意すべき数が分かります。 +- screenshot: install-production-only + locales: + en: + title: One GPU with production only + body: Staging runs as a separate copy with its own GPU. Choose production only to run a single copy on one GPU. + ja: + title: 本番だけなら GPU は 1 基 + body: ステージングは専用の GPU を使う別のコピーとして動きます。「本番のみ」を選ぶと、1 基の GPU で 1 つだけ動かせます。 +- screenshot: version-select + locales: + en: + title: Pin a version or follow updates + body: Pick the version at install time and either keep it pinned or let new versions in the same release line install automatically. + ja: + title: バージョンは固定も自動更新も選べます + body: インストール時にバージョンを選び、そのまま固定するか、同じリリースラインの新しいバージョンを自動で入れるかを決められます。 +- screenshot: catalog-card + locales: + en: + title: Stays inside the Project + body: The model ships with the app and runs without internet access. With AI Gateway installed, chat requests can be routed to Inference under the Project AI policy. + ja: + title: プロジェクトの中で完結 + body: モデルはアプリに同梱されており、インターネットに接続せずに動きます。AI Gateway を入れていれば、プロジェクトの AI ポリシーに沿ってチャットのリクエストを Inference に振り分けられます。 screenshots: - - name: marketplace-detail - file: marketplace-detail.webp - alt: - en: "Dashboard Marketplace page for Inference: the Assist badge, the description of OpenAI-compatible chat completions with Qwen2.5-0.5B-Instruct that requires a GPU, an Install button, and versions 0.1.0 and 0.2.0 (default)." - ja: "ダッシュボードのマーケットプレイスにある Inference のページ。Assist のバッジ、Qwen2.5-0.5B-Instruct による OpenAI 互換のチャット応答で GPU が必要という説明、インストールボタン、バージョン 0.1.0 と 0.2.0(既定)が並んでいます。" - - name: install-gpu - file: install-gpu.webp - alt: - en: "Install dialog for Inference with version 0.2.0, pinned updates and production plus staging selected; the accelerator table shows 1 NVIDIA GPU for production, 1 for staging, 2 in total." - ja: "Inference のインストールダイアログ。バージョン 0.2.0、バージョンを固定、本番とステージングを選んだ状態で、アクセラレータ欄に本番 1 NVIDIA GPU、ステージング 1 NVIDIA GPU、合計 2 NVIDIA GPU と表示されています。" - - name: install-production-only - file: install-production-only.webp - alt: - en: "The same install dialog with production only selected; the accelerator table now shows 1 NVIDIA GPU for production and 1 in total." - ja: "同じインストールダイアログで「本番のみ」を選んだ状態。アクセラレータ欄は本番 1 NVIDIA GPU、合計 1 NVIDIA GPU に変わっています。" - - name: version-select - file: version-select.webp - alt: - en: "Version menu open in the install dialog, listing 0.1.0 and 0.2.0 (recommended) with 0.2.0 checked, above the pinned-version and branch options." - ja: "インストールダイアログでバージョンの一覧を開いた状態。0.1.0 と 0.2.0(推奨)が並び、0.2.0 にチェックが付いています。下にはバージョン固定とブランチの選択肢があります。" - - name: catalog-card - file: catalog-card.webp - alt: - en: "Catalog section of the Marketplace: AI Gateway and Embedding marked as installed, and the Inference card showing version 0.2.0, follow or pin updates, and an Install button." - ja: "マーケットプレイスのカタログ欄。AI Gateway と Embedding はインストール済みで、Inference のカードにはバージョン 0.2.0、更新方法(自動で更新 / バージョンを固定)、インストールボタンが表示されています。" +- name: marketplace-detail + file: marketplace-detail.webp + alt: + en: 'Dashboard Marketplace page for Inference: the Assist badge, the description of OpenAI-compatible chat completions with Qwen2.5-0.5B-Instruct that requires a GPU, an Install button, and versions 0.1.0 and 0.2.0 (default).' + ja: マーケットプレイスの Inference ページ。説明文、インストールボタン、更新の選択肢、バージョン 0.1.0 と 0.2.0(既定)が並んでいます。 +- name: install-gpu + file: install-gpu.webp + alt: + en: Install dialog for Inference with version 0.2.0, pinned updates and production plus staging selected; the accelerator table shows 1 NVIDIA GPU for production, 1 for staging, 2 in total. + ja: Inference のインストールダイアログ。バージョン 0.2.0、バージョンを固定、本番とステージングを選んだ状態で、アクセラレータ欄に本番 1 NVIDIA GPU、ステージング 1 NVIDIA GPU、合計 2 NVIDIA GPU と表示されています。 +- name: install-production-only + file: install-production-only.webp + alt: + en: The same install dialog with production only selected; the accelerator table now shows 1 NVIDIA GPU for production and 1 in total. + ja: 同じインストールダイアログで「本番のみ」を選んだ状態。アクセラレータ欄は本番 1 NVIDIA GPU、合計 1 NVIDIA GPU に変わっています。 +- name: version-select + file: version-select.webp + alt: + en: Version menu open in the install dialog, listing 0.1.0 and 0.2.0 (recommended) with 0.2.0 checked, above the pinned-version and branch options. + ja: インストールダイアログでバージョンの一覧を開いた状態。0.1.0 と 0.2.0(推奨)が並び、0.2.0 にチェックが付いています。下にはバージョン固定とブランチの選択肢があります。 +- name: catalog-card + file: catalog-card.webp + alt: + en: 'Catalog section of the Marketplace: AI Gateway and Embedding marked as installed, and the Inference card showing version 0.2.0, follow or pin updates, and an Install button.' + ja: マーケットプレイスのカタログ欄。AI Gateway と Embedding はインストール済みで、Inference のカードにはバージョン 0.2.0、更新方法(自動で更新 / バージョンを固定)、インストールボタンが表示されています。 diff --git a/hack/catalog-listing.ts b/hack/catalog-listing.ts index 12cc073..f615dda 100644 --- a/hack/catalog-listing.ts +++ b/hack/catalog-listing.ts @@ -60,8 +60,9 @@ const localeTag = /^[a-z]{2,3}$/ const dnsLabel = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/ const versionName = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/ +// Limits are UTF-8 bytes, as the Cloud store and the CRD measure them. function bound(value: string | undefined, max: number, what: string): void { - if (value !== undefined && value.length > max) throw new Error(`${what} exceeds ${max} characters`) + if (value !== undefined && Buffer.byteLength(value) > max) throw new Error(`${what} exceeds ${max} UTF-8 bytes`) } function localizedText(text: Record | undefined, max: number, what: string): void { @@ -70,7 +71,7 @@ function localizedText(text: Record | undefined, max: number, wh if (Object.keys(text).length > 16) throw new Error(`${what} has more than 16 locales`) for (const [tag, value] of Object.entries(text)) { if (!localeTag.test(tag)) throw new Error(`${what} locale "${tag}" must be a BCP 47 primary tag`) - if (!value || value.length > max) throw new Error(`${what} locale "${tag}" must be 1-${max} characters`) + if (!value || Buffer.byteLength(value) > max) throw new Error(`${what} locale "${tag}" must be 1-${max} UTF-8 bytes`) } } @@ -95,7 +96,7 @@ export function validateListing(listing: Listing): void { if (screenshots.length > 8) throw new Error('listing has more than 8 screenshots') const names = new Set() for (const media of screenshots) { - if (!dnsLabel.test(media.name) || media.name.length > 63 || names.has(media.name)) { + if (!dnsLabel.test(media.name) || Buffer.byteLength(media.name) > 63 || names.has(media.name)) { throw new Error(`screenshot name "${media.name}" is invalid or duplicated`) } names.add(media.name) @@ -113,7 +114,7 @@ export function validateListing(listing: Listing): void { if (!highlight.locales || !(FALLBACK_LOCALE in highlight.locales)) throw new Error(`highlight ${index} requires the "${FALLBACK_LOCALE}" locale`) if (Object.keys(highlight.locales).length > 16) throw new Error(`highlight ${index} has more than 16 locales`) for (const [tag, locale] of Object.entries(highlight.locales)) { - if (!localeTag.test(tag) || !locale.title || locale.title.length > 80 || (locale.body ?? '').length > 400) { + if (!localeTag.test(tag) || !locale.title || Buffer.byteLength(locale.title) > 80 || Buffer.byteLength(locale.body ?? '') > 400) { throw new Error(`highlight ${index} locale "${tag}" is invalid`) } }