Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,28 @@
> - Users must comply with OpenAI's [Terms of Use](https://openai.com/policies/terms-of-use) and **applicable laws and regulations**, and must not use it for illegal purposes.
> - According to the [《Interim Measures for the Management of Generative Artificial Intelligence Services》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm), please do not provide any unregistered generative AI services to the public in China.

<h2>🤝 Trusted Partners</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>No particular order</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target=_blank><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target=_blank><img
src="./docs/images/pku.png" alt="Peking University" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
src="./docs/images/ucloud.png" alt="UCloud" height="120"
/></a>
<a href="https://www.aliyun.com/" target=_blank><img
src="./docs/images/aliyun.png" alt="Alibaba Cloud" height="120"
/></a>
<a href="https://io.net/" target=_blank><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>

Comment on lines +43 to +64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden external links opened in new tabs

Add rel="noopener noreferrer" and quote the target attribute.

-  <a href="https://www.cherry-ai.com/" target=_blank><img
+  <a href="https://www.cherry-ai.com/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://bda.pku.edu.cn/" target=_blank><img
+  <a href="https://bda.pku.edu.cn/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
+  <a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://www.aliyun.com/" target=_blank><img
+  <a href="https://www.aliyun.com/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://io.net/" target=_blank><img
+  <a href="https://io.net/" target="_blank" rel="noopener noreferrer"><img
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h2>🤝 Trusted Partners</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>No particular order</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target=_blank><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target=_blank><img
src="./docs/images/pku.png" alt="Peking University" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
src="./docs/images/ucloud.png" alt="UCloud" height="120"
/></a>
<a href="https://www.aliyun.com/" target=_blank><img
src="./docs/images/aliyun.png" alt="Alibaba Cloud" height="120"
/></a>
<a href="https://io.net/" target=_blank><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>
<h2>🤝 Trusted Partners</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>No particular order</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/pku.png" alt="Peking University" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/ucloud.png" alt="UCloud" height="120"
/></a>
<a href="https://www.aliyun.com/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/aliyun.png" alt="Alibaba Cloud" height="120"
/></a>
<a href="https://io.net/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

56-56: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🤖 Prompt for AI Agents
In README.en.md around lines 43 to 64, the external anchor tags use unquoted
target attributes and open in new tabs without rel protections; update each <a>
tag to use target="_blank" (quoted) and add rel="noopener noreferrer" to each
external link so they are hardened against reverse tabnabbing and comply with
best practices.

## 📚 Documentation

For detailed documentation, please visit our official Wiki: [https://docs.newapi.pro/](https://docs.newapi.pro/)
Expand Down Expand Up @@ -100,7 +122,7 @@ This version supports multiple models, please refer to [API Documentation-Relay
For detailed configuration instructions, please refer to [Installation Guide-Environment Variables Configuration](https://docs.newapi.pro/installation/environment-variables):

- `GENERATE_DEFAULT_TOKEN`: Whether to generate initial tokens for newly registered users, default is `false`
- `STREAMING_TIMEOUT`: Streaming response timeout, default is 120 seconds
- `STREAMING_TIMEOUT`: Streaming response timeout, default is 300 seconds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

STREAMING_TIMEOUT default to 300s — ensure implementation matches

Mirror of the zh-CN README note: verify code/config defaults and other docs.


🏁 Script executed:

#!/bin/bash
# Same audit as in README.md; kept separate in case this file lives in a submodule/website.
set -euo pipefail
rg -nP --hidden --no-ignore 'STREAMING_TIMEOUT\s*[:=]\s*["'\'']?\d+["'\'']?' -S -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'
rg -nP --hidden --no-ignore 'STREAMING_TIMEOUT[^\\n]{0,80}120' -S -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

Length of output: 657


STREAMING_TIMEOUT default mismatch — documentation update required

The codebase defines the default STREAMING_TIMEOUT as 120 seconds (see common/init.go:104), and both the example in docker-compose.yml and .env.example comment likewise reference 120 seconds. Please update the English README (and mirror the change in the Chinese version) so that line 125 reads:

- `STREAMING_TIMEOUT`: Streaming response timeout, default is 300 seconds
+ `STREAMING_TIMEOUT`: Streaming response timeout, default is 120 seconds
🤖 Prompt for AI Agents
In README.en.md around line 125, the documented default for STREAMING_TIMEOUT is
incorrect (says 300 seconds); update that line to state the default is 120
seconds (replace "300 seconds" with "120 seconds"); also apply the same change
to the Chinese README (README.zh.md or equivalent) so both docs match the code
and examples.

- `DIFY_DEBUG`: Whether to output workflow and node information for Dify channels, default is `true`
- `FORCE_STREAM_OPTION`: Whether to override client stream_options parameter, default is `true`
- `GET_MEDIA_TOKEN`: Whether to count image tokens, default is `true`
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,28 @@
> - 使用者必须在遵循 OpenAI 的[使用条款](https://openai.com/policies/terms-of-use)以及**法律法规**的情况下使用,不得用于非法用途。
> - 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。

<h2>🤝 我们信任的合作伙伴</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>排名不分先后</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target=_blank><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target=_blank><img
src="./docs/images/pku.png" alt="北京大学" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
src="./docs/images/ucloud.png" alt="UCloud 优刻得" height="120"
/></a>
<a href="https://www.aliyun.com/" target=_blank><img
src="./docs/images/aliyun.png" alt="阿里云" height="120"
/></a>
<a href="https://io.net/" target=_blank><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>

Comment on lines +43 to +64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden external links opened in new tabs

Add rel="noopener noreferrer" and quote the target attribute to prevent reverse tabnabbing and improve HTML validity.

-  <a href="https://www.cherry-ai.com/" target=_blank><img
+  <a href="https://www.cherry-ai.com/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://bda.pku.edu.cn/" target=_blank><img
+  <a href="https://bda.pku.edu.cn/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
+  <a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://www.aliyun.com/" target=_blank><img
+  <a href="https://www.aliyun.com/" target="_blank" rel="noopener noreferrer"><img
@@
-  <a href="https://io.net/" target=_blank><img
+  <a href="https://io.net/" target="_blank" rel="noopener noreferrer"><img
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h2>🤝 我们信任的合作伙伴</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>排名不分先后</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target=_blank><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target=_blank><img
src="./docs/images/pku.png" alt="北京大学" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target=_blank><img
src="./docs/images/ucloud.png" alt="UCloud 优刻得" height="120"
/></a>
<a href="https://www.aliyun.com/" target=_blank><img
src="./docs/images/aliyun.png" alt="阿里云" height="120"
/></a>
<a href="https://io.net/" target=_blank><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>
<h2>🤝 我们信任的合作伙伴</h2>
<p id="premium-sponsors">&nbsp;</p>
<p align="center"><strong>排名不分先后</strong></p>
<p align="center">
<a href="https://www.cherry-ai.com/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/cherry-studio.png" alt="Cherry Studio" height="120"
/></a>
<a href="https://bda.pku.edu.cn/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/pku.png" alt="北京大学" height="120"
/></a>
<a href="https://www.compshare.cn/?ytag=GPU_yy_gh_newapi" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/ucloud.png" alt="UCloud 优刻得" height="120"
/></a>
<a href="https://www.aliyun.com/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/aliyun.png" alt="阿里云" height="120"
/></a>
<a href="https://io.net/" target="_blank" rel="noopener noreferrer"><img
src="./docs/images/io-net.png" alt="IO.NET" height="120"
/></a>
</p>
<p>&nbsp;</p>
🤖 Prompt for AI Agents
In README.md around lines 43 to 64, the anchor tags open external links in new
tabs using unquoted target attributes and lack rel protections; update each <a>
tag in this block to quote the target attribute (target="_blank") and add
rel="noopener noreferrer" to prevent reverse tabnabbing and satisfy HTML
validity; ensure all anchors in the shown partner/logo section are updated
consistently.

## 📚 文档

详细文档请访问我们的官方Wiki:[https://docs.newapi.pro/](https://docs.newapi.pro/)
Expand Down Expand Up @@ -100,7 +122,7 @@ New API提供了丰富的功能,详细特性请参考[特性说明](https://do
详细配置说明请参考[安装指南-环境变量配置](https://docs.newapi.pro/installation/environment-variables):

- `GENERATE_DEFAULT_TOKEN`:是否为新注册用户生成初始令牌,默认为 `false`
- `STREAMING_TIMEOUT`:流式回复超时时间,默认120秒
- `STREAMING_TIMEOUT`:流式回复超时时间,默认300秒

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

STREAMING_TIMEOUT default changed to 300s — verify implementation and other docs

Nice doc update. Please confirm the actual default in code/config matches 300s (env loaders, Helm charts, Docker examples, .env templates). If not, either update code or revert docs.


🏁 Script executed:

#!/bin/bash
# Verify STREAMING_TIMEOUT defaults and docs consistency.

set -euo pipefail

echo "Search occurrences of STREAMING_TIMEOUT with numeric defaults:"
rg -nP --hidden --no-ignore 'STREAMING_TIMEOUT\s*[:=]\s*["'\'']?\d+["'\'']?' -S -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

echo
echo "Check for any lingering 120-second mentions tied to STREAMING_TIMEOUT:"
rg -nP --hidden --no-ignore 'STREAMING_TIMEOUT[^\\n]{0,80}120' -S -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

echo
echo "Common config files that might carry defaults:"
fd -H -t f -i '(.env|.env.example|docker-compose.*|values.*\.ya?ml|Chart\.ya?ml|kustomization\.ya?ml|config\.(ya?ml|json)|settings\.(ya?ml|json))' \
  -E node_modules -E dist -E build | sed -n '1,200p'

echo
echo "Show lines around STREAMING_TIMEOUT in config-like files:"
fd -H -t f -i '(.env|.env.example|docker-compose.*|values.*\.ya?ml|Chart\.ya?ml|kustomization\.ya?ml|config\.(ya?ml|json)|settings\.(ya?ml|json))' \
  -E node_modules -E dist -E build \
  | xargs -r rg -nP 'STREAMING_TIMEOUT.*' -S -n -C2

Length of output: 2282


Mismatch between documented and actual STREAMING_TIMEOUT default

The documentation now states a 300-second default, but the code and example configurations still use 120 seconds. Please align them by updating the implementation and examples (or revert the docs if 120s is intended).

Files requiring updates:

  • common/init.go (around line 104):
    - constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 120)
    + constant.StreamingTimeout = GetEnvOrDefault("STREAMING_TIMEOUT", 300)
  • .env.example (line 50):
    - # STREAMING_TIMEOUT=120
    + # STREAMING_TIMEOUT=300
  • docker-compose.yml (line 19):
    - #      - STREAMING_TIMEOUT=120  # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值
    + #      - STREAMING_TIMEOUT=300  # 流模式无响应超时时间,单位秒,默认300秒,如果出现空补全可以尝试改为更大值
🤖 Prompt for AI Agents
In README.md line 125 and in the codebase (common/init.go around line 104,
.env.example line 50, docker-compose.yml line 19) the documented
STREAMING_TIMEOUT (300s) mismatches actual defaults (120s); align them by
updating the implementation and examples to 300s: change the default/constant in
common/init.go to 300 (or read from env with fallback 300), set
STREAMING_TIMEOUT=300 in .env.example, and set the environment variable value to
300 in docker-compose.yml; also search the repo for other STREAMING_TIMEOUT
occurrences and update any remaining examples or defaults to 300 (or revert
README to 120 if 120s is the intended value).

- `DIFY_DEBUG`:Dify渠道是否输出工作流和节点信息,默认 `true`
- `FORCE_STREAM_OPTION`:是否覆盖客户端stream_options参数,默认 `true`
- `GET_MEDIA_TOKEN`:是否统计图片token,默认 `true`
Expand Down
8 changes: 5 additions & 3 deletions docs/api/web_api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# One API – Web 界面后端接口文档
# New API – Web 界面后端接口文档

> 本文档汇总了 **One API** 后端提供给前端 Web 界面的全部 REST 接口(不含 *Relay* 相关接口)。
> 本文档汇总了 **New API** 后端提供给前端 Web 界面的全部 REST 接口(不含 *Relay* 相关接口)。
>
> 接口前缀统一为 `https://<your-domain>`,以下仅列出 **路径**、**HTTP 方法**、**鉴权要求** 与 **功能简介**。
>
Expand Down Expand Up @@ -62,6 +62,8 @@
| GET | /api/user/groups | 公开 | 列出所有分组(无鉴权版) |

### 5.2 用户自身操作 (需登录)
| 方法 | 路径 | 鉴权 | 说明 |
|------|------|------|------|
| GET | /api/user/self/groups | 用户 | 获取自己所在分组 |
| GET | /api/user/self | 用户 | 获取个人资料 |
| GET | /api/user/models | 用户 | 获取模型可见性 |
Expand Down Expand Up @@ -192,4 +194,4 @@

---

> **更新日期**:2025.07.17
> **更新日期**:2025.07.17
Binary file added docs/images/aliyun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/cherry-studio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/io-net.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pku.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ucloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading