diff --git a/.env.example b/.env.example index 6c623a696fda2f68baacb31cd6f508ed1aa6836e..509627e0cb9fed6d931343b09eb03f06e1991187 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ # 生产环境 DOCS_CDN_PREFIX=https://ai-assets.gitee.com/docs +DOCS_API_URL=https://ai.gitee.com DOCS_SITE_URL=https://ai.gitee.com # 开发环境 #DOCS_CDN_PREFIX=/docs -#DOCS_SITE_URL=https://ai.gitee.com \ No newline at end of file +#DOCS_SITE_URL=https://ai.gitee.com +#DOCS_API_URL=https://ai.gitee.com \ No newline at end of file diff --git a/docs/appstore/intro.md b/docs/appstore/intro.md index dab8d7bccbee5455673fdea04c537de9da28f9d5..ec3c1d117c688af5d50305e0b6c735a5adb79c80 100644 --- a/docs/appstore/intro.md +++ b/docs/appstore/intro.md @@ -79,7 +79,11 @@ AI 应用市场提供了简单易用的 API,帮助开发者快速将应用集 ```python showLineNumbers title="Python" import requests +<<<<<<< HEAD +requests.get("{{API_URL}}/v1/app", +======= requests.get("{{SITE_URL}}/v1/app", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers={ "Authorization": "Bearer YOUR_APP_TOKEN_HERE" # 如果是公开的 APP 就不需要设置 Authorization }, @@ -108,7 +112,11 @@ requests.get("{{SITE_URL}}/v1/app", #### 获取验证码 ```python showLineNumbers title="Python" +<<<<<<< HEAD +requests.post("{{API_URL}}/v1/app/auth/vcode", +======= requests.post("{{SITE_URL}}/v1/app/auth/vcode", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers={ "Authorization": "Bearer YOUR_APP_TOKEN_HERE", "Content-Type": "application/json" @@ -125,7 +133,11 @@ requests.post("{{SITE_URL}}/v1/app/auth/vcode", #### 获取用户子令牌(相当于用户的身份认证) ```python showLineNumbers title="Python" +<<<<<<< HEAD +requests.post("{{API_URL}}/v1/app/auth/token", +======= requests.post("{{SITE_URL}}/v1/app/auth/token", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers={ "Authorization": "Bearer YOUR_APP_TOKEN_HERE", "Content-Type": "application/json" @@ -147,7 +159,11 @@ requests.post("{{SITE_URL}}/v1/app/auth/token", 在使用计费 API 之前需要先 [设置收费策略](./price) 。目前应用市场支持支付宝和微信两种支付形式,使用计费 API 的示例代码如下: ```python showLineNumbers title="Python" +<<<<<<< HEAD +requests.post("{{API_URL}}/v1/app/pay", +======= requests.post("{{SITE_URL}}/v1/app/pay", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers={ "Authorization": "Bearer APP_USER_TOKEN_HERE", # 这里的 APP_USER_TOKEN_HERE 是用户的子令牌 "Content-Type": "application/json" diff --git a/docs/getting-started.md b/docs/getting-started.md index b330db6310f80ca6231f9e32eb42ff9d5f3975bb..47e4da1388cb9b2a7b9db15e24a439aa9a7c30d1 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -46,7 +46,7 @@ hide_table_of_contents: true ```python showLineNumbers title="python" import requests -url = "{{SITE_URL}}/v1/chat/completions" +url = "{{API_URL}}/v1/chat/completions" headers = { "Authorization": "Bearer ", "Content-Type": "application/json" diff --git a/docs/integrations/Development-Tools/claude-code.md b/docs/integrations/Development-Tools/claude-code.md index ed248f514c6eec30fb7f98297c368f2bbef0eaa6..ff83488f6895609b6537520832e93f177d2b788a 100644 --- a/docs/integrations/Development-Tools/claude-code.md +++ b/docs/integrations/Development-Tools/claude-code.md @@ -39,7 +39,11 @@ Serverless API 支持在 Claude Code 中调用,使用步骤如下: "Providers": [ { "name": "gitee", +<<<<<<< HEAD + "api_base_url": "{{API_URL}}/v1/chat/completions", +======= "api_base_url": "{{SITE_URL}}/v1/chat/completions", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 "api_key": "your-api-key", "models": ["kimi-k2-instruct"], "transformer": { diff --git a/docs/integrations/intro.md b/docs/integrations/intro.md index 7bdfba09ad80e9435a9a65e53faf84f3373c702e..4a48fdbd8bb16ebe026814b5a5bd88c2ade9f3f8 100644 --- a/docs/integrations/intro.md +++ b/docs/integrations/intro.md @@ -38,7 +38,7 @@ sidebar_position: 1 请在 Serverless API 页选择您想要使用的模型,点击调用,获取它的 API 调用地址,如下所示: ``` -{{SITE_URL}}/v1/chat/completions +{{API_URL}}/v1/chat/completions ``` ![alt text](/img/serverless-api/integrated/integrate1.png) diff --git a/docs/integrations/mcp.md b/docs/integrations/mcp.md index 88dfaf12e3f36ea9bafb3539e51f015e401cb6fd..77f2a06d009053065b2b901283bf5bcea2fce537 100644 --- a/docs/integrations/mcp.md +++ b/docs/integrations/mcp.md @@ -46,7 +46,7 @@ import TabItem from '@theme/TabItem'; { "mcpServers": { "gitee-ai": { - "url": "{{SITE_URL}}/mcp/sse", + "url": "{{API_URL}}/mcp/sse", "headers": { "Authorization": "Bearer " } @@ -68,7 +68,7 @@ import TabItem from '@theme/TabItem'; { "mcpServers": { "gitee-ai": { - "url": "{{SITE_URL}}/mcp/sse", + "url": "{{API_URL}}/mcp/sse", "headers": { "Authorization": "Bearer " } @@ -89,7 +89,7 @@ import TabItem from '@theme/TabItem'; { "mcpServers": { "gitee-ai": { - "url": "{{SITE_URL}}/mcp/sse", + "url": "{{API_URL}}/mcp/sse", "headers": { "Authorization": "Bearer " } diff --git a/docs/products/apis/3d/index.md b/docs/products/apis/3d/index.md index a899a7b11012c6d3bddb884182bf06a988fa8643..2710ebddb7d12d63c31aa69569f0f73fc0175364 100644 --- a/docs/products/apis/3d/index.md +++ b/docs/products/apis/3d/index.md @@ -45,7 +45,7 @@ import webbrowser import contextlib import mimetypes -API_URL = "{{SITE_URL}}/v1/async/image-to-3d" +API_URL = "{{API_URL}}/v1/async/image-to-3d" API_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" headers = { "Authorization": f"Bearer {API_TOKEN}" @@ -77,7 +77,7 @@ def query(payload): return response.json() def poll_task(task_id): - status_url = f"{{SITE_URL}}/v1/task/{task_id}" + status_url = f"{{API_URL}}/v1/task/{task_id}" timeout = 30 * 60 retry_interval = 10 attempts = 0 diff --git a/docs/products/apis/async-task.md b/docs/products/apis/async-task.md index f391301deb518741b2aa68ce2caa0f9a66ea0128..deece0fd9be3f87f1bcb560b66a62d34a754d883 100644 --- a/docs/products/apis/async-task.md +++ b/docs/products/apis/async-task.md @@ -37,7 +37,11 @@ from PIL import Image from io import BytesIO from requests_toolbelt.multipart.encoder import MultipartEncoder +<<<<<<< HEAD +API_URL = "{{API_URL}}/v1/async/music/generations" +======= API_URL = "{{SITE_URL}}/v1/async/music/generations" +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers = { "Authorization": "Bearer ", } diff --git a/docs/products/apis/documents/ocr.md b/docs/products/apis/documents/ocr.md index 80c1ce834e6ac2ae85cc707187e2eed536e98a76..6b8c2735e41e4d37dfd652f775ab482518b7afe0 100644 --- a/docs/products/apis/documents/ocr.md +++ b/docs/products/apis/documents/ocr.md @@ -23,7 +23,7 @@ GOT-OCR2_0 提供功能强大的 OCR 解决方案,能够高精度、快速、 ```bash showLineNumbers - curl {{SITE_URL}}/v1/images/ocr \ + curl {{API_URL}}/v1/images/ocr \ -X POST \ -H "Authorization: Bearer 私人令牌" \ -F "model=GOT-OCR2_0" @@ -34,7 +34,7 @@ GOT-OCR2_0 提供功能强大的 OCR 解决方案,能够高精度、快速、 ```python showLineNumbers title="python" import requests - API_URL = "{{SITE_URL}}/v1/images/ocr" + API_URL = "{{API_URL}}/v1/images/ocr" HEADERS = { "Authorization": "Bearer 私人令牌", } diff --git a/docs/products/apis/documents/pdf.md b/docs/products/apis/documents/pdf.md index bfd09f33b1e7d6cb005f94eb3959ccd565e4f4b7..6edce4d6b7126b3fe057e2bbadb8feaeaad822eb 100644 --- a/docs/products/apis/documents/pdf.md +++ b/docs/products/apis/documents/pdf.md @@ -36,7 +36,7 @@ PDF-Extract-Kit 专为从各类复杂 PDF 文档中高效提取高质量内容 您可以点击 [PDF-Extract-Kit]({{SITE_URL}}/serverless-api?model=PDF-Extract-Kit-1.0) 在线免费体验。以下是代码调用示例。 ```bash showLineNumbers - curl {{SITE_URL}}/v1/async/documents/parse \ + curl {{API_URL}}/v1/async/documents/parse \ -X POST \ -H "Authorization: Bearer 您的访问令牌" \ -F "model=PDF-Extract-Kit-1.0" \ @@ -76,8 +76,8 @@ PDF-Extract-Kit 专为从各类复杂 PDF 文档中高效提取高质量内容 "status": "waiting", "created_at": 1742885184998, "urls": { - "get": "{{SITE_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B", - "cancel": "{{SITE_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/cancel" + "get": "{{API_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B", + "cancel": "{{API_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/cancel" } } ``` @@ -85,7 +85,7 @@ PDF-Extract-Kit 专为从各类复杂 PDF 文档中高效提取高质量内容 再根据 task_id 获取最终执行结果: ```bash showLineNumbers -curl {{SITE_URL}}/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/ +curl {{API_URL}}/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/ --header 'Authorization: Bearer 您的访问令牌' ``` @@ -109,8 +109,8 @@ curl {{SITE_URL}}/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/ "started_at": 1742885188000, "completed_at": 1742885190000, "urls": { - "get": "{{SITE_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B", - "cancel": "{{SITE_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/cancel" + "get": "{{API_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B", + "cancel": "{{API_URL}}/api/v1/task/AAC2KETEYJVKER04U6RNMHJTOGLVEG1B/cancel" } } ``` diff --git a/docs/products/apis/embeddings/index.md b/docs/products/apis/embeddings/index.md index a53ffae25bbc00c52d0856fa34f1f939a24a112a..4ee60d53dc53ec6d64569bb0a777519bbf2d1fbd 100644 --- a/docs/products/apis/embeddings/index.md +++ b/docs/products/apis/embeddings/index.md @@ -28,7 +28,7 @@ import ServerlessAPIServices from '@site/src/components/ServerlessAPIServices'; from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的令牌 default_headers={"X-Failover-Enabled":"true"}, ) @@ -55,7 +55,7 @@ response = client.embeddings.create( from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的令牌 ) @@ -80,7 +80,7 @@ response = client.embeddings.create( ```python showLineNumbers title="python" import requests -API_URL = "{{SITE_URL}}/v1/rerank" +API_URL = "{{API_URL}}/v1/rerank" API_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # 替换为您的令牌 headers = { "X-Failover-Enabled": "true", diff --git a/docs/products/apis/images-vision/controlnet.md b/docs/products/apis/images-vision/controlnet.md index a7e733a70fcee6ff448318ad72b49be9e485ad78..e7fcad82c5443e794b64cfffc50dd4defd82a7e5 100644 --- a/docs/products/apis/images-vision/controlnet.md +++ b/docs/products/apis/images-vision/controlnet.md @@ -48,7 +48,11 @@ import base64 import requests client = OpenAI( +<<<<<<< HEAD + base_url="{{API_URL}}/v1", +======= base_url="{{SITE_URL}}/v1", +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ) @@ -96,7 +100,7 @@ import requests import base64 import json -url = "{{SITE_URL}}/v1/images/generations" +url = "{{API_URL}}/v1/images/generations" headers = { "Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的 API Key diff --git a/docs/products/apis/images-vision/faceid.md b/docs/products/apis/images-vision/faceid.md index 73dfee8c0e8f4646ac3f0fa275f084091367958d..386b949a60381b8fab829597a4916592c102904e 100644 --- a/docs/products/apis/images-vision/faceid.md +++ b/docs/products/apis/images-vision/faceid.md @@ -26,7 +26,7 @@ import base64 from PIL import Image from io import BytesIO -API_URL = "{{SITE_URL}}/v1/images/face-migration" +API_URL = "{{API_URL}}/v1/images/face-migration" headers = { "Authorization": "Bearer " } @@ -109,7 +109,11 @@ import base64 from PIL import Image from io import BytesIO +<<<<<<< HEAD +API_URL = "{{API_URL}}/v1/images/face-migration" +======= API_URL = "{{SITE_URL}}/v1/images/face-migration" +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers = { "Authorization": "Bearer " } diff --git a/docs/products/apis/images-vision/fuzzy.md b/docs/products/apis/images-vision/fuzzy.md index c06f46dc0dc49530bbf42ed53b441caea125c037..63db8ebfb182d1e48e42c187f46a1cb50abc1e01 100644 --- a/docs/products/apis/images-vision/fuzzy.md +++ b/docs/products/apis/images-vision/fuzzy.md @@ -77,7 +77,11 @@ from PIL import Image from io import BytesIO from requests_toolbelt import MultipartEncoder +<<<<<<< HEAD +API_URL = "{{API_URL}}/v1/images/style-migration" +======= API_URL = "{{SITE_URL}}/v1/images/style-migration" +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers = { "Authorization": "Bearer ", } diff --git a/docs/products/apis/images-vision/lora.md b/docs/products/apis/images-vision/lora.md index 09f6af1392af187d9e537bfa10f125cc327858f0..dfd5230e870c49af11e27bd392684c23e1f66be3 100644 --- a/docs/products/apis/images-vision/lora.md +++ b/docs/products/apis/images-vision/lora.md @@ -46,7 +46,7 @@ import base64 import requests client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的 API Key ) @@ -96,7 +96,7 @@ import requests import base64 import json -url = "{{SITE_URL}}/v1/images/generations" +url = "{{API_URL}}/v1/images/generations" headers = { "Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的 API Key diff --git a/docs/products/apis/images-vision/object-detection.md b/docs/products/apis/images-vision/object-detection.md index 84e1666ef8fa236df3c526a34c3326555371293b..9feb7a1425d2adfa8c5c6708c136c1e924f24528 100644 --- a/docs/products/apis/images-vision/object-detection.md +++ b/docs/products/apis/images-vision/object-detection.md @@ -28,9 +28,9 @@ headers = { } #用于请求图像描述的url -url_caption = "{{SITE_URL}}/v1/images/caption" +url_caption = "{{API_URL}}/v1/images/caption" #用于请求目标识别的url -url_object_detection = "{{SITE_URL}}/v1/images/object-detection" +url_object_detection = "{{API_URL}}/v1/images/object-detection" def query(url, payload): files = { diff --git a/docs/products/apis/images-vision/text2image.md b/docs/products/apis/images-vision/text2image.md index ce7e3ff315363bbbf8d2dda3a11ed508b441ad90..c02f5a37052c60fe438dd41d72d671634695ccb3 100644 --- a/docs/products/apis/images-vision/text2image.md +++ b/docs/products/apis/images-vision/text2image.md @@ -33,7 +33,7 @@ from openai import OpenAI import base64 client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的 API Key default_headers={"X-Failover-Enabled":"true"}, ) @@ -65,7 +65,7 @@ import requests import base64 import json -url = "{{SITE_URL}}/v1/images/generations" +url = "{{API_URL}}/v1/images/generations" headers = { "Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的 API Key diff --git a/docs/products/apis/images-vision/visions.md b/docs/products/apis/images-vision/visions.md index 7876b94d8bac62aac8ea2e13c8b38823b2998e26..32d78d3d06b6b419b16f7531e39340b41bccd615 100644 --- a/docs/products/apis/images-vision/visions.md +++ b/docs/products/apis/images-vision/visions.md @@ -28,7 +28,7 @@ import ServerlessAPIServices from '@site/src/components/ServerlessAPIServices'; from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 替换为您的访问令牌 ) diff --git a/docs/products/apis/moderations/index.md b/docs/products/apis/moderations/index.md index 1bf30d3c1e13d8e3844de198c7ea09a5d84e7fb7..31d34a576fcb5e7e620ed19d0652035a2fe90318 100644 --- a/docs/products/apis/moderations/index.md +++ b/docs/products/apis/moderations/index.md @@ -26,7 +26,7 @@ Security-semantic-filtering 是一种用于增强系统安全性的技术,通 from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 请替换为您的令牌 ) @@ -47,7 +47,7 @@ response = client.moderations.create( from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 请替换为您的令牌 ) diff --git a/docs/products/apis/speeches/speech-recognition.md b/docs/products/apis/speeches/speech-recognition.md index 1af4e2a08013782936829ff2dd678e7462897998..c9b8a02a3fffd945edc3c560daf844768777a27f 100644 --- a/docs/products/apis/speeches/speech-recognition.md +++ b/docs/products/apis/speeches/speech-recognition.md @@ -33,7 +33,7 @@ import requests from requests_toolbelt import MultipartEncoder import os -API_URL = "{{SITE_URL}}/v1/audio/transcriptions" +API_URL = "{{API_URL}}/v1/audio/transcriptions" API_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # 请替换为您的令牌 headers = { "Authorization": f"Bearer {API_TOKEN}" diff --git a/docs/products/apis/speeches/text-to-speech.md b/docs/products/apis/speeches/text-to-speech.md index 5d3020bfaa311af137966e11742c4343548f75c6..85b020b0a29a134f38327d6f3702ff04d0a5720b 100644 --- a/docs/products/apis/speeches/text-to-speech.md +++ b/docs/products/apis/speeches/text-to-speech.md @@ -38,7 +38,7 @@ import ServerlessAPIServices from '@site/src/components/ServerlessAPIServices'; from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # 请替换为您的令牌 ) diff --git a/docs/products/apis/speeches/voiceprint.md b/docs/products/apis/speeches/voiceprint.md index 589542f8fcbe67a2ec2c93a7c36bac66c0657c1b..1acc00b91a84546086d4637ccc1d08de9e8d4747 100644 --- a/docs/products/apis/speeches/voiceprint.md +++ b/docs/products/apis/speeches/voiceprint.md @@ -73,7 +73,7 @@ sidebar_position: 3 HTTPS 调用 ``` -POST {{SITE_URL}}/v1/audio/voice-feature-extraction +POST {{API_URL}}/v1/audio/voice-feature-extraction ``` **请求参数** @@ -93,7 +93,7 @@ HTTP 状态码为 200 时,表示成功。返回文件二进制流。 ``` cURL ---location --request POST '{{SITE_URL}}/vi/audio/voice-feature-extraction' +--location --request POST '{{API_URL}}/vi/audio/voice-feature-extraction' --header 'Authorization: Bearer 输入您的访问令牌 ' --form 'model="CosyVoice-300M"' --form 'file=@"上传.mp3 或.m4a格式的文件"' diff --git a/docs/products/apis/texts/function-calling.md b/docs/products/apis/texts/function-calling.md index 23ad8caa703504b7f730ab98fe2181153856a9c7..6b421b54a298ff1a305f933a0b67d416f1a7035a 100644 --- a/docs/products/apis/texts/function-calling.md +++ b/docs/products/apis/texts/function-calling.md @@ -186,7 +186,7 @@ tools_list = [get_news, python_code_exec] model_name = "Qwen2.5-72B-Instruct" -base_url = "{{SITE_URL}}/v1" +base_url = "{{API_URL}}/v1" # {{SITE_URL}}/dashboard/settings/tokens 获取您的访问令牌 GITEE_AI_API_KEY = "" diff --git a/docs/products/apis/texts/json-output.md b/docs/products/apis/texts/json-output.md index 03989ca77c33e21018b41293ad55003853cc4314..4d96e75aebccc3c83eb8d7a174a701df2c6a1ab1 100644 --- a/docs/products/apis/texts/json-output.md +++ b/docs/products/apis/texts/json-output.md @@ -50,7 +50,7 @@ JSON 是世界上应用最广泛的数据交换格式之一。而符合 [JSON Sc from langchain_openai import ChatOpenAI model_name = "Qwen2.5-72B-Instruct" -base_url = "{{SITE_URL}}/v1" +base_url = "{{API_URL}}/v1" # {{SITE_URL}}/dashboard/settings/tokens 获取您的访问令牌 GITEE_AI_API_KEY = "" llm = ChatOpenAI(model=model_name, api_key=GITEE_AI_API_KEY, base_url=base_url, streaming=True, temperature=0.1, diff --git a/docs/products/apis/texts/lang-style.md b/docs/products/apis/texts/lang-style.md index 2ee741654d2d0329d95efe5047704eb9c1a48259..fbcebb1b83cc8ca35d11e12255102833f1468ec9 100644 --- a/docs/products/apis/texts/lang-style.md +++ b/docs/products/apis/texts/lang-style.md @@ -17,7 +17,7 @@ sidebar_position: 4 ```python showLineNumbers title="python" from openai import OpenAI import json -base_url = "{{SITE_URL}}/v1" +base_url = "{{API_URL}}/v1" model_name = "Qwen2.5-72B-Instruct" # {{SITE_URL}}/dashboard/settings/tokens 获取您的访问令牌 client = OpenAI(base_url=base_url, api_key="访问令牌") diff --git a/docs/products/apis/texts/text-comlpetion.md b/docs/products/apis/texts/text-comlpetion.md index 61f162e0a495e6d8370ccc4f947ae581dbc3aeff..bcdeb46caec9c9c9706c66307518bbe23b63c2bf 100644 --- a/docs/products/apis/texts/text-comlpetion.md +++ b/docs/products/apis/texts/text-comlpetion.md @@ -27,7 +27,7 @@ import TabItem from '@theme/TabItem'; 使用 `curl` 可清晰了解文本补全请求的路径、参数的原始情况: ```bash showLineNumbers -curl {{SITE_URL}}/v1/completions \ +curl {{API_URL}}/v1/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer 您的访问令牌" \ -d '{ @@ -79,7 +79,7 @@ pip install openai -i https://mirrors.cloud.tencent.com/pypi/simple from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) @@ -98,7 +98,7 @@ print(response.choices[0].text) from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) @@ -155,7 +155,7 @@ for chunk in stream: from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) @@ -176,7 +176,7 @@ client.completions.create( from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) @@ -214,7 +214,7 @@ prompt = """ from openai import OpenAI client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) diff --git a/docs/products/apis/texts/text-generation.md b/docs/products/apis/texts/text-generation.md index d808821bba721be2b63029bc99d5186e6f09dc29..64ef544fe7b2b0b74ed1ea96fad1f649aceb639b 100644 --- a/docs/products/apis/texts/text-generation.md +++ b/docs/products/apis/texts/text-generation.md @@ -29,7 +29,7 @@ import TabItem from '@theme/TabItem'; ```shell showLineNumbers - curl {{SITE_URL}}/v1/chat/completions \ + curl {{API_URL}}/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer 您的访问令牌" \ -d '{ @@ -51,7 +51,11 @@ import TabItem from '@theme/TabItem'; ```javascript showLineNumbers async function query(data) { +<<<<<<< HEAD + const response = await fetch('{{API_URL}}/v1/chat/completions', { +======= const response = await fetch('{{SITE_URL}}/v1/chat/completions', { +>>>>>>> 32c1cb910d3d468001c919a06610657fa0662005 headers: { Authorization: 'Bearer xxxxx', 'Content-Type': 'application/json', @@ -135,7 +139,7 @@ pip install openai -i https://mirrors.cloud.tencent.com/pypi/simple from openai import OpenAI import json -base_url = "{{SITE_URL}}/v1" +base_url = "{{API_URL}}/v1" model_name = "Qwen2.5-72B-Instruct" @@ -171,7 +175,7 @@ from openai import OpenAI # 初始化客户端 client = OpenAI( - base_url="{{SITE_URL}}/v1", + base_url="{{API_URL}}/v1", api_key="您的访问令牌" ) @@ -252,7 +256,7 @@ for chunk in stream: ```javascript showLineNumbers title="javascript" import OpenAI from 'openai'; const client = new OpenAI({ - baseURL: '{{SITE_URL}}/v1', + baseURL: '{{API_URL}}/v1', apiKey: '您的模力方舟API密钥', }); diff --git a/docs/products/apis/videos/index.md b/docs/products/apis/videos/index.md index e87193071501c545cdc37180f6f6b8eed0f735f4..321b9cf96d43ddf2b42079ae077356fd00899cfe 100644 --- a/docs/products/apis/videos/index.md +++ b/docs/products/apis/videos/index.md @@ -28,7 +28,7 @@ import time import json import webbrowser -API_URL = "{{SITE_URL}}/v1/async/videos/generations" +API_URL = "{{API_URL}}/v1/async/videos/generations" API_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # 请替换为您的令牌 headers = { "Authorization": f"Bearer {API_TOKEN}" @@ -39,7 +39,7 @@ def query(payload): return response.json() def poll_task(task_id): - status_url = f"{{SITE_URL}}/v1/task/{task_id}" + status_url = f"{{API_URL}}/v1/task/{task_id}" timeout = 30 * 60 retry_interval = 10 attempts = 0 diff --git a/src/plugins/simple-env-replacement-plugin.js b/src/plugins/simple-env-replacement-plugin.js index a378d68ad996c6824d49b92ef21d2bc5ce9bcd24..a194e3ca118f117f21945c04e78d473dad98144c 100644 --- a/src/plugins/simple-env-replacement-plugin.js +++ b/src/plugins/simple-env-replacement-plugin.js @@ -2,6 +2,7 @@ // 这个插件会在构建时直接替换 Markdown 中的占位符 const path = require('path'); +const { AiFillPicture } = require('react-icons/ai'); function simpleEnvReplacementPlugin(context, options) { return { @@ -20,6 +21,7 @@ function simpleEnvReplacementPlugin(context, options) { replacements: { // 基础配置 SITE_URL: process.env.DOCS_SITE_URL, + API_URL: process.env.DOCS_API_URL, }, }, },