Skip to content

Commit

Permalink
deploy: 58fbf78
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Dec 23, 2024
1 parent a43012b commit 73dc3ce
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 203 deletions.
20 changes: 10 additions & 10 deletions docs/development/docker/index.html

Large diffs are not rendered by default.

150 changes: 75 additions & 75 deletions docs/development/openapi/chat/index.html

Large diffs are not rendered by default.

170 changes: 85 additions & 85 deletions docs/development/openapi/dataset/index.html

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions docs/development/openapi/share/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,43 @@
"uid": "用户唯一凭证"
}
}</code>
</pre></div><p><code>FastGPT</code> 将会判断<code>success</code>是否为<code>true</code>决定是允许用户继续操作。<code>message</code><code>msg</code>是等同的,你可以选择返回其中一个,当<code>success</code>不为<code>true</code>时,将会提示这个错误。</p><p><code>uid</code>是用户的唯一凭证,将会用于拉取对话记录以及保存对话记录。可参考下方实践案例。</p><h3 id=触发流程>触发流程 <a href=#%e8%a7%a6%e5%8f%91%e6%b5%81%e7%a8%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/sharelink_process.png alt loading=lazy class=medium-zoom-image></p><h2 id=配置教程>配置教程 <a href=#%e9%85%8d%e7%bd%ae%e6%95%99%e7%a8%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><h3 id=1-配置身份校验地址>1. 配置身份校验地址 <a href=#1-%e9%85%8d%e7%bd%ae%e8%ba%ab%e4%bb%bd%e6%a0%a1%e9%aa%8c%e5%9c%b0%e5%9d%80 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/share-setlink.png alt loading=lazy class=medium-zoom-image></p><p>配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。</p><div class="alert alert-default d-flex" role=alert><div class="flex-shrink-1 alert-icon"><p>🤖</p></div><div class=w-100><p>这里仅需配置根地址,无需具体到完整请求路径。</p></div></div><h3 id=2-分享链接中增加额外-query>2. 分享链接中增加额外 query <a href=#2-%e5%88%86%e4%ba%ab%e9%93%be%e6%8e%a5%e4%b8%ad%e5%a2%9e%e5%8a%a0%e9%a2%9d%e5%a4%96-query class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>在分享链接的地址中,增加一个额外的参数: authToken。例如:</p><p>原始的链接:<code>https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192</code></p><p>完整链接: <code>https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192&amp;authToken=userid12345</code></p><p>这个<code>authToken</code>通常是你系统生成的用户唯一凭证(Token之类的)。FastGPT 会在鉴权接口的<code>body</code>中携带 token={{authToken}} 的参数。</p><h3 id=3-编写聊天初始化校验接口>3. 编写聊天初始化校验接口 <a href=#3-%e7%bc%96%e5%86%99%e8%81%8a%e5%a4%a9%e5%88%9d%e5%a7%8b%e5%8c%96%e6%a0%a1%e9%aa%8c%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=bceadfTab data-bs-toggle=tab data-bs-target=#bceadf type=button role=tab aria-controls=bceadf aria-selected=true>请求示例</a>
<a class=nav-link id=dcebafTab data-bs-toggle=tab data-bs-target=#dcebaf type=button role=tab aria-controls=dcebaf aria-selected=true>鉴权成功</a>
<a class=nav-link id=bdcafeTab data-bs-toggle=tab data-bs-target=#bdcafe type=button role=tab aria-controls=bdcafe aria-selected=true>鉴权失败</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=bceadf role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=39d214b class=language-bash>
</pre></div><p><code>FastGPT</code> 将会判断<code>success</code>是否为<code>true</code>决定是允许用户继续操作。<code>message</code><code>msg</code>是等同的,你可以选择返回其中一个,当<code>success</code>不为<code>true</code>时,将会提示这个错误。</p><p><code>uid</code>是用户的唯一凭证,将会用于拉取对话记录以及保存对话记录。可参考下方实践案例。</p><h3 id=触发流程>触发流程 <a href=#%e8%a7%a6%e5%8f%91%e6%b5%81%e7%a8%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/sharelink_process.png alt loading=lazy class=medium-zoom-image></p><h2 id=配置教程>配置教程 <a href=#%e9%85%8d%e7%bd%ae%e6%95%99%e7%a8%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><h3 id=1-配置身份校验地址>1. 配置身份校验地址 <a href=#1-%e9%85%8d%e7%bd%ae%e8%ba%ab%e4%bb%bd%e6%a0%a1%e9%aa%8c%e5%9c%b0%e5%9d%80 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/share-setlink.png alt loading=lazy class=medium-zoom-image></p><p>配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。</p><div class="alert alert-default d-flex" role=alert><div class="flex-shrink-1 alert-icon"><p>🤖</p></div><div class=w-100><p>这里仅需配置根地址,无需具体到完整请求路径。</p></div></div><h3 id=2-分享链接中增加额外-query>2. 分享链接中增加额外 query <a href=#2-%e5%88%86%e4%ba%ab%e9%93%be%e6%8e%a5%e4%b8%ad%e5%a2%9e%e5%8a%a0%e9%a2%9d%e5%a4%96-query class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>在分享链接的地址中,增加一个额外的参数: authToken。例如:</p><p>原始的链接:<code>https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192</code></p><p>完整链接: <code>https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192&amp;authToken=userid12345</code></p><p>这个<code>authToken</code>通常是你系统生成的用户唯一凭证(Token之类的)。FastGPT 会在鉴权接口的<code>body</code>中携带 token={{authToken}} 的参数。</p><h3 id=3-编写聊天初始化校验接口>3. 编写聊天初始化校验接口 <a href=#3-%e7%bc%96%e5%86%99%e8%81%8a%e5%a4%a9%e5%88%9d%e5%a7%8b%e5%8c%96%e6%a0%a1%e9%aa%8c%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=acedfbTab data-bs-toggle=tab data-bs-target=#acedfb type=button role=tab aria-controls=acedfb aria-selected=true>请求示例</a>
<a class=nav-link id=cbafdeTab data-bs-toggle=tab data-bs-target=#cbafde type=button role=tab aria-controls=cbafde aria-selected=true>鉴权成功</a>
<a class=nav-link id=eafbdcTab data-bs-toggle=tab data-bs-target=#eafbdc type=button role=tab aria-controls=eafbdc aria-selected=true>鉴权失败</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=acedfb role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=39d214b class=language-bash>
<code>curl --location --request POST &#39;{{host}}/shareAuth/init&#39; \
--header &#39;Content-Type: application/json&#39; \
--data-raw &#39;{
&#34;token&#34;: &#34;{{authToken}}&#34;
}&#39;</code>
</pre></div></div><div class="tab-pane fade" id=dcebaf role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d6c7899 class=language-json>
</pre></div></div><div class="tab-pane fade" id=cbafde role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d6c7899 class=language-json>
<code>{
&#34;success&#34;: true,
&#34;data&#34;: {
&#34;uid&#34;: &#34;用户唯一凭证&#34;
}
}</code>
</pre></div><p>系统会拉取该分享链接下,uid 为 username123 的对话记录。</p></div><div class="tab-pane fade" id=bdcafe role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=3297f92 class=language-json>
</pre></div><p>系统会拉取该分享链接下,uid 为 username123 的对话记录。</p></div><div class="tab-pane fade" id=eafbdc role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=3297f92 class=language-json>
<code>{
&#34;success&#34;: false,
&#34;message&#34;: &#34;身份错误&#34;,
}</code>
</pre></div></div></div><h3 id=4-编写对话前校验接口>4. 编写对话前校验接口 <a href=#4-%e7%bc%96%e5%86%99%e5%af%b9%e8%af%9d%e5%89%8d%e6%a0%a1%e9%aa%8c%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=acbfdeTab data-bs-toggle=tab data-bs-target=#acbfde type=button role=tab aria-controls=acbfde aria-selected=true>请求示例</a>
<a class=nav-link id=befdcaTab data-bs-toggle=tab data-bs-target=#befdca type=button role=tab aria-controls=befdca aria-selected=true>鉴权成功</a>
<a class=nav-link id=afbcedTab data-bs-toggle=tab data-bs-target=#afbced type=button role=tab aria-controls=afbced aria-selected=true>鉴权失败</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=acbfde role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=40c1d59 class=language-bash>
</pre></div></div></div><h3 id=4-编写对话前校验接口>4. 编写对话前校验接口 <a href=#4-%e7%bc%96%e5%86%99%e5%af%b9%e8%af%9d%e5%89%8d%e6%a0%a1%e9%aa%8c%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=febacdTab data-bs-toggle=tab data-bs-target=#febacd type=button role=tab aria-controls=febacd aria-selected=true>请求示例</a>
<a class=nav-link id=cdfbeaTab data-bs-toggle=tab data-bs-target=#cdfbea type=button role=tab aria-controls=cdfbea aria-selected=true>鉴权成功</a>
<a class=nav-link id=edbfcaTab data-bs-toggle=tab data-bs-target=#edbfca type=button role=tab aria-controls=edbfca aria-selected=true>鉴权失败</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=febacd role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=40c1d59 class=language-bash>
<code>curl --location --request POST &#39;{{host}}/shareAuth/start&#39; \
--header &#39;Content-Type: application/json&#39; \
--data-raw &#39;{
&#34;token&#34;: &#34;{{authToken}}&#34;,
&#34;question&#34;: &#34;用户问题&#34;,
}&#39;</code>
</pre></div></div><div class="tab-pane fade" id=befdca role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d6c7899 class=language-json>
</pre></div></div><div class="tab-pane fade" id=cdfbea role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d6c7899 class=language-json>
<code>{
&#34;success&#34;: true,
&#34;data&#34;: {
&#34;uid&#34;: &#34;用户唯一凭证&#34;
}
}</code>
</pre></div></div><div class="tab-pane fade" id=afbced role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=23a56e7 class=language-json>
</pre></div></div><div class="tab-pane fade" id=edbfca role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=23a56e7 class=language-json>
<code>{
&#34;success&#34;: false,
&#34;message&#34;: &#34;身份验证失败&#34;,
Expand Down Expand Up @@ -201,9 +201,9 @@

isElseResult?: boolean; // 判断器结果
}</code>
</pre></div><h2 id=实践案例>实践案例 <a href=#%e5%ae%9e%e8%b7%b5%e6%a1%88%e4%be%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><p>我们以<a href=https://laf.dev/ rel=external target=_blank>Laf作为服务器为例<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a>,简单展示这 3 个接口的使用方式。</p><h3 id=1-创建3个laf接口>1. 创建3个Laf接口 <a href=#1-%e5%88%9b%e5%bb%ba3%e4%b8%aalaf%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/share-auth1.png alt loading=lazy class=medium-zoom-image></p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=aefdcbTab data-bs-toggle=tab data-bs-target=#aefdcb type=button role=tab aria-controls=aefdcb aria-selected=true>/shareAuth/init</a>
<a class=nav-link id=baefdcTab data-bs-toggle=tab data-bs-target=#baefdc type=button role=tab aria-controls=baefdc aria-selected=true>/shareAuth/start</a>
<a class=nav-link id=aebcdfTab data-bs-toggle=tab data-bs-target=#aebcdf type=button role=tab aria-controls=aebcdf aria-selected=true>/shareAuth/finish</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=aefdcb role=tabpanel aria-labelledby=nav-1><p>这个接口中,我们设置了<code>token</code>必须等于<code>fastgpt</code>才能通过校验。(实际生产中不建议固定写死)</p><div class=prism-codeblock><pre id=ba0b6c9 class=language-ts>
</pre></div><h2 id=实践案例>实践案例 <a href=#%e5%ae%9e%e8%b7%b5%e6%a1%88%e4%be%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><p>我们以<a href=https://laf.dev/ rel=external target=_blank>Laf作为服务器为例<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a>,简单展示这 3 个接口的使用方式。</p><h3 id=1-创建3个laf接口>1. 创建3个Laf接口 <a href=#1-%e5%88%9b%e5%bb%ba3%e4%b8%aalaf%e6%8e%a5%e5%8f%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/share-auth1.png alt loading=lazy class=medium-zoom-image></p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=cdbefaTab data-bs-toggle=tab data-bs-target=#cdbefa type=button role=tab aria-controls=cdbefa aria-selected=true>/shareAuth/init</a>
<a class=nav-link id=eabfcdTab data-bs-toggle=tab data-bs-target=#eabfcd type=button role=tab aria-controls=eabfcd aria-selected=true>/shareAuth/start</a>
<a class=nav-link id=dcfaebTab data-bs-toggle=tab data-bs-target=#dcfaeb type=button role=tab aria-controls=dcfaeb aria-selected=true>/shareAuth/finish</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=cdbefa role=tabpanel aria-labelledby=nav-1><p>这个接口中,我们设置了<code>token</code>必须等于<code>fastgpt</code>才能通过校验。(实际生产中不建议固定写死)</p><div class=prism-codeblock><pre id=ba0b6c9 class=language-ts>
<code>import cloud from &#39;@lafjs/cloud&#39;

export default async function (ctx: FunctionContext) {
Expand All @@ -216,7 +216,7 @@

return { success: false,message:&#34;身份错误&#34; }
}</code>
</pre></div></div><div class="tab-pane fade" id=baefdc role=tabpanel aria-labelledby=nav-1><p>这个接口中,我们设置了<code>token</code>必须等于<code>fastgpt</code>才能通过校验。并且如果问题中包含了<code></code>字,则会报错,用于模拟敏感校验。</p><div class=prism-codeblock><pre id=cf82db5 class=language-ts>
</pre></div></div><div class="tab-pane fade" id=eabfcd role=tabpanel aria-labelledby=nav-1><p>这个接口中,我们设置了<code>token</code>必须等于<code>fastgpt</code>才能通过校验。并且如果问题中包含了<code></code>字,则会报错,用于模拟敏感校验。</p><div class=prism-codeblock><pre id=cf82db5 class=language-ts>
<code>import cloud from &#39;@lafjs/cloud&#39;

export default async function (ctx: FunctionContext) {
Expand All @@ -234,7 +234,7 @@

return { success: true, data: { uid: &#34;user1&#34; } }
}</code>
</pre></div></div><div class="tab-pane fade" id=aebcdf role=tabpanel aria-labelledby=nav-1><p>结果上报接口可自行进行逻辑处理。</p><div class=prism-codeblock><pre id=b3696df class=language-ts>
</pre></div></div><div class="tab-pane fade" id=dcfaeb role=tabpanel aria-labelledby=nav-1><p>结果上报接口可自行进行逻辑处理。</p><div class=prism-codeblock><pre id=b3696df class=language-ts>
<code>import cloud from &#39;@lafjs/cloud&#39;

export default async function (ctx: FunctionContext) {
Expand Down
Loading

0 comments on commit 73dc3ce

Please sign in to comment.