From 3344aaabb68d80d03f3b91320e78ef44ab603249 Mon Sep 17 00:00:00 2001 From: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com> Date: Wed, 6 Aug 2025 14:20:32 +0800 Subject: [PATCH 01/14] minor fix: translation for contentEnableLabel (#23483) --- web/i18n/de-DE/app-debug.ts | 2 +- web/i18n/en-US/app-debug.ts | 2 +- web/i18n/es-ES/app-debug.ts | 2 +- web/i18n/fa-IR/app-debug.ts | 2 +- web/i18n/fr-FR/app-debug.ts | 4 ++-- web/i18n/hi-IN/app-debug.ts | 2 +- web/i18n/it-IT/app-debug.ts | 2 +- web/i18n/ja-JP/app-debug.ts | 2 +- web/i18n/ko-KR/app-debug.ts | 2 +- web/i18n/pt-BR/app-debug.ts | 2 +- web/i18n/ro-RO/app-debug.ts | 2 +- web/i18n/ru-RU/app-debug.ts | 2 +- web/i18n/sl-SI/app-debug.ts | 2 +- web/i18n/th-TH/app-debug.ts | 2 +- web/i18n/tr-TR/app-debug.ts | 2 +- web/i18n/uk-UA/app-debug.ts | 2 +- web/i18n/zh-Hans/app-debug.ts | 2 +- web/i18n/zh-Hant/app-debug.ts | 4 ++-- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/web/i18n/de-DE/app-debug.ts b/web/i18n/de-DE/app-debug.ts index 68f674b76a..7f8b27c0d0 100644 --- a/web/i18n/de-DE/app-debug.ts +++ b/web/i18n/de-DE/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Moderater Inhalt aktiviert', + contentEnableLabel: 'Inhaltsmoderation aktiviert', }, fileUpload: { title: 'Datei-Upload', diff --git a/web/i18n/en-US/app-debug.ts b/web/i18n/en-US/app-debug.ts index 589d91fb20..4f76873008 100644 --- a/web/i18n/en-US/app-debug.ts +++ b/web/i18n/en-US/app-debug.ts @@ -163,7 +163,7 @@ const translation = { moderation: { title: 'Content moderation', description: 'Secure model output by using moderation API or maintaining a sensitive word list.', - contentEnableLabel: 'Enabled moderate content', + contentEnableLabel: 'Content moderation enabled', allEnabled: 'INPUT & OUTPUT', inputEnabled: 'INPUT', outputEnabled: 'OUTPUT', diff --git a/web/i18n/es-ES/app-debug.ts b/web/i18n/es-ES/app-debug.ts index dd670fab04..9c01ecdd56 100644 --- a/web/i18n/es-ES/app-debug.ts +++ b/web/i18n/es-ES/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Contenido moderado habilitado', + contentEnableLabel: 'Moderación de contenido habilitada', }, fileUpload: { title: 'Subida de archivos', diff --git a/web/i18n/fa-IR/app-debug.ts b/web/i18n/fa-IR/app-debug.ts index 333fb68620..f7953b6b67 100644 --- a/web/i18n/fa-IR/app-debug.ts +++ b/web/i18n/fa-IR/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'محتوای متوسط فعال شده است', + contentEnableLabel: 'مدیریت محتوا فعال شده است', }, generate: { title: 'تولید کننده دستورالعمل', diff --git a/web/i18n/fr-FR/app-debug.ts b/web/i18n/fr-FR/app-debug.ts index 910113074b..19c2db9756 100644 --- a/web/i18n/fr-FR/app-debug.ts +++ b/web/i18n/fr-FR/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: 'Sorry, but you didn\'t provide a text to translate. Could you please provide the text?', }, }, - contentEnableLabel: 'Activation du contenu modéré', + contentEnableLabel: 'Modération de contenu activée', }, fileUpload: { title: 'Téléchargement de fichier', @@ -242,7 +242,7 @@ const translation = { 'Veuillez attendre que la réponse à la tâche en lot soit terminée.', notSelectModel: 'Veuillez choisir un modèle', waitForImgUpload: 'Veuillez attendre que l\'image soit téléchargée', - waitForFileUpload: 'Veuillez patienter jusqu’à ce que le(s) fichier(s) soit/les fichiers à télécharger', + waitForFileUpload: 'Veuillez patienter pendant le téléchargement du/des fichier(s)', }, chatSubTitle: 'Instructions', completionSubTitle: 'Indicatif de Prompt', diff --git a/web/i18n/hi-IN/app-debug.ts b/web/i18n/hi-IN/app-debug.ts index 04b50da9ed..b67c164afe 100644 --- a/web/i18n/hi-IN/app-debug.ts +++ b/web/i18n/hi-IN/app-debug.ts @@ -213,7 +213,7 @@ const translation = { after: 'में कॉन्फ़िगर किए गए ओपनएआई एपीआई कुंजी की आवश्यकता होती है।', }, }, - contentEnableLabel: 'मध्य स्तर की सामग्री सक्षम की गई', + contentEnableLabel: 'सामग्री मॉडरेशन सक्षम है', }, fileUpload: { numberLimit: 'मैक्स अपलोड करता है', diff --git a/web/i18n/it-IT/app-debug.ts b/web/i18n/it-IT/app-debug.ts index 9344c88976..0d00641d99 100644 --- a/web/i18n/it-IT/app-debug.ts +++ b/web/i18n/it-IT/app-debug.ts @@ -215,7 +215,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Abilitato il contenuto moderato', + contentEnableLabel: 'Moderazione dei contenuti abilitata', }, fileUpload: { title: 'Caricamento File', diff --git a/web/i18n/ja-JP/app-debug.ts b/web/i18n/ja-JP/app-debug.ts index 66e06950f5..40447ac4e2 100644 --- a/web/i18n/ja-JP/app-debug.ts +++ b/web/i18n/ja-JP/app-debug.ts @@ -163,7 +163,7 @@ const translation = { moderation: { title: 'コンテンツのモデレーション', description: 'モデレーション API を使用するか、機密語リストを維持することで、モデルの出力を安全にします。', - contentEnableLabel: 'モデレート・コンテンツを有効にする', + contentEnableLabel: 'コンテンツモデレーションが有効', allEnabled: '入力/出力コンテンツが有効になっています', inputEnabled: '入力コンテンツが有効になっています', outputEnabled: '出力コンテンツが有効になっています', diff --git a/web/i18n/ko-KR/app-debug.ts b/web/i18n/ko-KR/app-debug.ts index 8bf509ae12..63561ddb8f 100644 --- a/web/i18n/ko-KR/app-debug.ts +++ b/web/i18n/ko-KR/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '에 OpenAI API 키가 설정되어 있어야 합니다.', }, }, - contentEnableLabel: '중간 콘텐츠 사용', + contentEnableLabel: '콘텐츠 모더레이션이 활성화됨', }, fileUpload: { title: '파일 업로드', diff --git a/web/i18n/pt-BR/app-debug.ts b/web/i18n/pt-BR/app-debug.ts index fd158acdc8..cd955fe7da 100644 --- a/web/i18n/pt-BR/app-debug.ts +++ b/web/i18n/pt-BR/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Conteúdo moderado habilitado', + contentEnableLabel: 'Moderação de conteúdo habilitada', }, fileUpload: { title: 'Upload de Arquivo', diff --git a/web/i18n/ro-RO/app-debug.ts b/web/i18n/ro-RO/app-debug.ts index d8b455e4e0..fd56179a04 100644 --- a/web/i18n/ro-RO/app-debug.ts +++ b/web/i18n/ro-RO/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Conținut moderat activat', + contentEnableLabel: 'Moderarea conținutului activată', }, fileUpload: { title: 'Încărcare fișier', diff --git a/web/i18n/ru-RU/app-debug.ts b/web/i18n/ru-RU/app-debug.ts index 0ff97c6cca..b56f7c443d 100644 --- a/web/i18n/ru-RU/app-debug.ts +++ b/web/i18n/ru-RU/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Включен модерируемый контент', + contentEnableLabel: 'Модерация контента включена', }, fileUpload: { title: 'Загрузка файлов', diff --git a/web/i18n/sl-SI/app-debug.ts b/web/i18n/sl-SI/app-debug.ts index 6e02a0d586..428a5d106c 100644 --- a/web/i18n/sl-SI/app-debug.ts +++ b/web/i18n/sl-SI/app-debug.ts @@ -197,7 +197,7 @@ const translation = { before: 'Za moderiranje OpenAI potrebujete ključ OpenAI API, konfiguriran v', }, }, - contentEnableLabel: 'Omogočena zmerna vsebina', + contentEnableLabel: 'Moderiranje vsebine omogočeno', }, debug: { title: 'Odpravljanje napak', diff --git a/web/i18n/th-TH/app-debug.ts b/web/i18n/th-TH/app-debug.ts index 303b91353a..9517fc919b 100644 --- a/web/i18n/th-TH/app-debug.ts +++ b/web/i18n/th-TH/app-debug.ts @@ -173,7 +173,7 @@ const translation = { }, title: 'การตั้งค่าการกลั่นกรองเนื้อหา', }, - contentEnableLabel: 'เปิดใช้งานเนื้อหากลั่นกรอง', + contentEnableLabel: 'การกลั่นกรองเนื้อหาเปิดใช้งานแล้ว', outputEnabled: 'ผลิตภัณฑ์', title: 'การกลั่นกรองเนื้อหา', allEnabled: 'อินพุต & เอาต์พุต', diff --git a/web/i18n/tr-TR/app-debug.ts b/web/i18n/tr-TR/app-debug.ts index 152a00e428..bec24745c0 100644 --- a/web/i18n/tr-TR/app-debug.ts +++ b/web/i18n/tr-TR/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Etkin modere içerik', + contentEnableLabel: 'İçerik denetimi etkin', }, fileUpload: { title: 'Dosya Yükleme', diff --git a/web/i18n/uk-UA/app-debug.ts b/web/i18n/uk-UA/app-debug.ts index 4a9d77b761..309aedf62e 100644 --- a/web/i18n/uk-UA/app-debug.ts +++ b/web/i18n/uk-UA/app-debug.ts @@ -202,7 +202,7 @@ const translation = { after: '', }, }, - contentEnableLabel: 'Увімкнено помірний контент', + contentEnableLabel: 'Модерація контенту увімкнена', }, fileUpload: { title: 'Завантаження файлу', diff --git a/web/i18n/zh-Hans/app-debug.ts b/web/i18n/zh-Hans/app-debug.ts index b58eedb5b3..42e1e7269b 100644 --- a/web/i18n/zh-Hans/app-debug.ts +++ b/web/i18n/zh-Hans/app-debug.ts @@ -163,7 +163,7 @@ const translation = { moderation: { title: '内容审查', description: '您可以调用审查 API 或者维护敏感词库来使模型更安全地输出。', - contentEnableLabel: '启用审查内容', + contentEnableLabel: '内容审查已启用', allEnabled: '输入内容和输出内容', inputEnabled: '输入内容', outputEnabled: '输出内容', diff --git a/web/i18n/zh-Hant/app-debug.ts b/web/i18n/zh-Hant/app-debug.ts index 5309f03da3..dc559acc37 100644 --- a/web/i18n/zh-Hant/app-debug.ts +++ b/web/i18n/zh-Hant/app-debug.ts @@ -197,7 +197,7 @@ const translation = { after: '中配置 OpenAI API 金鑰。', }, }, - contentEnableLabel: '啟用了中等內容', + contentEnableLabel: '內容審查已啟用', }, fileUpload: { title: '檔案上傳', @@ -239,7 +239,7 @@ const translation = { waitForBatchResponse: '請等待批次任務完成', notSelectModel: '請選擇模型', waitForImgUpload: '請等待圖片上傳完成', - waitForFileUpload: '請等待檔上傳', + waitForFileUpload: '請等待檔案上傳完成', }, chatSubTitle: '提示詞', completionSubTitle: '字首提示詞', From 1f15cba9a0d417fab40437a6ed64bbc43ffb0fe8 Mon Sep 17 00:00:00 2001 From: lyzno1 <92089059+lyzno1@users.noreply.github.com> Date: Wed, 6 Aug 2025 14:45:06 +0800 Subject: [PATCH 02/14] Enhance API documentation TOC with modern design and improved UX (#23490) Co-authored-by: crazywoola <427733928@qq.com> --- web/app/(commonLayout)/datasets/Doc.tsx | 116 ++++++++-- web/app/components/develop/doc.tsx | 211 ++++++++++++------ .../develop/template/template.ja.mdx | 2 +- .../develop/template/template.zh.mdx | 2 +- .../template/template_advanced_chat.en.mdx | 4 +- .../template/template_advanced_chat.ja.mdx | 4 +- .../template/template_advanced_chat.zh.mdx | 4 +- .../develop/template/template_chat.en.mdx | 4 +- .../develop/template/template_chat.ja.mdx | 4 +- .../develop/template/template_chat.zh.mdx | 4 +- web/i18n/de-DE/workflow.ts | 12 + web/i18n/es-ES/workflow.ts | 12 + web/i18n/fa-IR/workflow.ts | 12 + web/i18n/fr-FR/workflow.ts | 12 + web/i18n/hi-IN/workflow.ts | 12 + web/i18n/it-IT/workflow.ts | 12 + web/i18n/ja-JP/workflow.ts | 12 + web/i18n/ko-KR/workflow.ts | 12 + web/i18n/pl-PL/workflow.ts | 12 + web/i18n/pt-BR/workflow.ts | 12 + web/i18n/ro-RO/workflow.ts | 12 + web/i18n/ru-RU/workflow.ts | 12 + web/i18n/sl-SI/workflow.ts | 12 + web/i18n/th-TH/workflow.ts | 12 + web/i18n/tr-TR/workflow.ts | 12 + web/i18n/uk-UA/workflow.ts | 12 + web/i18n/vi-VN/workflow.ts | 12 + web/i18n/zh-Hant/workflow.ts | 12 + 28 files changed, 462 insertions(+), 109 deletions(-) diff --git a/web/app/(commonLayout)/datasets/Doc.tsx b/web/app/(commonLayout)/datasets/Doc.tsx index 78f767dbec..b31e0a4161 100644 --- a/web/app/(commonLayout)/datasets/Doc.tsx +++ b/web/app/(commonLayout)/datasets/Doc.tsx @@ -3,7 +3,7 @@ import { useEffect, useMemo, useState } from 'react' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' -import { RiListUnordered } from '@remixicon/react' +import { RiCloseLine, RiListUnordered } from '@remixicon/react' import TemplateEn from './template/template.en.mdx' import TemplateZh from './template/template.zh.mdx' import TemplateJa from './template/template.ja.mdx' @@ -22,6 +22,7 @@ const Doc = ({ apiBaseUrl }: DocProps) => { const { t } = useTranslation() const [toc, setToc] = useState>([]) const [isTocExpanded, setIsTocExpanded] = useState(false) + const [activeSection, setActiveSection] = useState('') const { theme } = useTheme() // Set initial TOC expanded state based on screen width @@ -47,12 +48,47 @@ const Doc = ({ apiBaseUrl }: DocProps) => { return null }).filter((item): item is { href: string; text: string } => item !== null) setToc(tocItems) + // Set initial active section + if (tocItems.length > 0) + setActiveSection(tocItems[0].href.replace('#', '')) } } setTimeout(extractTOC, 0) }, [locale]) + // Track scroll position for active section highlighting + useEffect(() => { + const handleScroll = () => { + const scrollContainer = document.querySelector('.scroll-container') + if (!scrollContainer || toc.length === 0) + return + + // Find active section based on scroll position + let currentSection = '' + toc.forEach((item) => { + const targetId = item.href.replace('#', '') + const element = document.getElementById(targetId) + if (element) { + const rect = element.getBoundingClientRect() + // Consider section active if its top is above the middle of viewport + if (rect.top <= window.innerHeight / 2) + currentSection = targetId + } + }) + + if (currentSection && currentSection !== activeSection) + setActiveSection(currentSection) + } + + const scrollContainer = document.querySelector('.scroll-container') + if (scrollContainer) { + scrollContainer.addEventListener('scroll', handleScroll) + handleScroll() // Initial check + return () => scrollContainer.removeEventListener('scroll', handleScroll) + } + }, [toc, activeSection]) + // Handle TOC item click const handleTocClick = (e: React.MouseEvent, item: { href: string; text: string }) => { e.preventDefault() @@ -84,40 +120,76 @@ const Doc = ({ apiBaseUrl }: DocProps) => { return (
-
+
{isTocExpanded ? ( -