4.6.8-alpha (#804)
* perf: redirect request and err log replace perf: dataset openapi feat: session fix: retry input error feat: 468 doc sub page feat: standard sub perf: rerank tip perf: rerank tip perf: api sdk perf: openapi sub plan perf: sub ui fix: ts * perf: init log * fix: variable select * sub page * icon * perf: llm model config * perf: menu ux * perf: system store * perf: publish app name * fix: init data * perf: flow edit ux * fix: value type format and ux * fix prompt editor default value (#13) * fix prompt editor default value * fix prompt editor update when not focus * add key with variable --------- Co-authored-by: Archer <545436317@qq.com> * fix: value type * doc * i18n * import path * home page * perf: mongo session running * fix: ts * perf: use toast * perf: flow edit * perf: sse response * slider ui * fetch error * fix prompt editor rerender when not focus by key defaultvalue (#14) * perf: prompt editor * feat: dataset search concat * perf: doc * fix:ts * perf: doc * fix json editor onblur value (#15) * faq * vector model default config * ipv6 --------- Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -5,112 +5,82 @@
|
||||
"qaMaxProcess": 15,
|
||||
"pgHNSWEfSearch": 100
|
||||
},
|
||||
"chatModels": [
|
||||
"llmModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"name": "GPT35",
|
||||
"model": "gpt-3.5-turbo-1106",
|
||||
"name": "gpt-3.5-turbo",
|
||||
"maxContext": 16000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 13000,
|
||||
"maxTemperature": 1.2,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"maxContext": 4000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 2000,
|
||||
"maxTemperature": 1.2,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"defaultSystemChatPrompt": ""
|
||||
"datasetProcess": false,
|
||||
"toolChoice": true,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {}
|
||||
},
|
||||
{
|
||||
"model": "gpt-3.5-turbo-16k",
|
||||
"name": "GPT35-16k",
|
||||
"name": "gpt-3.5-turbo-16k",
|
||||
"maxContext": 16000,
|
||||
"maxResponse": 16000,
|
||||
"quoteMaxToken": 13000,
|
||||
"maxTemperature": 1.2,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"quoteMaxToken": 8000,
|
||||
"maxTemperature": 1.2,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"defaultSystemChatPrompt": ""
|
||||
"datasetProcess": true,
|
||||
"toolChoice": true,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {}
|
||||
},
|
||||
{
|
||||
"model": "gpt-4",
|
||||
"name": "GPT4-8k",
|
||||
"maxContext": 8000,
|
||||
"maxResponse": 8000,
|
||||
"model": "gpt-4-0125-preview",
|
||||
"name": "gpt-4-turbo",
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 125000,
|
||||
"quoteMaxToken": 100000,
|
||||
"maxTemperature": 1.2,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"quoteMaxToken": 4000,
|
||||
"maxTemperature": 1.2,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"defaultSystemChatPrompt": ""
|
||||
"datasetProcess": false,
|
||||
"toolChoice": true,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {}
|
||||
},
|
||||
{
|
||||
"model": "gpt-4-vision-preview",
|
||||
"name": "GPT4-Vision",
|
||||
"name": "gpt-4-vision",
|
||||
"maxContext": 128000,
|
||||
"maxResponse": 4000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"quoteMaxToken": 100000,
|
||||
"maxTemperature": 1.2,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"censor": false,
|
||||
"vision": true,
|
||||
"defaultSystemChatPrompt": ""
|
||||
}
|
||||
],
|
||||
"qaModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo-16k",
|
||||
"name": "GPT35-16k",
|
||||
"maxContext": 16000,
|
||||
"maxResponse": 16000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0
|
||||
}
|
||||
],
|
||||
"cqModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"name": "GPT35",
|
||||
"maxContext": 4000,
|
||||
"maxResponse": 4000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"vision": false,
|
||||
"datasetProcess": false,
|
||||
"toolChoice": true,
|
||||
"functionPrompt": ""
|
||||
},
|
||||
{
|
||||
"model": "gpt-4",
|
||||
"name": "GPT4-8k",
|
||||
"maxContext": 8000,
|
||||
"maxResponse": 8000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"toolChoice": true,
|
||||
"functionPrompt": ""
|
||||
}
|
||||
],
|
||||
"extractModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo-1106",
|
||||
"name": "GPT35-1106",
|
||||
"maxContext": 16000,
|
||||
"maxResponse": 4000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0,
|
||||
"toolChoice": true,
|
||||
"functionPrompt": ""
|
||||
}
|
||||
],
|
||||
"qgModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo-1106",
|
||||
"name": "GPT35-1106",
|
||||
"maxContext": 1600,
|
||||
"maxResponse": 4000,
|
||||
"inputPrice": 0,
|
||||
"outputPrice": 0
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {}
|
||||
}
|
||||
],
|
||||
"vectorModels": [
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
{
|
||||
"key": "DYNAMIC_INPUT_KEY",
|
||||
"valueType": "any",
|
||||
"label": "字符串变量",
|
||||
"label": "需要加工的输入",
|
||||
"type": "addInputParam",
|
||||
"required": false,
|
||||
"description": "可动态的添加字符串类型变量,在文本编辑中通过 {{key}} 使用变量。",
|
||||
"description": "可动态的添加字符串类型变量,在文本编辑中通过 {{key}} 使用变量。非字符串类型,会自动转成字符串类型。",
|
||||
"edit": true,
|
||||
"editField": {
|
||||
"key": true,
|
||||
@@ -79,7 +79,7 @@
|
||||
{
|
||||
"key": "DYNAMIC_INPUT_KEY",
|
||||
"valueType": "any",
|
||||
"label": "字符串变量",
|
||||
"label": "需要加工的输入",
|
||||
"type": "source",
|
||||
"edit": true,
|
||||
"targets": [
|
||||
|
||||
@@ -45,7 +45,13 @@ const nextConfig = {
|
||||
},
|
||||
transpilePackages: ['@fastgpt/*'],
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ['mongoose', 'pg', '@chakra-ui/react', '@lexical/react'],
|
||||
serverComponentsExternalPackages: [
|
||||
'mongoose',
|
||||
'pg',
|
||||
'react',
|
||||
'@chakra-ui/react',
|
||||
'@lexical/react'
|
||||
],
|
||||
outputFileTracingRoot: path.join(__dirname, '../../')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "4.6.7",
|
||||
"version": "4.6.8",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
@@ -21,6 +21,7 @@
|
||||
"@fastgpt/plugins": "workspace:*",
|
||||
"@fastgpt/service": "workspace:*",
|
||||
"@fastgpt/web": "workspace:*",
|
||||
"@fortaine/fetch-event-source": "^3.0.6",
|
||||
"@node-rs/jieba": "^1.7.2",
|
||||
"@tanstack/react-query": "^4.24.10",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
### Fast GPT V4.6.7
|
||||
### Fast GPT V4.6.8
|
||||
|
||||
1. 修改了知识库UI及新的导入交互方式。
|
||||
2. 优化知识库和对话的数据索引,加快数据操作。
|
||||
3. 知识库 openAPI,支持通过 API 操作知识库。
|
||||
4. 新增 - 输入框变量提示。输入 { 号后将会获得可用变量提示。根据社区针对高级编排的反馈,我们计划于 2 月份的版本中,优化变量内容,支持模块的局部变量以及更多全局变量写入。
|
||||
5. 优化 - 切换团队后会保存记录,下次登录时优先登录该团队。
|
||||
6. 修复 - API 对话时,chatId 冲突问题。
|
||||
7. 修复 - Iframe 嵌入网页可能导致的 window.onLoad 冲突。
|
||||
2. 新增 - 知识库搜索合并模块。
|
||||
3. 优化 - LLM 模型配置,不再区分对话、分类、提取模型。同时支持模型的默认参数,避免不同模型参数冲突,可通过`defaultConfig`传入默认的配置。
|
||||
4. 优化 - HTTP 模块,支持输出字符串自动序列化(JSON可自动转成字符串)
|
||||
5. 修复 - 语音输入文件无法上传。
|
||||
6. 修复 - 对话框重新生成无法使用。
|
||||
7. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro)
|
||||
8. [使用文档](https://doc.fastgpt.in/docs/intro/)
|
||||
9. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow)
|
||||
10. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)
|
||||
9. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746289796" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="44851" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M939.795692 421.415385a248.832 248.832 0 0 0-21.385846-204.386462 251.667692 251.667692 0 0 0-271.064615-120.753231 248.832 248.832 0 0 0-187.687385-83.672615 251.687385 251.687385 0 0 0-240.088615 174.257231 248.910769 248.910769 0 0 0-166.4 120.713846 251.707077 251.707077 0 0 0 30.956307 295.108923 248.832 248.832 0 0 0 21.385847 204.386461 251.687385 251.687385 0 0 0 271.064615 120.753231 248.832 248.832 0 0 0 187.687385 83.672616 251.687385 251.687385 0 0 0 240.167384-174.355693 248.910769 248.910769 0 0 0 166.4-120.713846A251.707077 251.707077 0 0 0 939.795692 421.415385zM564.342154 946.195692a186.663385 186.663385 0 0 1-119.827692-43.323077c1.516308-0.827077 4.174769-2.284308 5.907692-3.347692l198.892308-114.884923a32.334769 32.334769 0 0 0 16.344615-28.297846V475.943385l84.066461 48.541538a2.993231 2.993231 0 0 1 1.634462 2.304v232.211692a187.431385 187.431385 0 0 1-187.017846 187.195077z m-402.195692-171.776a186.564923 186.564923 0 0 1-22.331077-125.44c1.476923 0.886154 4.056615 2.461538 5.907692 3.524923l198.892308 114.884923a32.374154 32.374154 0 0 0 32.669538 0l242.825846-140.20923v97.083077a3.012923 3.012923 0 0 1-1.201231 2.579692l-201.058461 116.086154a187.392 187.392 0 0 1-255.704615-68.509539z m-52.322462-434.195692a186.505846 186.505846 0 0 1 97.437538-82.077538c0 1.713231-0.098462 4.745846-0.098461 6.852923v229.769846a32.315077 32.315077 0 0 0 16.324923 28.278154L466.313846 663.236923l-84.066461 48.541539a3.012923 3.012923 0 0 1-2.835693 0.256l-201.078154-116.184616a187.392 187.392 0 0 1-68.509538-255.625846z m690.688 160.728615l-242.825846-140.20923 84.066461-48.521847a3.012923 3.012923 0 0 1 2.835693-0.256l201.078154 116.086154a187.234462 187.234462 0 0 1-28.928 337.821539V529.230769a32.295385 32.295385 0 0 0-16.226462-28.278154zM884.184615 375.020308c-1.476923-0.905846-4.056615-2.461538-5.907692-3.524923l-198.892308-114.884923a32.413538 32.413538 0 0 0-32.669538 0l-242.825846 140.20923v-97.083077a3.012923 3.012923 0 0 1 1.201231-2.579692l201.058461-115.987692A187.214769 187.214769 0 0 1 884.184615 375.020308z m-526.00123 173.036307l-84.086154-48.541538a2.993231 2.993231 0 0 1-1.634462-2.304V264.999385a187.214769 187.214769 0 0 1 307.003077-143.753847c-1.516308 0.827077-4.155077 2.284308-5.907692 3.347693l-198.892308 114.884923a32.315077 32.315077 0 0 0-16.344615 28.278154z m45.666461-98.461538L512 387.131077l108.150154 62.424615v124.888616L512 636.868923l-108.150154-62.424615z" fill="#202123" p-id="44852"></path></svg>
|
||||
|
Before Width: | Height: | Size: 2.8 KiB |
1
projects/app/public/imgs/module/concat.svg
Normal file
1
projects/app/public/imgs/module/concat.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1706771092322" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5411" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M861.045651 64.447824 162.614611 64.447824c-54.376445 0-98.455359 44.079938-98.455359 98.456383l0 698.430016c0 54.376445 44.079938 98.456383 98.455359 98.456383l698.430016 0c54.376445 0 98.456383-44.079938 98.456383-98.456383L959.50101 162.904207C959.502034 108.528785 915.422096 64.447824 861.045651 64.447824zM153.315828 211.438597l172.208107 0c8.748245 11.125385 129.704061 222.88223 129.704061 222.88223l-43.320645 56.170301L291.082518 280.322453 153.315828 280.322453c-19.018146 0-34.441417-12.853749-34.441417-31.67235C118.874411 229.833549 134.297682 211.438597 153.315828 211.438597zM909.225977 513.596358 763.121388 624.062262c-10.277064 10.17064-42.363853 14.696724-52.640917 4.526083l0.004093-86.708827L532.163225 541.879518 325.522911 812.799834 153.314805 812.799834c-19.018146 0-34.441417-18.392906-34.441417-37.21253 0-18.809391 15.423271-31.668257 34.441417-31.668257l137.76669 0L497.721809 472.995661l212.759685 0-0.001023-9.076726 0.004093-94.929046c10.273994-10.169617 42.35976-12.849656 52.636824-2.686179l146.105612 110.471021C919.506111 486.942301 919.506111 503.429811 909.225977 513.596358z" fill="#1296db" p-id="5412"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 572 B |
5
projects/app/public/imgs/module/userChatInput.svg
Normal file
5
projects/app/public/imgs/module/userChatInput.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 20" fill="none">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M4.29301 2.39966C2.82025 2.39966 1.62634 3.59356 1.62634 5.06632V14.9337C1.62634 16.4065 2.82025 17.6004 4.29301 17.6004H17.2776C18.7504 17.6004 19.9443 16.4065 19.9443 14.9337V5.06632C19.9443 3.59357 18.7504 2.39966 17.2776 2.39966H4.29301ZM4.98747 6.74049C4.98747 6.28025 5.36056 5.90715 5.8208 5.90715H8.31228C8.77252 5.90715 9.14561 6.28025 9.14561 6.74049C9.14561 7.20072 8.77252 7.57382 8.31228 7.57382H7.81654V12.4438H8.31228C8.77252 12.4438 9.14561 12.8169 9.14561 13.2771C9.14561 13.7374 8.77252 14.1105 8.31228 14.1105H5.8208C5.36056 14.1105 4.98747 13.7374 4.98747 13.2771C4.98747 12.8169 5.36056 12.4438 5.8208 12.4438H6.31654L6.31654 7.57382H5.8208C5.36056 7.57382 4.98747 7.20072 4.98747 6.74049ZM11.8468 12.6952C11.5213 12.3697 10.9937 12.3697 10.6682 12.6952C10.3428 13.0206 10.3428 13.5482 10.6682 13.8737L10.6741 13.8796C10.9996 14.205 11.5272 14.205 11.8526 13.8796C12.1781 13.5541 12.1781 13.0265 11.8526 12.7011L11.8468 12.6952ZM14.7807 12.6952C14.4553 12.3697 13.9276 12.3697 13.6022 12.6952C13.2768 13.0206 13.2768 13.5482 13.6022 13.8737L13.6081 13.8796C13.9335 14.205 14.4612 14.205 14.7866 13.8796C15.112 13.5541 15.112 13.0265 14.7866 12.7011L14.7807 12.6952Z"
|
||||
fill="#3370FF" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
117
projects/app/public/imgs/priceBg.svg
Normal file
117
projects/app/public/imgs/priceBg.svg
Normal file
@@ -0,0 +1,117 @@
|
||||
<svg viewBox="0 0 1440 3888" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1529_3242)">
|
||||
<rect x="986.26" y="510.279" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 986.26 510.279)"
|
||||
stroke="url(#paint0_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="923.499" y="886.439" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 923.499 886.439)"
|
||||
stroke="url(#paint1_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="1088.08" y="130.271" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 1088.08 130.271)"
|
||||
stroke="url(#paint2_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="416.019" y="653.422" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 416.019 653.422)"
|
||||
stroke="url(#paint3_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="349.499" y="978.437" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 349.499 978.437)"
|
||||
stroke="url(#paint4_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="517.841" y="273.416" width="483.77" height="363.42" rx="13.9824" transform="rotate(15 517.841 273.416)"
|
||||
stroke="url(#paint5_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="619.664" y="-106.592" width="483.77" height="341.137" rx="13.9824"
|
||||
transform="rotate(15 619.664 -106.592)" stroke="url(#paint6_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="-125.501" y="689.381" width="483.77" height="363.42" rx="13.9824"
|
||||
transform="rotate(15 -125.501 689.381)" stroke="url(#paint7_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="-23.6781" y="309.373" width="483.77" height="363.42" rx="13.9824"
|
||||
transform="rotate(15 -23.6781 309.373)" stroke="url(#paint8_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<rect x="78.1443" y="-70.6332" width="483.77" height="363.42" rx="13.9824"
|
||||
transform="rotate(15 78.1443 -70.6332)" stroke="url(#paint9_linear_1529_3242)" stroke-width="0.717048" />
|
||||
<g filter="url(#filter0_f_1529_3242)">
|
||||
<path
|
||||
d="M1299.4 236.263C1273.92 -58.7703 1292.79 -316.494 1659.87 -519.399L2251.84 551.545L1045.21 1218.52C1022.06 1228.14 991.901 1180.45 1030.53 1003.12C1078.82 781.445 1324.88 531.296 1299.4 236.263Z"
|
||||
fill="url(#paint10_linear_1529_3242)" fill-opacity="0.35" />
|
||||
</g>
|
||||
<g filter="url(#filter1_f_1529_3242)">
|
||||
<path
|
||||
d="M1114.05 72.4481C1088.57 -222.585 1393.67 -224.671 1760.75 -427.575L1615.29 697.061C1615.29 697.061 1499.66 1026.83 992.597 1317.14C943.478 1345.26 752.396 1398.55 495.322 1448.95C461.43 1481.9 423.174 1517.54 379.994 1556.11C276.748 1648.32 23.0323 1890.35 0.935006 2092.17C-36.7924 2436.75 -452.753 1780.5 -340.95 2006.57C-170.001 2352.24 -248.22 2754.86 -923.871 1975.75C-1249 1600.83 -1648.1 1384.37 -1817.79 1305.74C-1938.02 1260.94 -1917.51 1259.55 -1817.79 1305.74C-1717.43 1343.14 -1519 1410.79 -1186.7 1506.26C-745.377 1633.05 -1.69338 1546.39 495.322 1448.95C694.196 1255.58 742.848 1154.8 754.831 1099.79C803.117 878.115 1139.53 367.481 1114.05 72.4481Z"
|
||||
fill="url(#paint11_linear_1529_3242)" fill-opacity="0.4" />
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_f_1529_3242" x="829.097" y="-702.298" width="1605.64" height="2104.89"
|
||||
filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
|
||||
<feGaussianBlur stdDeviation="91.45" result="effect1_foregroundBlur_1529_3242" />
|
||||
</filter>
|
||||
<filter id="filter1_f_1529_3242" x="-2083.35" y="-610.476" width="4026.99" height="3217.24"
|
||||
filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
|
||||
<feGaussianBlur stdDeviation="91.45" result="effect1_foregroundBlur_1529_3242" />
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_1529_3242" x1="1228.25" y1="509.84" x2="1228.25" y2="873.977"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_1529_3242" x1="1165.49" y1="886" x2="1165.49" y2="1250.14"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_1529_3242" x1="1330.07" y1="129.832" x2="1330.07" y2="493.969"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear_1529_3242" x1="658.009" y1="652.982" x2="658.009" y2="1017.12"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.1" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint4_linear_1529_3242" x1="591.489" y1="977.998" x2="641.285" y2="1265.2"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint5_linear_1529_3242" x1="759.831" y1="272.977" x2="759.831" y2="637.113"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.1" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint6_linear_1529_3242" x1="861.654" y1="-107.031" x2="861.654" y2="234.823"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint7_linear_1529_3242" x1="116.489" y1="688.941" x2="162.837" y2="1231.8"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint8_linear_1529_3242" x1="218.312" y1="308.934" x2="218.312" y2="673.07"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.15" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint9_linear_1529_3242" x1="253.832" y1="-102.612" x2="344.766" y2="364.261"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#336FFF" stop-opacity="0.2" />
|
||||
<stop offset="1" stop-color="#336FFF" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint10_linear_1529_3242" x1="1156.96" y1="-159.622" x2="1812.4" y2="131.08"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.153575" stop-color="#CAECFF" stop-opacity="0.9" />
|
||||
<stop offset="0.4375" stop-color="#ACBEFF" />
|
||||
<stop offset="0.703125" stop-color="#618DFF" />
|
||||
<stop offset="0.833333" stop-color="#628EFF" />
|
||||
<stop offset="1" stop-color="#0058FF" />
|
||||
</linearGradient>
|
||||
<linearGradient id="paint11_linear_1529_3242" x1="1257.84" y1="-67.7694" x2="1913.28" y2="222.933"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.153575" stop-color="#CAD9FF" stop-opacity="0.9" />
|
||||
<stop offset="0.4375" stop-color="#ACC8FF" />
|
||||
<stop offset="0.703125" stop-color="#61A0FF" />
|
||||
<stop offset="0.833333" stop-color="#3B7DFF" />
|
||||
<stop offset="1" stop-color="#0058FF" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_1529_3242">
|
||||
<rect width="1440" height="3888" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.2 KiB |
@@ -155,6 +155,7 @@
|
||||
"Select Avatar": "Select Avatar",
|
||||
"Select Failed": "Select Failed"
|
||||
},
|
||||
"change": "Change",
|
||||
"choosable": "choosable",
|
||||
"confirm": {
|
||||
"Common Tip": "Operational Confirm"
|
||||
@@ -201,6 +202,7 @@
|
||||
"link": {
|
||||
"UnValid": "UnValid Link"
|
||||
},
|
||||
"month": "Month",
|
||||
"price": {
|
||||
"Amount": "{{amount}}{{unit}}"
|
||||
},
|
||||
@@ -224,6 +226,7 @@
|
||||
},
|
||||
"core": {
|
||||
"Chat": "Chat",
|
||||
"Chat API is error or undefined": "The session interface reported an error or returned null",
|
||||
"Chat test": "Chat test",
|
||||
"Max Token": "MaxTokens",
|
||||
"Start chat": "Start chat",
|
||||
@@ -293,6 +296,8 @@
|
||||
"navbar": {
|
||||
"External": "External",
|
||||
"Flow mode": "Flow mode",
|
||||
"Publish": "Publish",
|
||||
"Publish app": "Publish App",
|
||||
"Simple mode": "Simple mode"
|
||||
},
|
||||
"outLink": {
|
||||
@@ -357,6 +362,7 @@
|
||||
"chat": {
|
||||
"Admin Mark Content": "Corrected response",
|
||||
"Audio Speech Error": "Audio Speech Error",
|
||||
"Chat API is error or undefined": "",
|
||||
"Confirm to clear history": "Confirm to clear history?",
|
||||
"Confirm to clear share chat history": " Are you sure to delete all chats?",
|
||||
"Converting to text": "Converting to text...",
|
||||
@@ -562,6 +568,7 @@
|
||||
"id": "Data ID",
|
||||
"unit": "pieces"
|
||||
},
|
||||
"embedding model tip": "The index model can transform the natural language into vectors for semantic retrieval. Note that different index models cannot be used together and cannot be modified after selecting the index model.",
|
||||
"error": {
|
||||
"Data not found": "The data does not exist or has been deleted",
|
||||
"Start Sync Failed": "Start Sync Failed",
|
||||
@@ -733,6 +740,12 @@
|
||||
"module": {
|
||||
"Add question type": "Add type",
|
||||
"Data Type": "Data Type",
|
||||
"Dataset quote": {
|
||||
"Add quote": "Add quote",
|
||||
"Concat result": "Concat result",
|
||||
"Input description": "",
|
||||
"label": "Dataset quote"
|
||||
},
|
||||
"Field Description": "Description",
|
||||
"Field Name": "Name",
|
||||
"Field Type": "Type",
|
||||
@@ -762,6 +775,7 @@
|
||||
"Quote": "Object array format, structure:\n[{q:' question ',a:' answer '}]",
|
||||
"Response content": "You can use \\n to achieve continuous line wrapping.\nReplies can be achieved by external module input, which overwrites the content currently filled in.\nIf passed non-string type data will be automatically converted to a string",
|
||||
"TFSwitch textarea": "Allows you to define a number of strings to achieve false matching, one per line, and supports regular expressions.",
|
||||
"Trigger": "Most of the time, you don't need to concatenate this property. You can connect this property when you need to delay execution, or precisely control the timing of execution.",
|
||||
"anyInput": "Can pass anything ",
|
||||
"cfr background": "Describes the scope of the current conversation, making it easier for the AI to complete first or vague questions, thereby enhancing the knowledge base's ability to continue conversations. If\nis empty, the question completion function is not used in the first conversation. ",
|
||||
"dynamic input": "Receives parameters dynamically added by the user and will be tiled in at run time ",
|
||||
@@ -835,6 +849,7 @@
|
||||
"Classify question intro": "Determine the type of question based on the user's history and current issue. Multiple sets of question types can be added, here is a template example: \n type 1: Hello\ntype 2: Questions about 'use'\ntype 3: Questions about 'purchase'\ntype 4: Other questions",
|
||||
"Dataset search": "Dataset search",
|
||||
"Dataset search intro": "Invoke the Dataset search capability to find content that may be relevant to the problem",
|
||||
"Dataset search result concat intro": "Multiple knowledge base search results can be combined and output",
|
||||
"External module": "External call",
|
||||
"Extract field": "Text content extraction ",
|
||||
"Extract field intro": "Can extract specified data from the text, such as: sql statements, search keywords, code, etc.",
|
||||
@@ -888,6 +903,9 @@
|
||||
},
|
||||
"variable add option": "Add Option"
|
||||
},
|
||||
"plugin": {
|
||||
"Get Plugin Module Detail Failed": "Load plugin failed"
|
||||
},
|
||||
"shareChat": {
|
||||
"Init Error": "Init Chat Error",
|
||||
"Init History Error": "Init History Error"
|
||||
@@ -1125,6 +1143,7 @@
|
||||
"Cancel subscription": "Cancel"
|
||||
},
|
||||
"user": {
|
||||
"Need to login": "Please log in first",
|
||||
"Price": "Price",
|
||||
"auth": {
|
||||
"Sending Code": "Sending"
|
||||
@@ -1136,28 +1155,69 @@
|
||||
},
|
||||
"team": {
|
||||
"Dataset usage": "Dataset usage",
|
||||
"member": "Member",
|
||||
"subscription": {
|
||||
"type": {
|
||||
"extraDatasetSize": "Extra dataset size"
|
||||
}
|
||||
}
|
||||
"member": "Member"
|
||||
}
|
||||
},
|
||||
"wallet": {
|
||||
"Balance not enough tip": "The balance is insufficient, please go to the account page first",
|
||||
"Buy more": "Buy more",
|
||||
"Confirm pay": "Confirm pay",
|
||||
"Pay error": "Pay error",
|
||||
"Pay success": "Pay success",
|
||||
"bill": {
|
||||
"AI Model": "AI Model",
|
||||
"AI Type": "AI Type",
|
||||
"Price": "Price(¥)"
|
||||
},
|
||||
"subscription": {
|
||||
"Ai points": "AI Points Standard",
|
||||
"Buy now": "Buy now",
|
||||
"Change will take effect after the current subscription expires": "Change will take effect after the current subscription expires",
|
||||
"Current dataset store": "Current dataset store subscription",
|
||||
"Current plan": "Current plan",
|
||||
"Dataset store": "Dataset store size",
|
||||
"Dataset store price tip": "Deduct it from the account balance on the 1st of each month",
|
||||
"Expand size": "Expand size",
|
||||
"Extra dataset size": "Extra dataset size",
|
||||
"Extra plan": "Extra Plan",
|
||||
"Extra plan tip": "When the standard plan is not enough, you can purchase an additional plan to continue using",
|
||||
"FAQ": "Pricing FAQs",
|
||||
"Next plan": "Future plan",
|
||||
"Next sub dataset size": "",
|
||||
"Update extra dataset size": "Update size"
|
||||
"Nonsupport": "Nonsupport",
|
||||
"Refund plan and pay confirm": "There is no extra cost for you to switch this package and {{amount}} will be refunded to the balance.",
|
||||
"Standard plan pay confirm": "To switch this package, you need to pay {{payPrice}} Yuan.",
|
||||
"Standard update fail": "Update plan failed.",
|
||||
"Standard update success": "Change subscription plan successful!",
|
||||
"Sub plan": "Pricing Plans",
|
||||
"Sub plan tip": "Use FastGPT for free or upgrade to a higher plan",
|
||||
"Training weight": "Training weight: {{weight}}",
|
||||
"Update extra dataset size": "Update size",
|
||||
"function": {
|
||||
"History store": "",
|
||||
"Max app": "",
|
||||
"Max dataset": "",
|
||||
"Max dataset size": "",
|
||||
"Max members": "",
|
||||
"Points": ""
|
||||
},
|
||||
"mode": {
|
||||
"Month": "Monthly",
|
||||
"Year": "Yearly",
|
||||
"Year sale": "2 months free"
|
||||
},
|
||||
"standardSubLevel": {
|
||||
"enterprise": "",
|
||||
"experience": "",
|
||||
"experience desc": "",
|
||||
"free": "",
|
||||
"free desc": "",
|
||||
"team": ""
|
||||
},
|
||||
"type": {
|
||||
"extraDatasetSize": "Extra dataset size",
|
||||
"standard": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
"Select Avatar": "点击选择头像",
|
||||
"Select Failed": "选择头像异常"
|
||||
},
|
||||
"change": "变更",
|
||||
"choosable": "可选",
|
||||
"confirm": {
|
||||
"Common Tip": "操作确认"
|
||||
@@ -201,6 +202,7 @@
|
||||
"link": {
|
||||
"UnValid": "无效的链接"
|
||||
},
|
||||
"month": "月",
|
||||
"price": {
|
||||
"Amount": "{{amount}}{{unit}}"
|
||||
},
|
||||
@@ -224,6 +226,7 @@
|
||||
},
|
||||
"core": {
|
||||
"Chat": "对话",
|
||||
"Chat API is error or undefined": "",
|
||||
"Chat test": "测试对话",
|
||||
"Max Token": "单条数据上限",
|
||||
"Start chat": "立即对话",
|
||||
@@ -293,6 +296,8 @@
|
||||
"navbar": {
|
||||
"External": "外部使用",
|
||||
"Flow mode": "高级编排",
|
||||
"Publish": "发布",
|
||||
"Publish app": "发布应用",
|
||||
"Simple mode": "简易配置"
|
||||
},
|
||||
"outLink": {
|
||||
@@ -357,6 +362,7 @@
|
||||
"chat": {
|
||||
"Admin Mark Content": "纠正后的回复",
|
||||
"Audio Speech Error": "语音播报异常",
|
||||
"Chat API is error or undefined": "对话接口报错或返回为空",
|
||||
"Confirm to clear history": "确认清空该应用的在线聊天记录?分享和 API 调用的记录不会被清空。",
|
||||
"Confirm to clear share chat history": "确认删除所有聊天记录?",
|
||||
"Converting to text": "正在转换为文本...",
|
||||
@@ -542,8 +548,7 @@
|
||||
"success": "开始同步"
|
||||
}
|
||||
},
|
||||
"training": {
|
||||
}
|
||||
"training": {}
|
||||
},
|
||||
"data": {
|
||||
"Auxiliary Data": "辅助数据",
|
||||
@@ -564,6 +569,7 @@
|
||||
"id": "数据ID",
|
||||
"unit": "条"
|
||||
},
|
||||
"embedding model tip": "索引模型可以将自然语言转成向量,用于进行语义检索。\n注意,不同索引模型无法一起使用,选择完索引模型后将无法修改。",
|
||||
"error": {
|
||||
"Data not found": "数据不存在或已被删除",
|
||||
"Start Sync Failed": "开始同步失败",
|
||||
@@ -735,6 +741,12 @@
|
||||
"module": {
|
||||
"Add question type": "添加问题类型",
|
||||
"Data Type": "数据类型",
|
||||
"Dataset quote": {
|
||||
"Add quote": "添加引用",
|
||||
"Concat result": "合并结果",
|
||||
"Input description": "可接收知识库搜索的结果。",
|
||||
"label": "知识库引用"
|
||||
},
|
||||
"Field Description": "字段描述",
|
||||
"Field Name": "字段名",
|
||||
"Field Type": "字段类型",
|
||||
@@ -742,7 +754,7 @@
|
||||
"Input Type": "输入类型",
|
||||
"Plugin output must connect": "自定义输出必须全部连接",
|
||||
"Unlink tip": "【{{name}}】存在未填或未连接参数",
|
||||
"Variable": "参数变量",
|
||||
"Variable": "全局变量",
|
||||
"Variable Setting": "变量设置",
|
||||
"edit": {
|
||||
"Field Already Exist": "key 重复",
|
||||
@@ -764,6 +776,7 @@
|
||||
"Quote": "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
|
||||
"Response content": "可以使用 \\n 来实现连续换行。\n可以通过外部模块输入实现回复,外部模块输入时会覆盖当前填写的内容。\n如传入非字符串类型数据将会自动转成字符串",
|
||||
"TFSwitch textarea": "允许定义一些字符串来实现 false 匹配,每行一个,支持正则表达式。",
|
||||
"Trigger": "大部分时候,你不需要连接该属性。\n当你需要延迟执行,或精确控制执行时机时,可以连接该属性。",
|
||||
"anyInput": "可传入任意内容",
|
||||
"cfr background": "描述当前对话的范围,便于AI补全首次问题或模糊的问题,从而增强知识库连续对话的能力。\n为空时,表示【首次对话】不使用问题补全功能。",
|
||||
"dynamic input": "接收用户动态添加的参数,会在运行时将这些参数平铺传入",
|
||||
@@ -837,6 +850,7 @@
|
||||
"Classify question intro": "根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品“使用”问题\n类型3: 关于商品“购买”问题\n类型4: 其他问题",
|
||||
"Dataset search": "知识库搜索",
|
||||
"Dataset search intro": "调用知识库搜索能力,查找有可能与问题相关的内容",
|
||||
"Dataset search result concat intro": "可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。",
|
||||
"External module": "外部调用",
|
||||
"Extract field": "文本内容提取",
|
||||
"Extract field intro": "可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等",
|
||||
@@ -890,6 +904,9 @@
|
||||
},
|
||||
"variable add option": "添加选项"
|
||||
},
|
||||
"plugin": {
|
||||
"Get Plugin Module Detail Failed": "加载插件异常"
|
||||
},
|
||||
"shareChat": {
|
||||
"Init Error": "初始化对话框失败",
|
||||
"Init History Error": "初始化聊天记录失败"
|
||||
@@ -1127,6 +1144,7 @@
|
||||
"Cancel subscription": "取消订阅"
|
||||
},
|
||||
"user": {
|
||||
"Need to login": "请先登录",
|
||||
"Price": "计费标准",
|
||||
"auth": {
|
||||
"Sending Code": "正在发送"
|
||||
@@ -1138,28 +1156,69 @@
|
||||
},
|
||||
"team": {
|
||||
"Dataset usage": "知识库容量",
|
||||
"member": "成员",
|
||||
"subscription": {
|
||||
"type": {
|
||||
"extraDatasetSize": "知识库扩容"
|
||||
}
|
||||
}
|
||||
"member": "成员"
|
||||
}
|
||||
},
|
||||
"wallet": {
|
||||
"Balance not enough tip": "余额不足,请先到账号页充值",
|
||||
"Buy more": "扩容",
|
||||
"Confirm pay": "支付确认",
|
||||
"Pay error": "支付失败",
|
||||
"Pay success": "支付成功",
|
||||
"bill": {
|
||||
"AI Model": "AI 模型",
|
||||
"AI Type": "AI 类型",
|
||||
"Price": "价格(¥)"
|
||||
},
|
||||
"subscription": {
|
||||
"Ai points": "AI 积分计算标准",
|
||||
"Buy now": "开始使用",
|
||||
"Change will take effect after the current subscription expires": "更新成功。将会再下个订阅周期生效。",
|
||||
"Current dataset store": "当前额外容量",
|
||||
"Current plan": "当前计划",
|
||||
"Dataset store": "知识库容量",
|
||||
"Dataset store price tip": "每月1号从账号余额里扣除",
|
||||
"Expand size": "扩大容量",
|
||||
"Extra dataset size": "额外知识库容量",
|
||||
"Extra plan": "额外套餐",
|
||||
"Extra plan tip": "标准套餐不够时,您可以购买额外套餐继续使用",
|
||||
"FAQ": "常见问题",
|
||||
"Next plan": "未来计划",
|
||||
"Next sub dataset size": "下次订阅额外容量",
|
||||
"Update extra dataset size": "修改知识库额外容量"
|
||||
"Nonsupport": "无法切换",
|
||||
"Refund plan and pay confirm": "切换该套餐您无需支付额外费用,并将退换 {{amount}} 元至余额中。",
|
||||
"Standard plan pay confirm": "切换该套餐,您本次需要补充支付 {{payPrice}} 元。",
|
||||
"Standard update fail": "修改订阅套餐异常",
|
||||
"Standard update success": "变更订阅套餐成功!",
|
||||
"Sub plan": "订阅套餐",
|
||||
"Sub plan tip": "免费使用 FastGPT 或升级更高的套餐",
|
||||
"Training weight": "训练优先级: {{weight}}",
|
||||
"Update extra dataset size": "调整知识库额外容量",
|
||||
"function": {
|
||||
"History store": "{{amount}} 天对话记录保留",
|
||||
"Max app": "{{amount}} 个应用与插件",
|
||||
"Max dataset": "{{amount}} 个知识库",
|
||||
"Max dataset size": "{{amount}} 组知识库数据",
|
||||
"Max members": "{{amount}} 个团队成员",
|
||||
"Points": "{{amount}}万AI积分"
|
||||
},
|
||||
"mode": {
|
||||
"Month": "按月",
|
||||
"Year": "按年",
|
||||
"Year sale": "赠送两个月"
|
||||
},
|
||||
"standardSubLevel": {
|
||||
"enterprise": "企业版",
|
||||
"experience": "体验版",
|
||||
"experience desc": "可使用 {{title}} 的完整功能",
|
||||
"free": "免费版",
|
||||
"free desc": "每月均可免费使用 {{title}} 的基础功能",
|
||||
"team": "团队版"
|
||||
},
|
||||
"type": {
|
||||
"extraDatasetSize": "知识库扩容",
|
||||
"standard": "套餐订阅"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ import { throttle } from 'lodash';
|
||||
import type { ExportChatType } from '@/types/chat.d';
|
||||
import type { ChatItemType, ChatSiteItemType } from '@fastgpt/global/core/chat/type.d';
|
||||
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type.d';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useCopyData } from '@/web/common/hooks/useCopyData';
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
Textarea,
|
||||
Checkbox
|
||||
} from '@chakra-ui/react';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
||||
import { adaptChat2GptMessages } from '@fastgpt/global/core/chat/adapt';
|
||||
import { useMarkdown } from '@/web/common/hooks/useMarkdown';
|
||||
@@ -159,7 +158,7 @@ const ChatBox = (
|
||||
const router = useRouter();
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const { isPc, setLoading } = useSystemStore();
|
||||
const { isPc, setLoading, feConfigs } = useSystemStore();
|
||||
const TextareaDom = useRef<HTMLTextAreaElement>(null);
|
||||
const chatController = useRef(new AbortController());
|
||||
const questionGuideController = useRef(new AbortController());
|
||||
@@ -519,7 +518,13 @@ const ChatBox = (
|
||||
chatHistory.length === 0 &&
|
||||
!variableModules?.length &&
|
||||
!welcomeText,
|
||||
[chatHistory.length, showEmptyIntro, variableModules, welcomeText]
|
||||
[
|
||||
chatHistory.length,
|
||||
feConfigs?.show_emptyChat,
|
||||
showEmptyIntro,
|
||||
variableModules?.length,
|
||||
welcomeText
|
||||
]
|
||||
);
|
||||
const statusBoxData = useMemo(() => {
|
||||
const colorMap = {
|
||||
@@ -954,7 +959,6 @@ const ChatBox = (
|
||||
setAdminMarkData={(e) => setAdminMarkData({ ...e, chatItemId: adminMarkData.chatItemId })}
|
||||
onClose={() => setAdminMarkData(undefined)}
|
||||
onSuccess={(adminFeedback) => {
|
||||
console.log(adminMarkData);
|
||||
if (!appId || !chatId || !adminMarkData.chatItemId) return;
|
||||
updateChatAdminFeedback({
|
||||
appId,
|
||||
@@ -1108,6 +1112,7 @@ const VariableInput = React.memo(function VariableInput({
|
||||
}>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const { register, setValue, handleSubmit: handleSubmitChat, watch } = chatForm;
|
||||
const variables = watch('variables');
|
||||
|
||||
@@ -1168,6 +1173,7 @@ const VariableInput = React.memo(function VariableInput({
|
||||
value={variables[item.key]}
|
||||
onchange={(e) => {
|
||||
setValue(`variables.${item.key}`, e);
|
||||
setRefresh((state) => !state);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -3,10 +3,12 @@ import { Button, ModalFooter, ModalBody } from '@chakra-ui/react';
|
||||
import MyModal from '../MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Markdown from '../Markdown';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const CommunityModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const { t } = useTranslation();
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useRouter } from 'next/router';
|
||||
import { useToast } from '@chakra-ui/react';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
||||
const unAuthPage: { [key: string]: boolean } = {
|
||||
'/': true,
|
||||
@@ -10,16 +11,14 @@ const unAuthPage: { [key: string]: boolean } = {
|
||||
'/login/fastlogin': true,
|
||||
'/appStore': true,
|
||||
'/chat/share': true,
|
||||
'/tools/price': true
|
||||
'/tools/price': true,
|
||||
'/price': true
|
||||
};
|
||||
|
||||
const Auth = ({ children }: { children: JSX.Element }) => {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const toast = useToast({
|
||||
title: '请先登录',
|
||||
position: 'top',
|
||||
status: 'warning'
|
||||
});
|
||||
const { toast } = useToast();
|
||||
const { userInfo, initUserInfo } = useUserStore();
|
||||
|
||||
useQuery(
|
||||
@@ -37,12 +36,15 @@ const Auth = ({ children }: { children: JSX.Element }) => {
|
||||
router.replace(
|
||||
`/login?lastRoute=${encodeURIComponent(location.pathname + location.search)}`
|
||||
);
|
||||
toast();
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: t('support.user.Need to login')
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return userInfo || unAuthPage[router.pathname] === true ? children : null;
|
||||
return !!userInfo || unAuthPage[router.pathname] === true ? children : null;
|
||||
};
|
||||
|
||||
export default Auth;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { throttle } from 'lodash';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { getUnreadCount } from '@/web/support/user/inform/api';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
import Auth from './auth';
|
||||
@@ -26,7 +25,8 @@ const pcUnShowLayoutRoute: Record<string, boolean> = {
|
||||
'/chat/share': true,
|
||||
'/app/edit': true,
|
||||
'/chat': true,
|
||||
'/tools/price': true
|
||||
'/tools/price': true,
|
||||
'/price': true
|
||||
};
|
||||
const phoneUnShowLayoutRoute: Record<string, boolean> = {
|
||||
'/': true,
|
||||
@@ -34,14 +34,15 @@ const phoneUnShowLayoutRoute: Record<string, boolean> = {
|
||||
'/login/provider': true,
|
||||
'/login/fastlogin': true,
|
||||
'/chat/share': true,
|
||||
'/tools/price': true
|
||||
'/tools/price': true,
|
||||
'/price': true
|
||||
};
|
||||
|
||||
const Layout = ({ children }: { children: JSX.Element }) => {
|
||||
const router = useRouter();
|
||||
const { colorMode, setColorMode } = useColorMode();
|
||||
const { Loading } = useLoading();
|
||||
const { loading, setScreenWidth, isPc } = useSystemStore();
|
||||
const { loading, setScreenWidth, isPc, feConfigs } = useSystemStore();
|
||||
const { userInfo } = useUserStore();
|
||||
|
||||
const isChatPage = useMemo(
|
||||
@@ -74,12 +75,14 @@ const Layout = ({ children }: { children: JSX.Element }) => {
|
||||
refetchInterval: 10000
|
||||
});
|
||||
|
||||
const isHideNavbar = !!pcUnShowLayoutRoute[router.pathname];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box h={'100%'} bg={'myGray.100'}>
|
||||
{isPc === true && (
|
||||
<>
|
||||
{pcUnShowLayoutRoute[router.pathname] ? (
|
||||
{isHideNavbar ? (
|
||||
<Auth>{children}</Auth>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useRouter } from 'next/router';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useChatStore } from '@/web/core/chat/storeChat';
|
||||
import { HUMAN_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import NextLink from 'next/link';
|
||||
import Badge from '../Badge';
|
||||
import Avatar from '../Avatar';
|
||||
@@ -23,7 +22,7 @@ const Navbar = ({ unread }: { unread: number }) => {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const { userInfo } = useUserStore();
|
||||
const { gitStar } = useSystemStore();
|
||||
const { gitStar, feConfigs } = useSystemStore();
|
||||
const { lastChatAppId, lastChatId } = useChatStore();
|
||||
const navbarList = useMemo(
|
||||
() => [
|
||||
@@ -159,7 +158,7 @@ const Navbar = ({ unread }: { unread: number }) => {
|
||||
color={'myGray.500'}
|
||||
>
|
||||
<Badge count={unread}>
|
||||
<MyIcon name={'inform'} width={'22px'} height={'22px'} />
|
||||
<MyIcon name={'support/user/informLight'} width={'22px'} height={'22px'} />
|
||||
</Badge>
|
||||
</Link>
|
||||
</Box>
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
import React from 'react';
|
||||
import { Menu, MenuList, MenuItem } from '@chakra-ui/react';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { Menu, MenuList, MenuItem, Box, useOutsideClick, MenuButton } from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
|
||||
interface Props {
|
||||
width: number;
|
||||
width?: number | string;
|
||||
offset?: [number, number];
|
||||
Button: React.ReactNode;
|
||||
trigger?: 'hover' | 'click';
|
||||
menuList: {
|
||||
isActive?: boolean;
|
||||
child: React.ReactNode;
|
||||
label: string | React.ReactNode;
|
||||
icon?: string;
|
||||
onClick: () => any;
|
||||
}[];
|
||||
}
|
||||
|
||||
const MyMenu = ({ width, offset = [0, 10], Button, menuList }: Props) => {
|
||||
const MyMenu = ({
|
||||
width = 'auto',
|
||||
trigger = 'hover',
|
||||
offset = [0, 5],
|
||||
Button,
|
||||
menuList
|
||||
}: Props) => {
|
||||
const menuItemStyles = {
|
||||
borderRadius: 'sm',
|
||||
py: 3,
|
||||
@@ -23,31 +32,80 @@ const MyMenu = ({ width, offset = [0, 10], Button, menuList }: Props) => {
|
||||
color: 'primary.600'
|
||||
}
|
||||
};
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const closeTimer = useRef<any>();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
useOutsideClick({
|
||||
ref: ref,
|
||||
handler: () => {
|
||||
setIsOpen(false);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Menu offset={offset} autoSelect={false} isLazy>
|
||||
{Button}
|
||||
<MenuList
|
||||
minW={`${width}px !important`}
|
||||
p={'6px'}
|
||||
border={'1px solid #fff'}
|
||||
boxShadow={'0px 2px 4px rgba(161, 167, 179, 0.25), 0px 0px 1px rgba(121, 141, 159, 0.25);'}
|
||||
<Menu offset={offset} isOpen={isOpen} autoSelect={false} direction={'ltr'} isLazy>
|
||||
<Box
|
||||
ref={ref}
|
||||
onMouseEnter={() => {
|
||||
if (trigger === 'hover') {
|
||||
setIsOpen(true);
|
||||
}
|
||||
clearTimeout(closeTimer.current);
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
if (trigger === 'hover') {
|
||||
closeTimer.current = setTimeout(() => {
|
||||
setIsOpen(false);
|
||||
}, 100);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{menuList.map((item, i) => (
|
||||
<MenuItem
|
||||
key={i}
|
||||
{...menuItemStyles}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
item.onClick && item.onClick();
|
||||
}}
|
||||
color={item.isActive ? 'primary.700' : 'myGray.600'}
|
||||
whiteSpace={'pre-wrap'}
|
||||
>
|
||||
{item.child}
|
||||
</MenuItem>
|
||||
))}
|
||||
</MenuList>
|
||||
<Box
|
||||
position={'relative'}
|
||||
onClickCapture={() => {
|
||||
if (trigger === 'click') {
|
||||
setIsOpen(!isOpen);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<MenuButton
|
||||
w={'100%'}
|
||||
h={'100%'}
|
||||
position={'absolute'}
|
||||
top={0}
|
||||
right={0}
|
||||
bottom={0}
|
||||
left={0}
|
||||
/>
|
||||
<Box position={'relative'}>{Button}</Box>
|
||||
</Box>
|
||||
<MenuList
|
||||
minW={isOpen ? `${width}px !important` : 0}
|
||||
p={'6px'}
|
||||
border={'1px solid #fff'}
|
||||
boxShadow={
|
||||
'0px 2px 4px rgba(161, 167, 179, 0.25), 0px 0px 1px rgba(121, 141, 159, 0.25);'
|
||||
}
|
||||
>
|
||||
{menuList.map((item, i) => (
|
||||
<MenuItem
|
||||
key={i}
|
||||
{...menuItemStyles}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setIsOpen(false);
|
||||
item.onClick && item.onClick();
|
||||
}}
|
||||
color={item.isActive ? 'primary.700' : 'myGray.600'}
|
||||
whiteSpace={'pre-wrap'}
|
||||
>
|
||||
{!!item.icon && <MyIcon name={item.icon as any} w={'16px'} mr={2} />}
|
||||
{item.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</MenuList>
|
||||
</Box>
|
||||
</Menu>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,11 +4,13 @@ import MySelect, { type SelectProps } from './index';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useDisclosure } from '@chakra-ui/react';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const PriceBox = dynamic(() => import('@/components/support/wallet/Price'));
|
||||
|
||||
const SelectAiModel = ({ list, ...props }: SelectProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { feConfigs } = useSystemStore();
|
||||
const expandList = useMemo(() => {
|
||||
return feConfigs.show_pay
|
||||
? list.concat({
|
||||
@@ -16,7 +18,7 @@ const SelectAiModel = ({ list, ...props }: SelectProps) => {
|
||||
value: 'price'
|
||||
})
|
||||
: list;
|
||||
}, [list, t]);
|
||||
}, [feConfigs.show_pay, list, t]);
|
||||
|
||||
const {
|
||||
isOpen: isOpenPriceBox,
|
||||
|
||||
@@ -42,63 +42,76 @@ const MySlider = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Slider
|
||||
max={max}
|
||||
min={min}
|
||||
step={step}
|
||||
size={'lg'}
|
||||
value={value}
|
||||
width={width}
|
||||
onChange={onChange}
|
||||
>
|
||||
{markList?.map((item, i) => (
|
||||
<SliderMark
|
||||
key={item.value}
|
||||
value={item.value}
|
||||
fontSize={'sm'}
|
||||
mt={3}
|
||||
whiteSpace={'nowrap'}
|
||||
transform={'translateX(-50%)'}
|
||||
color={'myGray.600'}
|
||||
>
|
||||
<Box px={3} cursor={'pointer'}>
|
||||
{item.label}
|
||||
</Box>
|
||||
</SliderMark>
|
||||
))}
|
||||
<SliderMark
|
||||
<Box pb={4} zIndex={10}>
|
||||
<Slider
|
||||
max={max}
|
||||
min={min}
|
||||
step={step}
|
||||
size={'lg'}
|
||||
value={value}
|
||||
textAlign="center"
|
||||
bg="primary.500"
|
||||
color="white"
|
||||
px={1}
|
||||
minW={'18px'}
|
||||
w={'auto'}
|
||||
h={'18px'}
|
||||
lineHeight={'18px'}
|
||||
borderRadius={'18px'}
|
||||
transform={'translate(-50%, -155%)'}
|
||||
fontSize={'11px'}
|
||||
>
|
||||
<Box transform={'scale(0.9)'}>{value}</Box>
|
||||
</SliderMark>
|
||||
<SliderTrack
|
||||
bg={'#EAEDF3'}
|
||||
overflow={'visible'}
|
||||
h={'4px'}
|
||||
_before={{
|
||||
...startEndPointStyle,
|
||||
left: '-3px'
|
||||
width={width}
|
||||
onChange={onChange}
|
||||
_hover={{
|
||||
'& .marker': {
|
||||
display: 'block'
|
||||
}
|
||||
}}
|
||||
_after={{
|
||||
...startEndPointStyle,
|
||||
right: '-3px'
|
||||
_active={{
|
||||
'& .marker': {
|
||||
display: 'block'
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SliderFilledTrack bg={'primary.500'} />
|
||||
</SliderTrack>
|
||||
<SliderThumb border={'3px solid'} borderColor={'primary.500'}></SliderThumb>
|
||||
</Slider>
|
||||
{markList?.map((item, i) => (
|
||||
<SliderMark
|
||||
key={item.value}
|
||||
value={item.value}
|
||||
fontSize={'sm'}
|
||||
mt={2}
|
||||
whiteSpace={'nowrap'}
|
||||
transform={'translateX(-50%)'}
|
||||
color={'myGray.600'}
|
||||
>
|
||||
<Box px={3} cursor={'pointer'}>
|
||||
{item.label}
|
||||
</Box>
|
||||
</SliderMark>
|
||||
))}
|
||||
<SliderMark
|
||||
className="marker"
|
||||
value={value}
|
||||
textAlign="center"
|
||||
bg="primary.500"
|
||||
color="white"
|
||||
px={1}
|
||||
minW={'20px'}
|
||||
w={'auto'}
|
||||
py={'1px'}
|
||||
borderRadius={'md'}
|
||||
transform={'translate(-50%, -155%)'}
|
||||
fontSize={'11px'}
|
||||
display={'none'}
|
||||
>
|
||||
<Box transform={'scale(0.9)'}>{value}</Box>
|
||||
</SliderMark>
|
||||
<SliderTrack
|
||||
bg={'#EAEDF3'}
|
||||
overflow={'visible'}
|
||||
h={'4px'}
|
||||
_before={{
|
||||
...startEndPointStyle,
|
||||
left: '-3px'
|
||||
}}
|
||||
_after={{
|
||||
...startEndPointStyle,
|
||||
right: '-3px'
|
||||
}}
|
||||
>
|
||||
<SliderFilledTrack bg={'primary.500'} />
|
||||
</SliderTrack>
|
||||
<SliderThumb border={'3px solid'} borderColor={'primary.500'}></SliderThumb>
|
||||
</Slider>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
TagLabel,
|
||||
useTheme
|
||||
} from '@chakra-ui/react';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
type Props = BoxProps & { defaultValues: string[]; onUpdate: (e: string[]) => void };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box, BoxProps, Image } from '@chakra-ui/react';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
@@ -7,17 +7,15 @@ import {
|
||||
BoxProps,
|
||||
Button,
|
||||
Flex,
|
||||
Image,
|
||||
Link,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
Switch,
|
||||
Textarea
|
||||
Switch
|
||||
} from '@chakra-ui/react';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { Prompt_QuotePromptList, Prompt_QuoteTemplateList } from '@/global/core/prompt/AIChat';
|
||||
import { chatModelList, feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MySlider from '@/components/Slider';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import dynamic from 'next/dynamic';
|
||||
@@ -27,7 +25,7 @@ import type { AppSimpleEditConfigTemplateType } from '@fastgpt/global/core/app/t
|
||||
import { SimpleModeTemplate_FastGPT_Universal } from '@/global/core/app/constants';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
|
||||
import { PickerMenuItemType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
||||
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
||||
|
||||
const PromptTemplate = dynamic(() => import('@/components/PromptTemplate'));
|
||||
|
||||
@@ -44,14 +42,17 @@ const AIChatSettingsModal = ({
|
||||
onSuccess: (e: AIChatModuleProps) => void;
|
||||
defaultData: AIChatModuleProps;
|
||||
simpleModeTemplate?: AppSimpleEditConfigTemplateType;
|
||||
pickerMenu?: PickerMenuItemType[];
|
||||
pickerMenu?: EditorVariablePickerType[];
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const { feConfigs, llmModelList } = useSystemStore();
|
||||
|
||||
const { register, handleSubmit, getValues, setValue } = useForm({
|
||||
const { handleSubmit, getValues, setValue, watch } = useForm({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
const aiChatQuoteTemplate = watch(ModuleInputKeyEnum.aiChatQuoteTemplate);
|
||||
const aiChatQuotePrompt = watch(ModuleInputKeyEnum.aiChatQuotePrompt);
|
||||
|
||||
const [selectTemplateData, setSelectTemplateData] = useState<{
|
||||
title: string;
|
||||
@@ -60,10 +61,10 @@ const AIChatSettingsModal = ({
|
||||
|
||||
const tokenLimit = useMemo(() => {
|
||||
return (
|
||||
chatModelList.find((item) => item.model === getValues(ModuleInputKeyEnum.aiModel))
|
||||
llmModelList.find((item) => item.model === getValues(ModuleInputKeyEnum.aiModel))
|
||||
?.maxResponse || 4000
|
||||
);
|
||||
}, [getValues]);
|
||||
}, [getValues, llmModelList]);
|
||||
|
||||
const quoteTemplateVariables = (() => [
|
||||
{
|
||||
@@ -160,7 +161,7 @@ const AIChatSettingsModal = ({
|
||||
</Flex>
|
||||
)}
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.temperature && (
|
||||
<Flex alignItems={'center'} mb={10} mt={isAdEdit ? 8 : 5}>
|
||||
<Flex mb={10} mt={isAdEdit ? 8 : 6}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
{t('core.app.Temperature')}
|
||||
</Box>
|
||||
@@ -183,7 +184,7 @@ const AIChatSettingsModal = ({
|
||||
</Flex>
|
||||
)}
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.maxToken && (
|
||||
<Flex alignItems={'center'} mt={12} mb={10}>
|
||||
<Flex mt={5} mb={5}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
{t('core.app.Max tokens')}
|
||||
</Box>
|
||||
@@ -239,10 +240,10 @@ const AIChatSettingsModal = ({
|
||||
placeholder={t('template.Quote Content Tip', {
|
||||
default: Prompt_QuoteTemplateList[0].value
|
||||
})}
|
||||
defaultValue={getValues(ModuleInputKeyEnum.aiChatQuoteTemplate)}
|
||||
value={aiChatQuoteTemplate}
|
||||
onChange={(e) => {
|
||||
setValue(ModuleInputKeyEnum.aiChatQuoteTemplate, e);
|
||||
setRefresh(!refresh);
|
||||
// setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
@@ -265,7 +266,7 @@ const AIChatSettingsModal = ({
|
||||
placeholder={t('template.Quote Prompt Tip', {
|
||||
default: Prompt_QuotePromptList[0].value
|
||||
})}
|
||||
defaultValue={getValues(ModuleInputKeyEnum.aiChatQuotePrompt)}
|
||||
value={aiChatQuotePrompt}
|
||||
onChange={(e) => {
|
||||
setValue(ModuleInputKeyEnum.aiChatQuotePrompt, e);
|
||||
}}
|
||||
|
||||
@@ -17,7 +17,7 @@ import MyTooltip from '@/components/MyTooltip';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { reRankModelList } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { DatasetSearchModeMap } from '@fastgpt/global/core/dataset/constants';
|
||||
@@ -45,6 +45,7 @@ const DatasetParamsModal = ({
|
||||
}: DatasetParamsProps & { onClose: () => void; onSuccess: (e: DatasetParamsProps) => void }) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const { reRankModelList } = useSystemStore();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const { register, setValue, getValues, handleSubmit } = useForm<DatasetParamsProps>({
|
||||
defaultValues: {
|
||||
@@ -72,7 +73,7 @@ const DatasetParamsModal = ({
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}, [getValues, similarity, refresh]);
|
||||
}, [getValues, similarity]);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
@@ -135,7 +136,7 @@ const DatasetParamsModal = ({
|
||||
)}
|
||||
|
||||
{limit !== undefined && (
|
||||
<Box display={['block', 'flex']} py={8} mt={3}>
|
||||
<Box display={['block', 'flex']} mt={5}>
|
||||
<Box flex={'0 0 120px'} mb={[8, 0]}>
|
||||
{t('core.dataset.search.Max Tokens')}
|
||||
<MyTooltip label={t('core.dataset.search.Max Tokens Tips')} forceShow>
|
||||
@@ -151,9 +152,9 @@ const DatasetParamsModal = ({
|
||||
min={100}
|
||||
max={maxTokens}
|
||||
step={50}
|
||||
value={getValues(ModuleInputKeyEnum.datasetLimit) ?? 1000}
|
||||
value={getValues(ModuleInputKeyEnum.datasetMaxTokens) ?? 1000}
|
||||
onChange={(val) => {
|
||||
setValue(ModuleInputKeyEnum.datasetLimit, val);
|
||||
setValue(ModuleInputKeyEnum.datasetMaxTokens, val);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
@@ -161,7 +162,7 @@ const DatasetParamsModal = ({
|
||||
</Box>
|
||||
)}
|
||||
{showSimilarity && (
|
||||
<Box display={['block', 'flex']} py={8}>
|
||||
<Box display={['block', 'flex']} mt={5}>
|
||||
<Box flex={'0 0 120px'} mb={[8, 0]}>
|
||||
{t('core.dataset.search.Min Similarity')}
|
||||
<MyTooltip label={t('core.dataset.search.Min Similarity Tips')} forceShow>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import type { SelectedDatasetType } from '@fastgpt/global/core/module/api.d';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
|
||||
@@ -66,7 +66,7 @@ const ChatTest = (
|
||||
appName: `调试-${app.name}`
|
||||
},
|
||||
onMessage: generatingMessage,
|
||||
abortSignal: controller
|
||||
abortCtrl: controller
|
||||
});
|
||||
|
||||
return { responseText, responseData };
|
||||
|
||||
@@ -24,7 +24,7 @@ import React, {
|
||||
} from 'react';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import { appModule2FlowEdge, appModule2FlowNode } from '@/utils/adapt';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { EDGE_TYPE, FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
||||
import { Textarea, Button, ModalBody, ModalFooter } from '@chakra-ui/react';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useFlowProviderStore } from './FlowProvider';
|
||||
|
||||
type Props = {
|
||||
|
||||
@@ -15,7 +15,7 @@ const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import EmptyTip from '@/components/EmptyTip';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { moduleTemplatesList } from '@/web/core/modules/template/system';
|
||||
|
||||
@@ -100,6 +100,7 @@ const RenderList = React.memo(function RenderList({ templates, onClose }: Render
|
||||
if (template.flowType === FlowNodeTypeEnum.pluginModule) {
|
||||
setLoading(true);
|
||||
const res = await getPreviewPluginModule(template.id);
|
||||
|
||||
setLoading(false);
|
||||
return res;
|
||||
}
|
||||
@@ -107,7 +108,7 @@ const RenderList = React.memo(function RenderList({ templates, onClose }: Render
|
||||
} catch (e) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: getErrText(e, t('plugin.Get Plugin Module Detail Failed'))
|
||||
title: getErrText(e, t('core.plugin.Get Plugin Module Detail Failed'))
|
||||
});
|
||||
setLoading(false);
|
||||
return Promise.reject(e);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { BezierEdge, getBezierPath, EdgeLabelRenderer, EdgeProps } from 'reactflow';
|
||||
import { onDelConnect } from '../../FlowProvider';
|
||||
import { onDelConnect, useFlowProviderStore } from '../../FlowProvider';
|
||||
import { Flex } from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
|
||||
const ButtonEdge = (props: EdgeProps) => {
|
||||
const { nodes } = useFlowProviderStore();
|
||||
const {
|
||||
id,
|
||||
sourceX,
|
||||
@@ -17,6 +18,13 @@ const ButtonEdge = (props: EdgeProps) => {
|
||||
style = {}
|
||||
} = props;
|
||||
|
||||
const active = (() => {
|
||||
const connectNode = nodes.find((node) => {
|
||||
return (node.id === props.source || node.id === props.target) && node.selected;
|
||||
});
|
||||
return !!(connectNode || selected);
|
||||
})();
|
||||
|
||||
const [, labelX, labelY] = getBezierPath({
|
||||
sourceX,
|
||||
sourceY,
|
||||
@@ -41,8 +49,9 @@ const ButtonEdge = (props: EdgeProps) => {
|
||||
borderRadius={'20px'}
|
||||
color={'black'}
|
||||
cursor={'pointer'}
|
||||
border={'1px solid #fff'}
|
||||
zIndex={selected ? 1000 : 0}
|
||||
borderWidth={'1px'}
|
||||
borderColor={'borderColor.low'}
|
||||
zIndex={active ? 1000 : 0}
|
||||
_hover={{
|
||||
boxShadow: '0 0 6px 2px rgba(0, 0, 0, 0.08)'
|
||||
}}
|
||||
@@ -51,26 +60,43 @@ const ButtonEdge = (props: EdgeProps) => {
|
||||
<MyIcon
|
||||
name="closeSolid"
|
||||
w={'100%'}
|
||||
color={selected ? 'primary.700' : 'myGray.500'}
|
||||
color={active ? 'primary.800' : 'myGray.400'}
|
||||
></MyIcon>
|
||||
</Flex>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
justifyContent={'center'}
|
||||
position={'absolute'}
|
||||
transform={`translate(-78%, -50%) translate(${targetX}px,${targetY}px)`}
|
||||
pointerEvents={'all'}
|
||||
w={'16px'}
|
||||
h={'16px'}
|
||||
bg={'white'}
|
||||
zIndex={active ? 1000 : 0}
|
||||
>
|
||||
<MyIcon
|
||||
name={'common/rightArrowLight'}
|
||||
w={'100%'}
|
||||
color={active ? 'primary.800' : 'myGray.400'}
|
||||
></MyIcon>
|
||||
</Flex>
|
||||
</EdgeLabelRenderer>
|
||||
);
|
||||
}, [id, labelX, labelY, selected]);
|
||||
}, [id, labelX, labelY, active, targetX, targetY]);
|
||||
|
||||
const memoBezierEdge = useMemo(() => {
|
||||
const edgeStyle: React.CSSProperties = {
|
||||
...style,
|
||||
...(selected
|
||||
...(active
|
||||
? {
|
||||
strokeWidth: 4,
|
||||
strokeWidth: 5,
|
||||
stroke: '#3370ff'
|
||||
}
|
||||
: { strokeWidth: 2, stroke: '#BDC1C5' })
|
||||
: { strokeWidth: 2, zIndex: 2, stroke: 'myGray.300' })
|
||||
};
|
||||
|
||||
return <BezierEdge {...props} style={edgeStyle} />;
|
||||
}, [props, selected, style]);
|
||||
}, [props, active, style]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -2,19 +2,22 @@ import React from 'react';
|
||||
import { Box, useTheme } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const Divider = ({ text }: { text: 'Input' | 'Output' | string }) => {
|
||||
const Divider = ({ text }: { text?: 'Input' | 'Output' | string }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const isDivider = !text;
|
||||
|
||||
return (
|
||||
<Box
|
||||
textAlign={'center'}
|
||||
bg={'#f8f8f8'}
|
||||
py={2}
|
||||
py={isDivider ? '0' : 2}
|
||||
borderTop={theme.borders.base}
|
||||
borderBottom={theme.borders.base}
|
||||
fontSize={'lg'}
|
||||
>
|
||||
{t(`common.${text}`)}
|
||||
{text ? t(`common.${text}`) : ''}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import MySelect from '@/components/Select';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d';
|
||||
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||
import { audioSpeechModelList } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import MySlider from '@/components/Slider';
|
||||
|
||||
@@ -20,6 +20,7 @@ const TTSSelect = ({
|
||||
onChange: (e: AppTTSConfigType) => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { audioSpeechModelList } = useSystemStore();
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
|
||||
const list = useMemo(
|
||||
@@ -28,7 +29,7 @@ const TTSSelect = ({
|
||||
{ label: t('core.app.tts.Web'), value: TTSTypeEnum.web },
|
||||
...audioSpeechModelList.map((item) => item?.voices || []).flat()
|
||||
],
|
||||
[t]
|
||||
[audioSpeechModelList, t]
|
||||
);
|
||||
|
||||
const formatValue = useMemo(() => {
|
||||
@@ -106,7 +107,7 @@ const TTSSelect = ({
|
||||
{t('core.app.tts.Speech model')}
|
||||
<MySelect w={'220px'} value={formatValue} list={list} onchange={onclickChange} />
|
||||
</Flex>
|
||||
<Flex mt={8} justifyContent={'space-between'} alignItems={'center'}>
|
||||
<Flex mt={8} justifyContent={'space-between'}>
|
||||
{t('core.app.tts.Speech speed')}
|
||||
<MySlider
|
||||
markList={[
|
||||
|
||||
@@ -36,9 +36,9 @@ import MyModal from '@/components/MyModal';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { variableTip } from '@fastgpt/global/core/module/template/tip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import MyRadio from '@/components/common/MyRadio';
|
||||
import { formatVariablesIcon } from '@fastgpt/global/core/module/utils';
|
||||
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/module/utils';
|
||||
|
||||
const VariableEdit = ({
|
||||
variables,
|
||||
@@ -102,7 +102,14 @@ const VariableEdit = ({
|
||||
};
|
||||
|
||||
const formatVariables = useMemo(() => {
|
||||
return formatVariablesIcon(variables);
|
||||
const results = formatEditorVariablePickerIcon(variables);
|
||||
return results.map((item) => {
|
||||
const variable = variables.find((variable) => variable.key === item.key);
|
||||
return {
|
||||
...variable,
|
||||
icon: item.icon
|
||||
};
|
||||
});
|
||||
}, [variables]);
|
||||
|
||||
return (
|
||||
@@ -111,7 +118,7 @@ const VariableEdit = ({
|
||||
<MyIcon name={'core/app/simpleMode/variable'} w={'20px'} />
|
||||
<Box ml={2} flex={1}>
|
||||
{t('core.module.Variable')}
|
||||
<MyTooltip label={variableTip} forceShow>
|
||||
<MyTooltip label={t(variableTip)} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
</Box>
|
||||
|
||||
@@ -6,17 +6,16 @@ import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
const NodeAnswer = React.memo(function NodeAnswer({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeAnswer = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'400px'} {...data}>
|
||||
<NodeCard minW={'400px'} selected={selected} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'}>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeAnswer data={data} />;
|
||||
}
|
||||
};
|
||||
export default React.memo(NodeAnswer);
|
||||
|
||||
@@ -17,12 +17,12 @@ import SourceHandle from '../render/SourceHandle';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
|
||||
const NodeCQNode = React.memo(function NodeCQNode({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeCQNode = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
const { moduleId, inputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'400px'} {...data}>
|
||||
<NodeCard minW={'400px'} selected={selected} {...data}>
|
||||
<Divider text="Input" />
|
||||
<Container>
|
||||
<RenderInput
|
||||
@@ -136,7 +136,5 @@ const NodeCQNode = React.memo(function NodeCQNode({ data }: { data: FlowModuleIt
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeCQNode data={data} />;
|
||||
}
|
||||
};
|
||||
export default React.memo(NodeCQNode);
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../render/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import { Box, Button, Flex } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { AddIcon } from '@chakra-ui/icons';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum
|
||||
} from '@fastgpt/global/core/module/constants';
|
||||
import { getOneQuoteInputTemplate } from '@fastgpt/global/core/module/template/system/datasetConcat';
|
||||
import { onChangeNode, useFlowProviderStore } from '../../FlowProvider';
|
||||
import TargetHandle from '../render/TargetHandle';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import SourceHandle from '../render/SourceHandle';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MySlider from '@/components/Slider';
|
||||
|
||||
const NodeDatasetConcat = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
const { llmModelList } = useSystemStore();
|
||||
const { nodes } = useFlowProviderStore();
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
const quotes = inputs.filter((item) => item.valueType === ModuleIOValueTypeEnum.datasetQuote);
|
||||
|
||||
const tokenLimit = useMemo(() => {
|
||||
let maxTokens = 3000;
|
||||
|
||||
nodes.forEach((item) => {
|
||||
if (item.type === FlowNodeTypeEnum.chatNode) {
|
||||
const model =
|
||||
item.data.inputs.find((item) => item.key === ModuleInputKeyEnum.aiModel)?.value || '';
|
||||
const quoteMaxToken =
|
||||
llmModelList.find((item) => item.model === model)?.quoteMaxToken || 3000;
|
||||
|
||||
maxTokens = Math.max(maxTokens, quoteMaxToken);
|
||||
}
|
||||
});
|
||||
|
||||
return maxTokens;
|
||||
}, [llmModelList, nodes]);
|
||||
|
||||
const RenderQuoteList = useMemo(
|
||||
() => (
|
||||
<Box>
|
||||
<Box>
|
||||
{quotes.map((quote, i) => (
|
||||
<Flex key={quote.key} position={'relative'} mb={4} alignItems={'center'}>
|
||||
<TargetHandle handleKey={quote.key} valueType={quote.valueType} />
|
||||
<Box>
|
||||
{t('core.chat.Quote')}
|
||||
{i + 1}
|
||||
</Box>
|
||||
<MyIcon
|
||||
ml={2}
|
||||
w={'14px'}
|
||||
name={'delete'}
|
||||
cursor={'pointer'}
|
||||
_hover={{ color: 'red.600' }}
|
||||
onClick={() => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'delInput',
|
||||
key: quote.key
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
))}
|
||||
</Box>
|
||||
<Button
|
||||
leftIcon={<AddIcon />}
|
||||
variant={'whiteBase'}
|
||||
onClick={() => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addInput',
|
||||
value: getOneQuoteInputTemplate()
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('core.module.Dataset quote.Add quote')}
|
||||
</Button>
|
||||
</Box>
|
||||
),
|
||||
[moduleId, quotes, t]
|
||||
);
|
||||
|
||||
return (
|
||||
<NodeCard minW={'400px'} selected={selected} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'} position={'relative'}>
|
||||
<RenderInput
|
||||
moduleId={moduleId}
|
||||
flowInputList={inputs}
|
||||
CustomComponent={{
|
||||
[ModuleInputKeyEnum.datasetMaxTokens]: (item) => (
|
||||
<Box px={2}>
|
||||
<MySlider
|
||||
markList={[
|
||||
{ label: '100', value: 100 },
|
||||
{ label: tokenLimit, value: tokenLimit }
|
||||
]}
|
||||
width={'100%'}
|
||||
min={100}
|
||||
max={tokenLimit}
|
||||
step={50}
|
||||
value={item.value}
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: item.key,
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
{/* render dataset select */}
|
||||
{RenderQuoteList}
|
||||
<Flex position={'absolute'} right={4} top={'50%'} transform={'translate(0,-50%)'}>
|
||||
<Box>{t('core.module.Dataset quote.Concat result')}</Box>
|
||||
<SourceHandle
|
||||
handleKey={ModuleOutputKeyEnum.datasetQuoteQA}
|
||||
valueType={ModuleIOValueTypeEnum.datasetQuote}
|
||||
// transform={'translate(-14px, -50%)'}
|
||||
/>
|
||||
</Flex>
|
||||
{/* <RenderOutput moduleId={moduleId} flowOutputList={outputs} /> */}
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
export default React.memo(NodeDatasetConcat);
|
||||
@@ -3,10 +3,8 @@ import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../render/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
|
||||
const NodeAnswer = React.memo(function NodeAnswer({ data }: { data: FlowModuleItemType }) {
|
||||
return <NodeCard {...data}></NodeCard>;
|
||||
});
|
||||
const NodeEmpty = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
return <NodeCard selected={selected} {...data}></NodeCard>;
|
||||
};
|
||||
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeAnswer data={data} />;
|
||||
}
|
||||
export default React.memo(NodeEmpty);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constan
|
||||
import { ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { onChangeNode } from '../../../FlowProvider';
|
||||
|
||||
const NodeExtract = React.memo(function NodeExtract({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const { inputs, outputs, moduleId } = data;
|
||||
const { t } = useTranslation();
|
||||
const [editExtractFiled, setEditExtractField] = useState<ContextExtractAgentItemType>();
|
||||
@@ -183,8 +183,6 @@ const NodeExtract = React.memo(function NodeExtract({ data }: { data: FlowModule
|
||||
)}
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeExtract data={data} />;
|
||||
}
|
||||
export default React.memo(NodeExtract);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import React from 'react';
|
||||
import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../render/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import Divider from '../modules/Divider';
|
||||
import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import { Box, Button } from '@chakra-ui/react';
|
||||
import { SmallAddIcon } from '@chakra-ui/icons';
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
|
||||
const NodeHttp = React.memo(function NodeHttp({ data }: { data: FlowModuleItemType }) {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'350px'} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'}>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
</Container>
|
||||
<Divider text="Output" />
|
||||
<Container>
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeHttp data={data} />;
|
||||
}
|
||||
@@ -41,18 +41,14 @@ const createEditField = {
|
||||
inputType: true
|
||||
};
|
||||
|
||||
const NodePluginInput = React.memo(function NodePluginInput({
|
||||
data
|
||||
}: {
|
||||
data: FlowModuleItemType;
|
||||
}) {
|
||||
const NodePluginInput = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
const [createField, setCreateField] = useState<EditNodeFieldType>();
|
||||
const [editField, setEditField] = useState<EditNodeFieldType>();
|
||||
|
||||
return (
|
||||
<NodeCard minW={'300px'} {...data}>
|
||||
<NodeCard minW={'300px'} selected={selected} forbidMenu {...data}>
|
||||
<Container mt={1} borderTop={'2px solid'} borderTopColor={'myGray.300'}>
|
||||
{inputs.map((item) => (
|
||||
<Flex
|
||||
@@ -257,7 +253,5 @@ const NodePluginInput = React.memo(function NodePluginInput({
|
||||
)}
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodePluginInput data={data} />;
|
||||
}
|
||||
};
|
||||
export default React.memo(NodePluginInput);
|
||||
|
||||
@@ -14,7 +14,7 @@ import Container from '../modules/Container';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import TargetHandle from '../render/TargetHandle';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import {
|
||||
EditNodeFieldType,
|
||||
FlowNodeInputItemType,
|
||||
@@ -42,18 +42,14 @@ const createEditField = {
|
||||
inputType: false
|
||||
};
|
||||
|
||||
const NodePluginOutput = React.memo(function NodePluginOutput({
|
||||
data
|
||||
}: {
|
||||
data: FlowModuleItemType;
|
||||
}) {
|
||||
const NodePluginOutput = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
const [createField, setCreateField] = useState<EditNodeFieldType>();
|
||||
const [editField, setEditField] = useState<EditNodeFieldType>();
|
||||
|
||||
return (
|
||||
<NodeCard minW={'300px'} {...data}>
|
||||
<NodeCard minW={'300px'} selected={selected} forbidMenu {...data}>
|
||||
<Container mt={1} borderTop={'2px solid'} borderTopColor={'myGray.300'}>
|
||||
{inputs.map((item) => (
|
||||
<Flex
|
||||
@@ -237,8 +233,6 @@ const NodePluginOutput = React.memo(function NodePluginOutput({
|
||||
)}
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodePluginOutput data={data} />;
|
||||
}
|
||||
export default React.memo(NodePluginOutput);
|
||||
|
||||
@@ -6,22 +6,16 @@ import Container from '../modules/Container';
|
||||
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
const QuestionInputNode = React.memo(function QuestionInputNode({
|
||||
data
|
||||
}: {
|
||||
data: FlowModuleItemType;
|
||||
}) {
|
||||
const QuestionInputNode = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'240px'} {...data}>
|
||||
<NodeCard minW={'240px'} selected={selected} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'} textAlign={'end'}>
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <QuestionInputNode data={data} />;
|
||||
}
|
||||
export default React.memo(QuestionInputNode);
|
||||
|
||||
@@ -7,11 +7,11 @@ import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
const NodeRunAPP = React.memo(function NodeRunAPP({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeRunAPP = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'350px'} {...data}>
|
||||
<NodeCard minW={'350px'} selected={selected} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'}>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
</Container>
|
||||
@@ -21,7 +21,5 @@ const NodeRunAPP = React.memo(function NodeRunAPP({ data }: { data: FlowModuleIt
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeRunAPP data={data} />;
|
||||
}
|
||||
};
|
||||
export default React.memo(NodeRunAPP);
|
||||
|
||||
@@ -7,11 +7,11 @@ import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
const NodeSimple = React.memo(function NodeSimple({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeSimple = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'350px'} {...data}>
|
||||
<NodeCard minW={'350px'} selected={selected} {...data}>
|
||||
{inputs.length > 0 && (
|
||||
<>
|
||||
<Divider text="Input" />
|
||||
@@ -30,7 +30,5 @@ const NodeSimple = React.memo(function NodeSimple({ data }: { data: FlowModuleIt
|
||||
)}
|
||||
</NodeCard>
|
||||
);
|
||||
});
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeSimple data={data} />;
|
||||
}
|
||||
};
|
||||
export default React.memo(NodeSimple);
|
||||
|
||||
@@ -18,11 +18,11 @@ import TTSSelect from '@/components/core/module/Flow/components/modules/TTSSelec
|
||||
import { splitGuideModule } from '@fastgpt/global/core/module/utils';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const NodeUserGuide = React.memo(function NodeUserGuide({ data }: { data: FlowModuleItemType }) {
|
||||
const NodeUserGuide = ({ data, selected }: NodeProps<FlowModuleItemType>) => {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<>
|
||||
<NodeCard minW={'300px'} {...data}>
|
||||
<NodeCard minW={'300px'} selected={selected} {...data}>
|
||||
<Container className="nodrag" borderTop={'2px solid'} borderTopColor={'myGray.200'}>
|
||||
<WelcomeText data={data} />
|
||||
<Box pt={4} pb={2}>
|
||||
@@ -38,12 +38,11 @@ const NodeUserGuide = React.memo(function NodeUserGuide({ data }: { data: FlowMo
|
||||
</NodeCard>
|
||||
</>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default function Node({ data }: NodeProps<FlowModuleItemType>) {
|
||||
return <NodeUserGuide data={data} />;
|
||||
}
|
||||
export function WelcomeText({ data }: { data: FlowModuleItemType }) {
|
||||
export default React.memo(NodeUserGuide);
|
||||
|
||||
function WelcomeText({ data }: { data: FlowModuleItemType }) {
|
||||
const { t } = useTranslation();
|
||||
const { inputs, moduleId } = data;
|
||||
const [, startTst] = useTransition();
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
FlowNodeOutputTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { EditInputFieldMap, EditNodeFieldType } from '@fastgpt/global/core/module/node/type.d';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
||||
const FieldEditModal = ({
|
||||
editField = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box, Flex, useTheme, Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react';
|
||||
import { Box, Flex, useTheme, MenuButton } from '@chakra-ui/react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import type { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
@@ -7,7 +7,7 @@ import MyTooltip from '@/components/MyTooltip';
|
||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useEditTitle } from '@/web/common/hooks/useEditTitle';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { onChangeNode, onCopyNode, onResetNode, onDelNode } from '../../FlowProvider';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
@@ -16,11 +16,13 @@ import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import MyMenu from '@/components/MyMenu';
|
||||
|
||||
type Props = FlowModuleItemType & {
|
||||
children?: React.ReactNode | React.ReactNode[] | string;
|
||||
minW?: string | number;
|
||||
isPreview?: boolean;
|
||||
forbidMenu?: boolean;
|
||||
selected?: boolean;
|
||||
};
|
||||
|
||||
const NodeCard = (props: Props) => {
|
||||
@@ -34,7 +36,8 @@ const NodeCard = (props: Props) => {
|
||||
moduleId,
|
||||
flowType,
|
||||
inputs,
|
||||
isPreview
|
||||
selected,
|
||||
forbidMenu
|
||||
} = props;
|
||||
|
||||
const theme = useTheme();
|
||||
@@ -113,12 +116,6 @@ const NodeCard = (props: Props) => {
|
||||
icon: 'delete',
|
||||
label: t('common.Delete'),
|
||||
onClick: () => onDelNode(moduleId)
|
||||
},
|
||||
|
||||
{
|
||||
icon: 'common/backLight',
|
||||
label: t('common.Back'),
|
||||
onClick: () => {}
|
||||
}
|
||||
],
|
||||
[flowType, inputs, moduleId, name, onOpenModal, openConfirm, setLoading, t, toast]
|
||||
@@ -129,13 +126,16 @@ const NodeCard = (props: Props) => {
|
||||
minW={minW}
|
||||
maxW={'500px'}
|
||||
bg={'white'}
|
||||
border={theme.borders.md}
|
||||
borderWidth={'1px'}
|
||||
borderColor={selected ? 'primary.600' : 'borderColor.base'}
|
||||
borderRadius={'md'}
|
||||
boxShadow={'sm'}
|
||||
className={isPreview ? 'nodrag' : ''}
|
||||
boxShadow={'1'}
|
||||
_hover={{
|
||||
boxShadow: '4'
|
||||
}}
|
||||
>
|
||||
<Flex className="custom-drag-handle" px={4} py={3} alignItems={'center'}>
|
||||
<Avatar src={avatar} borderRadius={'md'} objectFit={'contain'} w={'30px'} h={'30px'} />
|
||||
<Avatar src={avatar} borderRadius={'0'} objectFit={'contain'} w={'30px'} h={'30px'} />
|
||||
<Box ml={3} fontSize={'lg'} color={'myGray.600'}>
|
||||
{t(name)}
|
||||
</Box>
|
||||
@@ -145,28 +145,25 @@ const NodeCard = (props: Props) => {
|
||||
</MyTooltip>
|
||||
)}
|
||||
<Box flex={1} />
|
||||
{!isPreview && (
|
||||
<Menu autoSelect={false} isLazy>
|
||||
<MenuButton
|
||||
className={'nodrag'}
|
||||
_hover={{ bg: 'myWhite.600' }}
|
||||
cursor={'pointer'}
|
||||
borderRadius={'md'}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<MyIcon name={'more'} w={'14px'} p={2} />
|
||||
</MenuButton>
|
||||
<MenuList color={'myGray.700'} minW={`120px !important`} zIndex={10}>
|
||||
{menuList.map((item) => (
|
||||
<MenuItem key={item.label} onClick={item.onClick} py={[2, 3]}>
|
||||
<MyIcon name={item.icon as any} w={['14px', '16px']} />
|
||||
<Box ml={[1, 2]}>{item.label}</Box>
|
||||
</MenuItem>
|
||||
))}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
{!forbidMenu && (
|
||||
<MyMenu
|
||||
offset={[-60, 5]}
|
||||
width={120}
|
||||
Button={
|
||||
<MenuButton
|
||||
className={'nodrag'}
|
||||
_hover={{ bg: 'myWhite.600' }}
|
||||
cursor={'pointer'}
|
||||
borderRadius={'md'}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<MyIcon name={'more'} w={'14px'} p={2} />
|
||||
</MenuButton>
|
||||
}
|
||||
menuList={menuList}
|
||||
/>
|
||||
)}
|
||||
</Flex>
|
||||
{children}
|
||||
|
||||
@@ -123,25 +123,21 @@ const RenderInput = ({ flowInputList, moduleId, CustomComponent }: Props) => {
|
||||
return <Component inputs={filterInputs} item={input} moduleId={moduleId} />;
|
||||
})();
|
||||
|
||||
return (
|
||||
return input.type !== FlowNodeInputTypeEnum.hidden ? (
|
||||
<Box key={input.key} _notLast={{ mb: 7 }} position={'relative'}>
|
||||
{input.key === ModuleInputKeyEnum.userChatInput && (
|
||||
<UserChatInput inputs={filterInputs} item={input} moduleId={moduleId} />
|
||||
)}
|
||||
{input.type !== FlowNodeInputTypeEnum.hidden && (
|
||||
<>
|
||||
{!!input.label && (
|
||||
<InputLabel moduleId={moduleId} inputKey={input.key} mode={mode} {...input} />
|
||||
)}
|
||||
{!!RenderComponent && (
|
||||
<Box mt={2} className={'nodrag'}>
|
||||
{RenderComponent}
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
{!!input.label && (
|
||||
<InputLabel moduleId={moduleId} inputKey={input.key} mode={mode} {...input} />
|
||||
)}
|
||||
{!!RenderComponent && (
|
||||
<Box mt={2} className={'nodrag'}>
|
||||
{RenderComponent}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
) : null;
|
||||
});
|
||||
}, [memoCustomComponent, filterInputs, mode, moduleId]);
|
||||
|
||||
|
||||
@@ -2,17 +2,11 @@ import React, { useCallback, useEffect } from 'react';
|
||||
import type { RenderInputProps } from '../type';
|
||||
import { onChangeNode } from '../../../../FlowProvider';
|
||||
import SelectAiModel from '@/components/Select/SelectAiModel';
|
||||
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { chatModelList, cqModelList, extractModelList } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const SelectAiModelRender = ({ item, inputs = [], moduleId }: RenderInputProps) => {
|
||||
const modelList = (() => {
|
||||
if (item.type === FlowNodeInputTypeEnum.selectChatModel) return chatModelList;
|
||||
if (item.type === FlowNodeInputTypeEnum.selectCQModel) return cqModelList;
|
||||
if (item.type === FlowNodeInputTypeEnum.selectExtractModel) return extractModelList;
|
||||
|
||||
return [];
|
||||
})().map((item) => ({
|
||||
const { llmModelList } = useSystemStore();
|
||||
const modelList = llmModelList.map((item) => ({
|
||||
model: item.model,
|
||||
name: item.name,
|
||||
maxResponse: item.maxResponse
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { chatModelList } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
@@ -21,6 +21,7 @@ const DatasetParamsModal = dynamic(() => import('@/components/core/module/Datase
|
||||
const SelectDatasetRender = ({ inputs = [], item, moduleId }: RenderInputProps) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const { llmModelList } = useSystemStore();
|
||||
const [nodes, setNodes] = useState<useFlowProviderStoreType['nodes']>([]);
|
||||
const [data, setData] = useState({
|
||||
searchMode: DatasetSearchModeEnum.embedding,
|
||||
@@ -49,7 +50,7 @@ const SelectDatasetRender = ({ inputs = [], item, moduleId }: RenderInputProps)
|
||||
const model =
|
||||
item.data.inputs.find((item) => item.key === ModuleInputKeyEnum.aiModel)?.value || '';
|
||||
const quoteMaxToken =
|
||||
chatModelList.find((item) => item.model === model)?.quoteMaxToken || 3000;
|
||||
llmModelList.find((item) => item.model === model)?.quoteMaxToken || 3000;
|
||||
|
||||
maxTokens = Math.max(maxTokens, quoteMaxToken);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,15 @@ import { useTranslation } from 'next-i18next';
|
||||
import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { chatModelList } from '@/web/common/system/staticData';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import DatasetParamsModal from '@/components/core/module/DatasetParamsModal';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const SelectDatasetParam = ({ inputs = [], moduleId }: RenderInputProps) => {
|
||||
const { nodes } = useFlowProviderStore();
|
||||
|
||||
const { t } = useTranslation();
|
||||
const { llmModelList } = useSystemStore();
|
||||
const [data, setData] = useState({
|
||||
searchMode: DatasetSearchModeEnum.embedding,
|
||||
limit: 5,
|
||||
@@ -29,14 +30,14 @@ const SelectDatasetParam = ({ inputs = [], moduleId }: RenderInputProps) => {
|
||||
const model =
|
||||
item.data.inputs.find((item) => item.key === ModuleInputKeyEnum.aiModel)?.value || '';
|
||||
const quoteMaxToken =
|
||||
chatModelList.find((item) => item.model === model)?.quoteMaxToken || 3000;
|
||||
llmModelList.find((item) => item.model === model)?.quoteMaxToken || 3000;
|
||||
|
||||
maxTokens = Math.max(maxTokens, quoteMaxToken);
|
||||
}
|
||||
});
|
||||
|
||||
return maxTokens;
|
||||
}, [nodes]);
|
||||
}, [llmModelList, nodes]);
|
||||
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import MySlider from '@/components/Slider';
|
||||
const SliderRender = ({ item, moduleId }: RenderInputProps) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Box pt={5} pb={4} px={2}>
|
||||
<Box px={2}>
|
||||
<MySlider
|
||||
markList={item.markList}
|
||||
width={'100%'}
|
||||
|
||||
@@ -4,37 +4,42 @@ import { useFlowProviderStore, onChangeNode } from '../../../../FlowProvider';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
|
||||
import {
|
||||
formatVariablesIcon,
|
||||
formatEditorVariablePickerIcon,
|
||||
getGuideModule,
|
||||
splitGuideModule
|
||||
} from '@fastgpt/global/core/module/utils';
|
||||
|
||||
const TextareaRender = ({ item, moduleId }: RenderInputProps) => {
|
||||
const TextareaRender = ({ inputs = [], item, moduleId }: RenderInputProps) => {
|
||||
const { t } = useTranslation();
|
||||
const [, startTst] = useTransition();
|
||||
const { nodes } = useFlowProviderStore();
|
||||
|
||||
// get variable
|
||||
const variables = useMemo(
|
||||
() =>
|
||||
formatVariablesIcon(
|
||||
splitGuideModule(getGuideModule(nodes.map((node) => node.data)))?.variableModules || []
|
||||
),
|
||||
[nodes]
|
||||
);
|
||||
const variables = useMemo(() => {
|
||||
const globalVariables = formatEditorVariablePickerIcon(
|
||||
splitGuideModule(getGuideModule(nodes.map((node) => node.data)))?.variableModules || []
|
||||
);
|
||||
const moduleVariables = formatEditorVariablePickerIcon(
|
||||
inputs
|
||||
.filter((input) => input.edit)
|
||||
.map((item) => ({
|
||||
key: item.key,
|
||||
label: item.label
|
||||
}))
|
||||
);
|
||||
|
||||
return [...globalVariables, ...moduleVariables];
|
||||
}, [inputs, nodes]);
|
||||
|
||||
const onChange = useCallback(
|
||||
(e: string) => {
|
||||
startTst(() => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: item.key,
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: item.key,
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
},
|
||||
[item, moduleId]
|
||||
@@ -46,7 +51,7 @@ const TextareaRender = ({ item, moduleId }: RenderInputProps) => {
|
||||
title={t(item.label)}
|
||||
h={150}
|
||||
placeholder={t(item.placeholder || '')}
|
||||
defaultValue={item.value}
|
||||
value={item.value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -19,6 +19,9 @@ const nodeTypes: Record<`${FlowNodeTypeEnum}`, any> = {
|
||||
[FlowNodeTypeEnum.historyNode]: NodeSimple,
|
||||
[FlowNodeTypeEnum.chatNode]: NodeSimple,
|
||||
[FlowNodeTypeEnum.datasetSearchNode]: NodeSimple,
|
||||
[FlowNodeTypeEnum.datasetConcatNode]: dynamic(
|
||||
() => import('./components/nodes/NodeDatasetConcat')
|
||||
),
|
||||
[FlowNodeTypeEnum.answerNode]: dynamic(() => import('./components/nodes/NodeAnswer')),
|
||||
[FlowNodeTypeEnum.classifyQuestion]: dynamic(() => import('./components/nodes/NodeCQNode')),
|
||||
[FlowNodeTypeEnum.contentExtract]: dynamic(() => import('./components/nodes/NodeExtract')),
|
||||
|
||||
@@ -14,7 +14,7 @@ export const flowNode2Modules = ({
|
||||
const modules: ModuleItemType[] = nodes.map((item) => ({
|
||||
moduleId: item.data.moduleId,
|
||||
name: item.data.name,
|
||||
avatar: item.data.avatar,
|
||||
// avatar: item.data.avatar,
|
||||
flowType: item.data.flowType,
|
||||
showStatus: item.data.showStatus,
|
||||
position: item.position,
|
||||
|
||||
@@ -32,7 +32,7 @@ import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import dayjs from 'dayjs';
|
||||
import { AddIcon, QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { useCopyData } from '@/web/common/hooks/useCopyData';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyModal from '@/components/MyModal';
|
||||
@@ -40,6 +40,7 @@ import { useForm } from 'react-hook-form';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import MyMenu from '@/components/MyMenu';
|
||||
|
||||
type EditProps = EditApiKeyProps & { _id?: string };
|
||||
const defaultEditData: EditProps = {
|
||||
@@ -54,6 +55,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
const { Loading } = useLoading();
|
||||
const theme = useTheme();
|
||||
const { copyData } = useCopyData();
|
||||
const { feConfigs } = useSystemStore();
|
||||
const [baseUrl, setBaseUrl] = useState('https://fastgpt.in/api');
|
||||
const [editData, setEditData] = useState<EditProps>();
|
||||
const [apiKey, setApiKey] = useState('');
|
||||
@@ -177,35 +179,37 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
: t('common.Un used')}
|
||||
</Td>
|
||||
<Td>
|
||||
<Menu autoSelect={false} isLazy>
|
||||
<MenuButton
|
||||
_hover={{ bg: 'myWhite.600 ' }}
|
||||
cursor={'pointer'}
|
||||
borderRadius={'md'}
|
||||
>
|
||||
<MyIcon name={'more'} w={'14px'} p={2} />
|
||||
</MenuButton>
|
||||
<MenuList color={'myGray.700'} minW={`120px !important`} zIndex={10}>
|
||||
<MenuItem
|
||||
onClick={() =>
|
||||
<MyMenu
|
||||
offset={[-50, 5]}
|
||||
Button={
|
||||
<MyIcon
|
||||
name={'more'}
|
||||
w={'14px'}
|
||||
p={2}
|
||||
_hover={{ bg: 'myWhite.600 ' }}
|
||||
cursor={'pointer'}
|
||||
borderRadius={'md'}
|
||||
/>
|
||||
}
|
||||
menuList={[
|
||||
{
|
||||
label: t('common.Edit'),
|
||||
icon: 'edit',
|
||||
onClick: () =>
|
||||
setEditData({
|
||||
_id,
|
||||
name,
|
||||
limit,
|
||||
appId
|
||||
})
|
||||
}
|
||||
py={[2, 3]}
|
||||
>
|
||||
<MyIcon name={'edit'} w={['14px', '16px']} />
|
||||
<Box ml={[1, 2]}>{t('common.Edit')}</Box>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => onclickRemove(_id)} py={[2, 3]}>
|
||||
<MyIcon name={'delete'} w={['14px', '16px']} />
|
||||
<Box ml={[1, 2]}>{t('common.Delete')}</Box>
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
},
|
||||
{
|
||||
label: t('common.Delete'),
|
||||
icon: 'delete',
|
||||
onClick: () => onclickRemove(_id)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
@@ -285,6 +289,7 @@ function EditKeyModal({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const isEdit = useMemo(() => !!defaultData._id, [defaultData]);
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
const {
|
||||
register,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import MyModal from '@/components/MyModal';
|
||||
|
||||
@@ -42,7 +42,7 @@ import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import { FormDataType, defaultForm } from './EditModal';
|
||||
import MyMenu from '@/components/MyMenu';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
||||
const EditModal = dynamic(() => import('./EditModal'));
|
||||
const InviteModal = dynamic(() => import('./InviteModal'));
|
||||
@@ -324,11 +324,13 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
item.role !== TeamMemberRoleEnum.owner && (
|
||||
<MyMenu
|
||||
width={20}
|
||||
trigger="click"
|
||||
Button={
|
||||
<MenuButton
|
||||
_hover={{
|
||||
bg: 'myWhite.600'
|
||||
}}
|
||||
borderRadius={'md'}
|
||||
px={2}
|
||||
py={1}
|
||||
lineHeight={1}
|
||||
@@ -344,7 +346,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
menuList={[
|
||||
{
|
||||
isActive: item.role === TeamMemberRoleEnum.visitor,
|
||||
child: t('user.team.Invite Role Visitor Tip'),
|
||||
label: t('user.team.Invite Role Visitor Tip'),
|
||||
onClick: () => {
|
||||
onUpdateMember({
|
||||
teamId: item.teamId,
|
||||
@@ -355,7 +357,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
},
|
||||
{
|
||||
isActive: item.role === TeamMemberRoleEnum.admin,
|
||||
child: t('user.team.Invite Role Admin Tip'),
|
||||
label: t('user.team.Invite Role Admin Tip'),
|
||||
onClick: () => {
|
||||
onUpdateMember({
|
||||
teamId: item.teamId,
|
||||
@@ -367,7 +369,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
...(item.status === TeamMemberStatusEnum.reject
|
||||
? [
|
||||
{
|
||||
child: t('user.team.Reinvite'),
|
||||
label: t('user.team.Reinvite'),
|
||||
onClick: () => {
|
||||
onUpdateMember({
|
||||
teamId: item.teamId,
|
||||
@@ -379,7 +381,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
]
|
||||
: []),
|
||||
{
|
||||
child: t('user.team.Remove Member Tip'),
|
||||
label: t('user.team.Remove Member Tip'),
|
||||
onClick: () =>
|
||||
openRemoveMember(
|
||||
() =>
|
||||
|
||||
@@ -4,13 +4,14 @@ import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
||||
const TeamManageModal = dynamic(() => import('../TeamManageModal'));
|
||||
|
||||
const TeamMenu = () => {
|
||||
const theme = useTheme();
|
||||
const { feConfigs } = useSystemStore();
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useUserStore();
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -15,15 +15,16 @@ import { getTeamList, updateInviteResult } from '@/web/support/user/team/api';
|
||||
import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const UpdateInviteModal = () => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const { toast } = useToast();
|
||||
const { ConfirmModal, openConfirm } = useConfirm({});
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
const { data: inviteList = [], refetch } = useQuery(['getInviteList'], () =>
|
||||
feConfigs.isPlus ? getTeamList(TeamMemberStatusEnum.waiting) : []
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
import React from 'react';
|
||||
import { Box, CloseButton } from '@chakra-ui/react';
|
||||
import {
|
||||
chatModelList,
|
||||
vectorModelList,
|
||||
qaModelList,
|
||||
cqModelList,
|
||||
extractModelList,
|
||||
qgModelList,
|
||||
audioSpeechModelList,
|
||||
reRankModelList,
|
||||
whisperModel
|
||||
} from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import Markdown from '@/components/Markdown';
|
||||
|
||||
const Price = ({ onClose }: { onClose: () => void }) => {
|
||||
const { llmModelList, vectorModelList, audioSpeechModelList, whisperModel } = useSystemStore();
|
||||
|
||||
const list = [
|
||||
{
|
||||
title: '对话模型',
|
||||
title: 'AI语言模型',
|
||||
describe: '',
|
||||
md: `
|
||||
| 模型 | 输入价格(¥) | 输出价格(¥) |
|
||||
| --- | --- | --- |
|
||||
${chatModelList
|
||||
${llmModelList
|
||||
?.map((item) => `| ${item.name} | ${item.inputPrice}/1k tokens | ${item.outputPrice}/1k tokens |`)
|
||||
.join('\n')}`
|
||||
},
|
||||
@@ -36,51 +28,6 @@ ${chatModelList
|
||||
${vectorModelList?.map((item) => `| ${item.name} | ${item.inputPrice}/1k 字符 |`).join('\n')}
|
||||
`
|
||||
},
|
||||
{
|
||||
title: '文件预处理模型(QA 拆分)',
|
||||
describe: '',
|
||||
md: `
|
||||
| 模型 | 价格(¥) |
|
||||
| --- | --- |
|
||||
${qaModelList?.map((item) => `| ${item.name} | ${item.inputPrice}/1k 字符 |`).join('\n')}
|
||||
`
|
||||
},
|
||||
{
|
||||
title: '问题分类',
|
||||
describe: '',
|
||||
md: `
|
||||
| 模型 | 输入价格(¥) | 输出价格(¥) |
|
||||
| --- | --- | --- |
|
||||
${cqModelList
|
||||
?.map(
|
||||
(item) => `| ${item.name} | ${item.inputPrice}/1k tokens | ${item.outputPrice}/1k tokens |`
|
||||
)
|
||||
.join('\n')}`
|
||||
},
|
||||
{
|
||||
title: '内容提取',
|
||||
describe: '',
|
||||
md: `
|
||||
| 模型 | 输入价格(¥) | 输出价格(¥) |
|
||||
| --- | --- | --- |
|
||||
${extractModelList
|
||||
?.map(
|
||||
(item) => `| ${item.name} | ${item.inputPrice}/1k tokens | ${item.outputPrice}/1k tokens |`
|
||||
)
|
||||
.join('\n')}`
|
||||
},
|
||||
{
|
||||
title: '下一步指引',
|
||||
describe: '',
|
||||
md: `
|
||||
| 模型 | 输入价格(¥) | 输出价格(¥) |
|
||||
| --- | --- | --- |
|
||||
${qgModelList
|
||||
?.map(
|
||||
(item) => `| ${item.name} | ${item.inputPrice}/1k tokens | ${item.outputPrice}/1k tokens |`
|
||||
)
|
||||
.join('\n')}`
|
||||
},
|
||||
{
|
||||
title: '语音播放',
|
||||
describe: '',
|
||||
|
||||
@@ -26,8 +26,7 @@ import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import { useRouter } from 'next/router';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { formatTime2YMDHM } from '@fastgpt/global/common/string/time';
|
||||
import MySelect from '@/components/Select';
|
||||
import {
|
||||
@@ -40,21 +39,20 @@ import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/bill/tools
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
|
||||
const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const datasetStoreFreeSize = feConfigs?.subscription?.datasetStoreFreeSize || 0;
|
||||
const datasetStorePrice = feConfigs?.subscription?.datasetStorePrice || 0;
|
||||
const { subPlans } = useSystemStore();
|
||||
const datasetStorePrice = subPlans?.extraDatasetSize?.price || 0;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const router = useRouter();
|
||||
const { ConfirmModal, openConfirm } = useConfirm({});
|
||||
const { userInfo } = useUserStore();
|
||||
const [datasetSize, setDatasetSize] = useState(0);
|
||||
const [isRenew, setIsRenew] = useState('false');
|
||||
|
||||
const { data: datasetSub } = useQuery(['getTeamDatasetValidSub'], getTeamDatasetValidSub, {
|
||||
const { data: teamSubPlan } = useQuery(['getTeamDatasetValidSub'], getTeamDatasetValidSub, {
|
||||
onSuccess(res) {
|
||||
setIsRenew(res?.sub?.status === SubStatusEnum.active ? 'true' : 'false');
|
||||
setDatasetSize((res?.sub?.nextExtraDatasetSize || 0) / 1000);
|
||||
setIsRenew(res?.extraDatasetSize?.status === SubStatusEnum.active ? 'true' : 'false');
|
||||
setDatasetSize((res?.extraDatasetSize?.nextExtraDatasetSize || 0) / 1000);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,7 +86,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
<Box>
|
||||
<Flex>
|
||||
<Box flex={'0 0 100px'}>当前额外容量:</Box>
|
||||
<Box>{datasetSub?.sub?.currentExtraDatasetSize || 0}条</Box>
|
||||
<Box>{teamSubPlan?.extraDatasetSize?.currentExtraDatasetSize || 0}条</Box>
|
||||
</Flex>
|
||||
<Flex>
|
||||
<Box flex={'0 0 100px'}>新的额外容量:</Box>
|
||||
@@ -96,7 +94,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
</Flex>
|
||||
<Flex>
|
||||
<Box flex={'0 0 100px'}>新套餐价格:</Box>
|
||||
<Box>{formatStorePrice2Read(res.newPrice)}元</Box>
|
||||
<Box>{formatStorePrice2Read(res.newPlanPrice)}元</Box>
|
||||
</Flex>
|
||||
<Flex>
|
||||
<Box flex={'0 0 100px'}>本次需支付:</Box>
|
||||
@@ -151,7 +149,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
</Flex>
|
||||
<Markdown
|
||||
source={`
|
||||
| 免费知识库 | ${datasetStoreFreeSize}条 |
|
||||
| 套餐知识库容量 | ${teamSubPlan?.standardMaxDatasetSize || Infinity}条 |
|
||||
| --- | --- |
|
||||
| 额外知识库 | ${datasetStorePrice}元/1000条/月 |
|
||||
`}
|
||||
@@ -160,29 +158,29 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
<Flex mt={4}>
|
||||
<Box flex={'0 0 120px'}>{t('support.wallet.subscription.Current dataset store')}: </Box>
|
||||
<Box ml={2} fontWeight={'bold'} flex={1}>
|
||||
{datasetSub?.sub?.currentExtraDatasetSize || 0}
|
||||
{teamSubPlan?.extraDatasetSize?.currentExtraDatasetSize || 0}
|
||||
{t('core.dataset.data.unit')}
|
||||
</Box>
|
||||
</Flex>
|
||||
{datasetSub?.sub?.nextExtraDatasetSize !== undefined && (
|
||||
{teamSubPlan?.extraDatasetSize?.nextExtraDatasetSize !== undefined && (
|
||||
<Flex mt={4}>
|
||||
<Box flex={'0 0 120px'}>{t('support.wallet.subscription.Next sub dataset size')}: </Box>
|
||||
<Box ml={2} fontWeight={'bold'} flex={1}>
|
||||
{datasetSub?.sub?.nextExtraDatasetSize || 0}
|
||||
{teamSubPlan?.extraDatasetSize?.nextExtraDatasetSize || 0}
|
||||
{t('core.dataset.data.unit')}
|
||||
</Box>
|
||||
</Flex>
|
||||
)}
|
||||
{!!datasetSub?.sub?.startTime && (
|
||||
{!!teamSubPlan?.extraDatasetSize?.startTime && (
|
||||
<Flex mt={3}>
|
||||
<Box flex={'0 0 120px'}>订阅开始时间: </Box>
|
||||
<Box ml={2}>{formatTime2YMDHM(datasetSub?.sub?.startTime)}</Box>
|
||||
<Box ml={2}>{formatTime2YMDHM(teamSubPlan?.extraDatasetSize?.startTime)}</Box>
|
||||
</Flex>
|
||||
)}
|
||||
{!!datasetSub?.sub?.expiredTime && (
|
||||
{!!teamSubPlan?.extraDatasetSize?.expiredTime && (
|
||||
<Flex mt={3}>
|
||||
<Box flex={'0 0 120px'}>订阅到期时间: </Box>
|
||||
<Box ml={2}>{formatTime2YMDHM(datasetSub?.sub?.expiredTime)}</Box>
|
||||
<Box ml={2}>{formatTime2YMDHM(teamSubPlan?.extraDatasetSize?.expiredTime)}</Box>
|
||||
</Flex>
|
||||
)}
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
@@ -205,7 +203,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
<NumberInput
|
||||
flex={1}
|
||||
min={0}
|
||||
max={1000}
|
||||
max={10000}
|
||||
step={1}
|
||||
value={datasetSize}
|
||||
position={'relative'}
|
||||
@@ -213,7 +211,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
setDatasetSize(Number(e));
|
||||
}}
|
||||
>
|
||||
<NumberInputField value={datasetSize} step={1} min={0} max={1000} />
|
||||
<NumberInputField value={datasetSize} step={1} min={0} max={10000} />
|
||||
<NumberInputStepper>
|
||||
<NumberIncrementStepper />
|
||||
<NumberDecrementStepper />
|
||||
@@ -227,7 +225,7 @@ const SubDatasetModal = ({ onClose }: { onClose: () => void }) => {
|
||||
<Button variant={'whiteBase'} onClick={onClose}>
|
||||
{t('common.Close')}
|
||||
</Button>
|
||||
{datasetSize * 1000 !== datasetSub?.sub?.nextExtraDatasetSize && (
|
||||
{datasetSize * 1000 !== teamSubPlan?.extraDatasetSize?.nextExtraDatasetSize && (
|
||||
<Button ml={3} isLoading={isLoading} onClick={onClickPreviewCheck}>
|
||||
{t('common.Confirm')}
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type {
|
||||
ChatModelItemType,
|
||||
FunctionModelItemType,
|
||||
LLMModelItemType,
|
||||
VectorModelItemType,
|
||||
AudioSpeechModels,
|
||||
@@ -10,18 +8,16 @@ import type {
|
||||
|
||||
import type { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types/index.d';
|
||||
import { AppSimpleEditConfigTemplateType } from '@fastgpt/global/core/app/type';
|
||||
import { SubPlanType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
|
||||
export type InitDateResponse = {
|
||||
chatModels: ChatModelItemType[];
|
||||
qaModels: LLMModelItemType[];
|
||||
cqModels: FunctionModelItemType[];
|
||||
extractModels: FunctionModelItemType[];
|
||||
llmModels: LLMModelItemType[];
|
||||
vectorModels: VectorModelItemType[];
|
||||
audioSpeechModels: AudioSpeechModels[];
|
||||
reRankModels: ReRankModelItemType[];
|
||||
qgModes: LLMModelItemType[];
|
||||
whisperModel: WhisperModelType;
|
||||
feConfigs: FastGPTFeConfigsType;
|
||||
subPlans?: SubPlanType;
|
||||
systemVersion: string;
|
||||
simpleModeTemplates: AppSimpleEditConfigTemplateType[];
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import { theme } from '@/web/styles/theme';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import NProgress from 'nprogress'; //nprogress module
|
||||
import Router from 'next/router';
|
||||
import { clientInitData, feConfigs } from '@/web/common/system/staticData';
|
||||
import { clientInitData } from '@/web/common/system/staticData';
|
||||
import { appWithTranslation, useTranslation } from 'next-i18next';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -39,7 +39,7 @@ function App({ Component, pageProps }: AppProps) {
|
||||
const router = useRouter();
|
||||
const { hiId } = router.query as { hiId?: string };
|
||||
const { i18n } = useTranslation();
|
||||
const { loadGitStar } = useSystemStore();
|
||||
const { loadGitStar, setInitd, feConfigs } = useSystemStore();
|
||||
const [scripts, setScripts] = useState<FastGPTFeConfigsType['scripts']>([]);
|
||||
const [title, setTitle] = useState(process.env.SYSTEM_NAME || 'AI');
|
||||
|
||||
@@ -65,6 +65,7 @@ function App({ Component, pageProps }: AppProps) {
|
||||
}
|
||||
|
||||
setScripts(scripts || []);
|
||||
setInitd();
|
||||
})();
|
||||
|
||||
// add window error track
|
||||
|
||||
@@ -107,7 +107,7 @@ const BillDetail = ({ bill, onClose }: { bill: BillItemType; onClose: () => void
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<Box flex={'0 0 80px'}>{t('wallet.bill.Source')}:</Box>
|
||||
<Box>{BillSourceMap[bill.source]?.label}</Box>
|
||||
<Box>{t(BillSourceMap[bill.source]?.label)}</Box>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<Box flex={'0 0 80px'}>{t('wallet.bill.Total')}:</Box>
|
||||
@@ -129,7 +129,7 @@ const BillDetail = ({ bill, onClose }: { bill: BillItemType; onClose: () => void
|
||||
{hasCharsLen && <Th>{t('wallet.bill.Text Length')}</Th>}
|
||||
{hasDuration && <Th>{t('wallet.bill.Duration')}</Th>}
|
||||
{hasDatasetSize && (
|
||||
<Th>{t('support.user.team.subscription.type.extraDatasetSize')}</Th>
|
||||
<Th>{t('support.wallet.subscription.type.extraDatasetSize')}</Th>
|
||||
)}
|
||||
<Th>费用(¥)</Th>
|
||||
</Tr>
|
||||
|
||||
@@ -45,7 +45,10 @@ const BillTable = () => {
|
||||
const sourceList = useMemo(
|
||||
() => [
|
||||
{ label: t('common.All'), value: '' },
|
||||
...Object.entries(BillSourceMap).map(([key, value]) => ({ label: value.label, value: key }))
|
||||
...Object.entries(BillSourceMap).map(([key, value]) => ({
|
||||
label: t(value.label),
|
||||
value: key
|
||||
}))
|
||||
],
|
||||
[t]
|
||||
);
|
||||
@@ -152,7 +155,7 @@ const BillTable = () => {
|
||||
<Tr key={item.id}>
|
||||
{/* <Td>{item.memberName}</Td> */}
|
||||
<Td>{dayjs(item.time).format('YYYY/MM/DD HH:mm:ss')}</Td>
|
||||
<Td>{BillSourceMap[item.source]?.label}</Td>
|
||||
<Td>{t(BillSourceMap[item.source]?.label)}</Td>
|
||||
<Td>{t(item.appName) || '-'}</Td>
|
||||
<Td>{item.total}元</Td>
|
||||
<Td>
|
||||
|
||||
@@ -13,14 +13,14 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { UserUpdateParams } from '@/types/user';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import type { UserType } from '@fastgpt/global/support/user/type.d';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
||||
import { feConfigs, systemVersion } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { timezoneList } from '@fastgpt/global/common/time/timezone';
|
||||
import Avatar from '@/components/Avatar';
|
||||
@@ -44,6 +44,7 @@ const SubDatasetModal = dynamic(() => import('@/components/support/wallet/SubDat
|
||||
const UserInfo = () => {
|
||||
const theme = useTheme();
|
||||
const router = useRouter();
|
||||
const { feConfigs, systemVersion } = useSystemStore();
|
||||
const { t, i18n } = useTranslation();
|
||||
const { userInfo, updateUserInfo, initUserInfo } = useUserStore();
|
||||
const timezones = useRef(timezoneList());
|
||||
@@ -122,12 +123,11 @@ const UserInfo = () => {
|
||||
}
|
||||
});
|
||||
|
||||
const { data: datasetSub = { maxSize: 0, usedSize: 0 } } = useQuery(
|
||||
['getTeamDatasetValidSub'],
|
||||
getTeamDatasetValidSub
|
||||
);
|
||||
const {
|
||||
data: teamSubPlan = { totalPoints: 0, usedPoints: 0, datasetMaxSize: 800, usedDatasetSize: 0 }
|
||||
} = useQuery(['getTeamDatasetValidSub'], getTeamDatasetValidSub);
|
||||
const datasetUsageMap = useMemo(() => {
|
||||
const rate = datasetSub.usedSize / datasetSub.maxSize;
|
||||
const rate = teamSubPlan.usedDatasetSize / teamSubPlan.datasetMaxSize;
|
||||
|
||||
const colorScheme = (() => {
|
||||
if (rate < 0.5) return 'green';
|
||||
@@ -138,10 +138,10 @@ const UserInfo = () => {
|
||||
return {
|
||||
colorScheme,
|
||||
value: rate * 100,
|
||||
maxSize: datasetSub.maxSize,
|
||||
usedSize: datasetSub.usedSize
|
||||
maxSize: teamSubPlan.datasetMaxSize || t('common.Unlimited'),
|
||||
usedSize: teamSubPlan.usedDatasetSize
|
||||
};
|
||||
}, [datasetSub.maxSize, datasetSub.usedSize]);
|
||||
}, [teamSubPlan.usedDatasetSize, teamSubPlan.datasetMaxSize, t]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -276,7 +276,7 @@ const UserInfo = () => {
|
||||
<Flex alignItems={'center'}>
|
||||
<Box flex={'1 0 0'} fontSize={'md'}>
|
||||
{t('support.user.team.Dataset usage')}: {datasetUsageMap.usedSize}/
|
||||
{datasetSub.maxSize}
|
||||
{datasetUsageMap.maxSize}
|
||||
</Box>
|
||||
{userInfo?.team?.canWrite && (
|
||||
<Button size={'sm'} onClick={onOpenSubDatasetModal}>
|
||||
@@ -316,7 +316,7 @@ const UserInfo = () => {
|
||||
userSelect={'none'}
|
||||
textDecoration={'none !important'}
|
||||
>
|
||||
<MyIcon name={'common/courseLight'} w={'18px'} />
|
||||
<MyIcon name={'common/courseLight'} w={'18px'} color={'myGray.600'} />
|
||||
<Box ml={2} flex={1}>
|
||||
{t('system.Help Document')}
|
||||
</Box>
|
||||
@@ -366,7 +366,7 @@ const UserInfo = () => {
|
||||
userSelect={'none'}
|
||||
onClick={onOpenOpenai}
|
||||
>
|
||||
<Avatar src={'/imgs/openai.png'} w={'18px'} />
|
||||
<MyIcon name={'common/openai'} w={'18px'} color={'myGray.600'} />
|
||||
<Box ml={2} flex={1}>
|
||||
OpenAI/OneAPI 账号
|
||||
</Box>
|
||||
|
||||
@@ -32,7 +32,7 @@ const OpenAIAccountModal = ({
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/openai.svg"
|
||||
iconSrc="common/openai"
|
||||
title={t('user.OpenAI Account Setting')}
|
||||
>
|
||||
<ModalBody>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { ModalFooter, ModalBody, Button, Input, Box, Grid } from '@chakra-ui/react';
|
||||
import { getPayCode, checkPayResult } from '@/web/support/wallet/pay/api';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useRouter } from 'next/router';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { PaySchema } from '@fastgpt/global/support/wallet/pay/type.d';
|
||||
import dayjs from 'dayjs';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import SideTabs from '@/components/SideTabs';
|
||||
import Tabs from '@/components/Tabs';
|
||||
import UserInfo from './components/Info';
|
||||
import { serviceSideProps } from '@/web/common/utils/i18n';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Script from 'next/script';
|
||||
|
||||
@@ -35,6 +34,7 @@ enum TabEnum {
|
||||
const Account = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo, setUserInfo } = useUserStore();
|
||||
const { feConfigs, isPc } = useSystemStore();
|
||||
|
||||
const tabList = [
|
||||
{
|
||||
@@ -116,7 +116,6 @@ const Account = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
|
||||
const router = useRouter();
|
||||
const theme = useTheme();
|
||||
const { isPc } = useSystemStore();
|
||||
|
||||
const setCurrentTab = useCallback(
|
||||
(tab: string) => {
|
||||
|
||||
@@ -22,10 +22,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
jsonRes<InitDateResponse>(res, {
|
||||
data: {
|
||||
feConfigs: global.feConfigs,
|
||||
chatModels: global.chatModels,
|
||||
qaModels: global.qaModels,
|
||||
cqModels: global.cqModels,
|
||||
extractModels: global.extractModels,
|
||||
subPlans: global.subPlans,
|
||||
llmModels: global.llmModels,
|
||||
vectorModels: global.vectorModels,
|
||||
reRankModels:
|
||||
global.reRankModels?.map((item) => ({
|
||||
@@ -33,7 +31,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
requestUrl: undefined,
|
||||
requestAuth: undefined
|
||||
})) || [],
|
||||
qgModes: global.qgModels,
|
||||
whisperModel: global.whisperModel,
|
||||
audioSpeechModels: global.audioSpeechModels,
|
||||
systemVersion: global.systemVersion || '0.0.0',
|
||||
@@ -119,11 +116,8 @@ export async function initSystemConfig() {
|
||||
...fileRes.systemEnv,
|
||||
...(dbConfig.systemEnv || {})
|
||||
},
|
||||
chatModels: dbConfig.chatModels || fileRes.chatModels || [],
|
||||
qaModels: dbConfig.qaModels || fileRes.qaModels || [],
|
||||
cqModels: dbConfig.cqModels || fileRes.cqModels || [],
|
||||
extractModels: dbConfig.extractModels || fileRes.extractModels || [],
|
||||
qgModels: dbConfig.qgModels || fileRes.qgModels || [],
|
||||
subPlans: dbConfig.subPlans || fileRes.subPlans,
|
||||
llmModels: dbConfig.llmModels || fileRes.llmModels || [],
|
||||
vectorModels: dbConfig.vectorModels || fileRes.vectorModels || [],
|
||||
reRankModels: dbConfig.reRankModels || fileRes.reRankModels || [],
|
||||
audioSpeechModels: dbConfig.audioSpeechModels || fileRes.audioSpeechModels || [],
|
||||
@@ -133,12 +127,9 @@ export async function initSystemConfig() {
|
||||
// set config
|
||||
global.feConfigs = config.feConfigs;
|
||||
global.systemEnv = config.systemEnv;
|
||||
global.subPlans = config.subPlans;
|
||||
|
||||
global.chatModels = config.chatModels;
|
||||
global.qaModels = config.qaModels;
|
||||
global.cqModels = config.cqModels;
|
||||
global.extractModels = config.extractModels;
|
||||
global.qgModels = config.qgModels;
|
||||
global.llmModels = config.llmModels;
|
||||
global.vectorModels = config.vectorModels;
|
||||
global.reRankModels = config.reRankModels;
|
||||
global.audioSpeechModels = config.audioSpeechModels;
|
||||
@@ -147,11 +138,8 @@ export async function initSystemConfig() {
|
||||
console.log({
|
||||
feConfigs: global.feConfigs,
|
||||
systemEnv: global.systemEnv,
|
||||
chatModels: global.chatModels,
|
||||
qaModels: global.qaModels,
|
||||
cqModels: global.cqModels,
|
||||
extractModels: global.extractModels,
|
||||
qgModels: global.qgModels,
|
||||
subPlans: global.subPlans,
|
||||
llmModels: global.llmModels,
|
||||
vectorModels: global.vectorModels,
|
||||
reRankModels: global.reRankModels,
|
||||
audioSpeechModels: global.audioSpeechModels,
|
||||
|
||||
@@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
shareId
|
||||
});
|
||||
|
||||
const qgModel = global.qgModels[0];
|
||||
const qgModel = global.llmModels[0];
|
||||
|
||||
const { result, inputTokens, outputTokens } = await createQuestionGuide({
|
||||
messages,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
import { MongoOutLink } from '@fastgpt/service/support/outLink/schema';
|
||||
import { authApp } from '@fastgpt/service/support/permission/auth/app';
|
||||
import { MongoChatItem } from '@fastgpt/service/core/chat/chatItemSchema';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
/* 获取我的模型 */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
@@ -21,21 +22,33 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
await authApp({ req, authToken: true, appId, per: 'owner' });
|
||||
|
||||
// 删除对应的聊天
|
||||
await MongoChatItem.deleteMany({
|
||||
appId
|
||||
});
|
||||
await MongoChat.deleteMany({
|
||||
appId
|
||||
});
|
||||
|
||||
// 删除分享链接
|
||||
await MongoOutLink.deleteMany({
|
||||
appId
|
||||
});
|
||||
|
||||
// 删除模型
|
||||
await MongoApp.deleteOne({
|
||||
_id: appId
|
||||
await mongoSessionRun(async (session) => {
|
||||
await MongoChatItem.deleteMany(
|
||||
{
|
||||
appId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
await MongoChat.deleteMany(
|
||||
{
|
||||
appId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
// 删除分享链接
|
||||
await MongoOutLink.deleteMany(
|
||||
{
|
||||
appId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
// delete app
|
||||
await MongoApp.deleteOne(
|
||||
{
|
||||
_id: appId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
});
|
||||
|
||||
jsonRes(res);
|
||||
|
||||
@@ -8,11 +8,11 @@ import type { AppSimpleEditFormType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { ModuleItemType } from '@fastgpt/global/core/module/type';
|
||||
import { FormatForm2ModulesProps } from '@fastgpt/global/core/app/api';
|
||||
import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { getExtractModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel } from '@/service/core/ai/model';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
const { formData, chatModelMaxToken, chatModelList } = req.body as FormatForm2ModulesProps;
|
||||
const { formData, chatModelMaxToken } = req.body as FormatForm2ModulesProps;
|
||||
|
||||
const modules = [
|
||||
...(formData.dataset.datasets.length > 0
|
||||
@@ -381,7 +381,7 @@ function datasetTemplate({ formData, maxToken }: Props): ModuleItemType[] {
|
||||
key: 'usingReRank',
|
||||
type: 'hidden',
|
||||
label: '',
|
||||
valueType: 'string',
|
||||
valueType: 'boolean',
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
value: true,
|
||||
@@ -676,7 +676,7 @@ function datasetTemplate({ formData, maxToken }: Props): ModuleItemType[] {
|
||||
label: 'core.module.input.label.aiModel',
|
||||
required: true,
|
||||
valueType: 'string',
|
||||
value: getExtractModel().model,
|
||||
value: getLLMModel().model,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
|
||||
@@ -7,7 +7,7 @@ import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import type { AppSimpleEditFormType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { ModuleItemType } from '@fastgpt/global/core/module/type';
|
||||
import { FormatForm2ModulesProps } from '@fastgpt/global/core/app/api';
|
||||
import { getExtractModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel } from '@/service/core/ai/model';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -377,7 +377,7 @@ function datasetTemplate(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||
key: 'usingReRank',
|
||||
type: 'hidden',
|
||||
label: '',
|
||||
valueType: 'string',
|
||||
valueType: 'boolean',
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
value: formData.dataset.usingReRank,
|
||||
@@ -686,7 +686,7 @@ function datasetTemplate(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||
label: 'core.module.input.label.aiModel',
|
||||
required: true,
|
||||
valueType: 'string',
|
||||
value: getExtractModel().model,
|
||||
value: getLLMModel().model,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { AppUpdateParams } from '@fastgpt/global/core/app/api';
|
||||
import { authApp } from '@fastgpt/service/support/permission/auth/app';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { getChatModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel } from '@/service/core/ai/model';
|
||||
|
||||
/* 获取我的模型 */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
@@ -32,7 +32,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
if (item.flowType === FlowNodeTypeEnum.chatNode) {
|
||||
const model =
|
||||
item.inputs.find((item) => item.key === ModuleInputKeyEnum.aiModel)?.value || '';
|
||||
const chatModel = getChatModel(model);
|
||||
const chatModel = getLLMModel(model);
|
||||
const quoteMaxToken = chatModel.quoteMaxToken || 3000;
|
||||
|
||||
maxTokens = Math.max(maxTokens, quoteMaxToken);
|
||||
@@ -42,7 +42,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
modules.forEach((item) => {
|
||||
if (item.flowType === FlowNodeTypeEnum.datasetSearchNode) {
|
||||
item.inputs.forEach((input) => {
|
||||
if (input.key === ModuleInputKeyEnum.datasetLimit) {
|
||||
if (input.key === ModuleInputKeyEnum.datasetMaxTokens) {
|
||||
const val = input.value as number;
|
||||
if (val > maxTokens) {
|
||||
input.value = maxTokens;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MongoChat } from '@fastgpt/service/core/chat/chatSchema';
|
||||
import { MongoChatItem } from '@fastgpt/service/core/chat/chatItemSchema';
|
||||
import { DelHistoryProps } from '@/global/core/chat/api';
|
||||
import { autChatCrud } from '@/service/support/permission/auth/chat';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
/* clear chat history */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@@ -22,13 +23,21 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
per: 'w'
|
||||
});
|
||||
|
||||
await MongoChatItem.deleteMany({
|
||||
appId,
|
||||
chatId
|
||||
});
|
||||
await MongoChat.findOneAndRemove({
|
||||
appId,
|
||||
chatId
|
||||
await mongoSessionRun(async (session) => {
|
||||
await MongoChatItem.deleteMany(
|
||||
{
|
||||
appId,
|
||||
chatId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
await MongoChat.findOneAndRemove(
|
||||
{
|
||||
appId,
|
||||
chatId
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
});
|
||||
|
||||
jsonRes(res);
|
||||
|
||||
@@ -21,12 +21,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
per: 'w'
|
||||
});
|
||||
|
||||
const { _id } = await createOneCollection({
|
||||
...body,
|
||||
teamId,
|
||||
tmbId
|
||||
});
|
||||
|
||||
jsonRes(res, {
|
||||
data: await createOneCollection({
|
||||
...body,
|
||||
teamId,
|
||||
tmbId
|
||||
})
|
||||
data: _id
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { uploadFile } from '@fastgpt/service/common/file/gridfs/controller';
|
||||
import { delFileByFileIdList, uploadFile } from '@fastgpt/service/common/file/gridfs/controller';
|
||||
import { getUploadModel } from '@fastgpt/service/common/file/multer';
|
||||
import { authDataset } from '@fastgpt/service/support/permission/auth/dataset';
|
||||
import { FileCreateDatasetCollectionParams } from '@fastgpt/global/core/dataset/api';
|
||||
import { removeFilesByPaths } from '@fastgpt/service/common/file/utils';
|
||||
import { createOneCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
||||
import { DatasetCollectionTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { BucketNameEnum } from '@fastgpt/global/common/file/constants';
|
||||
|
||||
/**
|
||||
* Creates the multer uploader
|
||||
@@ -18,7 +19,7 @@ const upload = getUploadModel({
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
let filePaths: string[] = [];
|
||||
|
||||
let fileId: string = '';
|
||||
const { datasetId } = req.query as { datasetId: string };
|
||||
|
||||
try {
|
||||
@@ -45,7 +46,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
const { fileMetadata, collectionMetadata, ...collectionData } = data;
|
||||
|
||||
// upload file and create collection
|
||||
const fileId = await uploadFile({
|
||||
fileId = await uploadFile({
|
||||
teamId,
|
||||
tmbId,
|
||||
bucketName,
|
||||
@@ -56,7 +57,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
});
|
||||
|
||||
// create collection
|
||||
const collectionId = await createOneCollection({
|
||||
const { _id: collectionId } = await createOneCollection({
|
||||
...collectionData,
|
||||
metadata: collectionMetadata,
|
||||
teamId,
|
||||
@@ -69,6 +70,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
data: collectionId
|
||||
});
|
||||
} catch (error) {
|
||||
if (fileId) {
|
||||
try {
|
||||
await delFileByFileIdList({
|
||||
fileIdList: [fileId],
|
||||
bucketName: BucketNameEnum.dataset
|
||||
});
|
||||
} catch (error) {}
|
||||
}
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error
|
||||
|
||||
@@ -15,8 +15,10 @@ import { checkDatasetLimit } from '@fastgpt/service/support/permission/limit/dat
|
||||
import { predictDataLimitLength } from '@fastgpt/global/core/dataset/utils';
|
||||
import { createTrainingBill } from '@fastgpt/service/support/wallet/bill/controller';
|
||||
import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { reloadCollectionChunks } from '@fastgpt/service/core/dataset/collection/utils';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -41,39 +43,51 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
// 1. check dataset limit
|
||||
await checkDatasetLimit({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize,
|
||||
insertLen: predictDataLimitLength(trainingType, new Array(10))
|
||||
insertLen: predictDataLimitLength(trainingType, new Array(10)),
|
||||
standardPlans: getStandardSubPlan()
|
||||
});
|
||||
|
||||
// 2. create collection
|
||||
const collectionId = await createOneCollection({
|
||||
...body,
|
||||
name: link,
|
||||
teamId,
|
||||
tmbId,
|
||||
type: DatasetCollectionTypeEnum.link,
|
||||
const { _id: collectionId } = await mongoSessionRun(async (session) => {
|
||||
// 2. create collection
|
||||
const collection = await createOneCollection({
|
||||
...body,
|
||||
name: link,
|
||||
teamId,
|
||||
tmbId,
|
||||
type: DatasetCollectionTypeEnum.link,
|
||||
|
||||
trainingType,
|
||||
chunkSize,
|
||||
chunkSplitter,
|
||||
qaPrompt,
|
||||
trainingType,
|
||||
chunkSize,
|
||||
chunkSplitter,
|
||||
qaPrompt,
|
||||
|
||||
rawLink: link
|
||||
});
|
||||
rawLink: link,
|
||||
session
|
||||
});
|
||||
|
||||
// 3. create bill and start sync
|
||||
const { billId } = await createTrainingBill({
|
||||
teamId,
|
||||
tmbId,
|
||||
appName: 'core.dataset.collection.Sync Collection',
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: getVectorModel(dataset.vectorModel).name,
|
||||
agentModel: getQAModel(dataset.agentModel).name
|
||||
});
|
||||
await reloadCollectionChunks({
|
||||
collectionId,
|
||||
tmbId,
|
||||
billId
|
||||
// 3. create bill and start sync
|
||||
const { billId } = await createTrainingBill({
|
||||
teamId,
|
||||
tmbId,
|
||||
appName: 'core.dataset.collection.Sync Collection',
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: getVectorModel(dataset.vectorModel).name,
|
||||
agentModel: getLLMModel(dataset.agentModel).name,
|
||||
session
|
||||
});
|
||||
|
||||
// load
|
||||
await reloadCollectionChunks({
|
||||
collection: {
|
||||
...collection.toObject(),
|
||||
datasetId: dataset
|
||||
},
|
||||
tmbId,
|
||||
billId,
|
||||
session
|
||||
});
|
||||
|
||||
return collection;
|
||||
});
|
||||
|
||||
jsonRes(res, {
|
||||
|
||||
@@ -18,7 +18,8 @@ import { pushDataToTrainingQueue } from '@/service/core/dataset/data/controller'
|
||||
import { hashStr } from '@fastgpt/global/common/string/tools';
|
||||
import { createTrainingBill } from '@fastgpt/service/support/wallet/bill/controller';
|
||||
import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -52,12 +53,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
// 2. check dataset limit
|
||||
await checkDatasetLimit({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize,
|
||||
insertLen: predictDataLimitLength(trainingType, chunks)
|
||||
insertLen: predictDataLimitLength(trainingType, chunks),
|
||||
standardPlans: getStandardSubPlan()
|
||||
});
|
||||
|
||||
// 3. create collection and training bill
|
||||
const [collectionId, { billId }] = await Promise.all([
|
||||
const [{ _id: collectionId }, { billId }] = await Promise.all([
|
||||
createOneCollection({
|
||||
...body,
|
||||
teamId,
|
||||
@@ -79,7 +80,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
appName: name,
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: getVectorModel(dataset.vectorModel)?.name,
|
||||
agentModel: getQAModel(dataset.agentModel)?.name
|
||||
agentModel: getLLMModel(dataset.agentModel)?.name
|
||||
})
|
||||
]);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { connectToDatabase } from '@/service/mongo';
|
||||
import { findCollectionAndChild } from '@fastgpt/service/core/dataset/collection/utils';
|
||||
import { delCollectionAndRelatedSources } from '@fastgpt/service/core/dataset/collection/controller';
|
||||
import { authDatasetCollection } from '@fastgpt/service/support/permission/auth/dataset';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -32,9 +33,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
});
|
||||
|
||||
// delete
|
||||
await delCollectionAndRelatedSources({
|
||||
collections
|
||||
});
|
||||
await mongoSessionRun((session) =>
|
||||
delCollectionAndRelatedSources({
|
||||
collections,
|
||||
session
|
||||
})
|
||||
);
|
||||
|
||||
jsonRes(res);
|
||||
} catch (err) {
|
||||
|
||||
@@ -14,8 +14,9 @@ import {
|
||||
import { DatasetErrEnum } from '@fastgpt/global/common/error/code/dataset';
|
||||
import { createTrainingBill } from '@fastgpt/service/support/wallet/bill/controller';
|
||||
import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { createOneCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -27,7 +28,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
throw new Error('CollectionIdId is required');
|
||||
}
|
||||
|
||||
const { collection, teamId, tmbId } = await authDatasetCollection({
|
||||
const { collection, tmbId } = await authDatasetCollection({
|
||||
req,
|
||||
authToken: true,
|
||||
collectionId,
|
||||
@@ -51,44 +52,54 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
/* Not the same original text, create and reload */
|
||||
|
||||
const vectorModelData = getVectorModel(collection.datasetId.vectorModel);
|
||||
const agentModelData = getQAModel(collection.datasetId.agentModel);
|
||||
// create training bill
|
||||
const { billId } = await createTrainingBill({
|
||||
teamId: collection.teamId,
|
||||
tmbId,
|
||||
appName: 'core.dataset.collection.Sync Collection',
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: vectorModelData.name,
|
||||
agentModel: agentModelData.name
|
||||
});
|
||||
const agentModelData = getLLMModel(collection.datasetId.agentModel);
|
||||
|
||||
// create a collection and delete old
|
||||
const _id = await createOneCollection({
|
||||
teamId: collection.teamId,
|
||||
tmbId: collection.tmbId,
|
||||
parentId: collection.parentId,
|
||||
datasetId: collection.datasetId._id,
|
||||
name: title || collection.name,
|
||||
type: collection.type,
|
||||
trainingType: collection.trainingType,
|
||||
chunkSize: collection.chunkSize,
|
||||
fileId: collection.fileId,
|
||||
rawLink: collection.rawLink,
|
||||
metadata: collection.metadata,
|
||||
createTime: collection.createTime
|
||||
});
|
||||
await mongoSessionRun(async (session) => {
|
||||
// create training bill
|
||||
const { billId } = await createTrainingBill({
|
||||
teamId: collection.teamId,
|
||||
tmbId,
|
||||
appName: 'core.dataset.collection.Sync Collection',
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: vectorModelData.name,
|
||||
agentModel: agentModelData.name,
|
||||
session
|
||||
});
|
||||
|
||||
// start load
|
||||
await reloadCollectionChunks({
|
||||
collectionId: _id,
|
||||
tmbId,
|
||||
billId,
|
||||
rawText
|
||||
});
|
||||
// create a collection and delete old
|
||||
const newCol = await createOneCollection({
|
||||
teamId: collection.teamId,
|
||||
tmbId: collection.tmbId,
|
||||
parentId: collection.parentId,
|
||||
datasetId: collection.datasetId._id,
|
||||
name: title || collection.name,
|
||||
type: collection.type,
|
||||
trainingType: collection.trainingType,
|
||||
chunkSize: collection.chunkSize,
|
||||
fileId: collection.fileId,
|
||||
rawLink: collection.rawLink,
|
||||
metadata: collection.metadata,
|
||||
createTime: collection.createTime,
|
||||
session
|
||||
});
|
||||
|
||||
// delete old collection
|
||||
await delCollectionAndRelatedSources({
|
||||
collections: [collection]
|
||||
// start load
|
||||
await reloadCollectionChunks({
|
||||
collection: {
|
||||
...newCol.toObject(),
|
||||
datasetId: collection.datasetId
|
||||
},
|
||||
tmbId,
|
||||
billId,
|
||||
rawText,
|
||||
session
|
||||
});
|
||||
|
||||
// delete old collection
|
||||
await delCollectionAndRelatedSources({
|
||||
collections: [collection],
|
||||
session
|
||||
});
|
||||
});
|
||||
|
||||
jsonRes(res, {
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { CreateDatasetParams } from '@/global/core/dataset/api.d';
|
||||
import { createDefaultCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
||||
import { authUserNotVisitor } from '@fastgpt/service/support/permission/auth/user';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel, getDatasetModel } from '@/service/core/ai/model';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
type = DatasetTypeEnum.dataset,
|
||||
avatar,
|
||||
vectorModel = global.vectorModels[0].model,
|
||||
agentModel = global.qaModels[0].model
|
||||
agentModel = getDatasetModel().model
|
||||
} = req.body as CreateDatasetParams;
|
||||
|
||||
// auth
|
||||
@@ -25,7 +25,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
|
||||
// check model valid
|
||||
const vectorModelStore = getVectorModel(vectorModel);
|
||||
const agentModelStore = getQAModel(agentModel);
|
||||
const agentModelStore = getLLMModel(agentModel);
|
||||
if (!vectorModelStore || !agentModelStore) {
|
||||
throw new Error('vectorModel or qaModel is invalid');
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { pushGenerateVectorBill } from '@/service/support/wallet/bill/push';
|
||||
import { InsertOneDatasetDataProps } from '@/global/core/dataset/api';
|
||||
import { simpleText } from '@fastgpt/global/common/string/tools';
|
||||
import { checkDatasetLimit } from '@fastgpt/service/support/permission/limit/dataset';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
|
||||
export default withNextCors(async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -42,8 +43,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
|
||||
await checkDatasetLimit({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize,
|
||||
insertLen: 1
|
||||
insertLen: 1,
|
||||
standardPlans: getStandardSubPlan()
|
||||
});
|
||||
|
||||
// auth collection and get dataset
|
||||
|
||||
@@ -11,6 +11,7 @@ import { authDatasetCollection } from '@fastgpt/service/support/permission/auth/
|
||||
import { checkDatasetLimit } from '@fastgpt/service/support/permission/limit/dataset';
|
||||
import { predictDataLimitLength } from '@fastgpt/global/core/dataset/utils';
|
||||
import { pushDataToTrainingQueue } from '@/service/core/dataset/data/controller';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
|
||||
export default withNextCors(async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -37,8 +38,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
// auth dataset limit
|
||||
await checkDatasetLimit({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize,
|
||||
insertLen: predictDataLimitLength(collection.trainingType, data)
|
||||
insertLen: predictDataLimitLength(collection.trainingType, data),
|
||||
standardPlans: getStandardSubPlan()
|
||||
});
|
||||
|
||||
jsonRes<PushDatasetDataResponse>(res, {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { authDataset } from '@fastgpt/service/support/permission/auth/dataset';
|
||||
import { delDatasetRelevantData } from '@fastgpt/service/core/dataset/controller';
|
||||
import { findDatasetAndAllChildren } from '@fastgpt/service/core/dataset/controller';
|
||||
import { MongoDataset } from '@fastgpt/service/core/dataset/schema';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -32,11 +33,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
});
|
||||
|
||||
// delete all dataset.data and pg data
|
||||
await delDatasetRelevantData({ datasets });
|
||||
|
||||
// delete dataset data
|
||||
await MongoDataset.deleteMany({
|
||||
_id: { $in: datasets.map((d) => d._id) }
|
||||
await mongoSessionRun(async (session) => {
|
||||
// delete dataset data
|
||||
await delDatasetRelevantData({ datasets, session });
|
||||
await MongoDataset.deleteMany(
|
||||
{
|
||||
_id: { $in: datasets.map((d) => d._id) }
|
||||
},
|
||||
{ session }
|
||||
);
|
||||
});
|
||||
|
||||
jsonRes(res);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import type { DatasetItemType } from '@fastgpt/global/core/dataset/type.d';
|
||||
import { authDataset } from '@fastgpt/service/support/permission/auth/dataset';
|
||||
|
||||
@@ -29,7 +29,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
data: {
|
||||
...dataset,
|
||||
vectorModel: getVectorModel(dataset.vectorModel),
|
||||
agentModel: getQAModel(dataset.agentModel),
|
||||
agentModel: getLLMModel(dataset.agentModel),
|
||||
canWrite,
|
||||
isOwner
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
// query extension
|
||||
// const { queries } = await searchQueryExtension({
|
||||
// query: text,
|
||||
// model: global.chatModels[0].model
|
||||
// model: global.llmModel[0].model
|
||||
// });
|
||||
|
||||
const { searchRes, charsLength, ...result } = await searchDatasetData({
|
||||
|
||||
@@ -17,6 +17,21 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
|
||||
await authRequestFromLocal({ req });
|
||||
|
||||
// string all value
|
||||
Object.keys(obj).forEach((key) => {
|
||||
let val = obj[key];
|
||||
|
||||
if (typeof val === 'object') {
|
||||
val = JSON.stringify(val);
|
||||
} else if (typeof val === 'number') {
|
||||
val = String(val);
|
||||
} else if (typeof val === 'boolean') {
|
||||
val = val ? 'true' : 'false';
|
||||
}
|
||||
|
||||
obj[key] = val;
|
||||
});
|
||||
|
||||
const textResult = replaceVariable(text, obj);
|
||||
|
||||
res.json({
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
const nanoid = customAlphabet(
|
||||
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
|
||||
Math.floor(Math.random() * 14) + 24
|
||||
Math.floor(Math.random() * 14) + 52
|
||||
);
|
||||
const apiKey = `${global.systemEnv?.openapiPrefix || 'fastgpt'}-${nanoid()}`;
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
const baseUrl = openaiAccount?.baseUrl || openaiBaseUrl;
|
||||
openaiAccount.baseUrl = baseUrl;
|
||||
|
||||
const ai = getAIApi(openaiAccount);
|
||||
const ai = getAIApi({
|
||||
userKey: openaiAccount
|
||||
});
|
||||
|
||||
const response = await ai.chat.completions.create({
|
||||
model: 'gpt-3.5-turbo',
|
||||
|
||||
@@ -3,6 +3,7 @@ import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
import { checkDatasetLimit } from '@fastgpt/service/support/permission/limit/dataset';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -22,8 +23,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
|
||||
await checkDatasetLimit({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize,
|
||||
insertLen: numberSize
|
||||
insertLen: numberSize,
|
||||
standardPlans: getStandardSubPlan()
|
||||
});
|
||||
|
||||
jsonRes(res);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
|
||||
import { CreateTrainingBillProps } from '@fastgpt/global/support/wallet/bill/api.d';
|
||||
import { getQAModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { getLLMModel, getVectorModel } from '@/service/core/ai/model';
|
||||
import { createTrainingBill } from '@fastgpt/service/support/wallet/bill/controller';
|
||||
import { authDataset } from '@fastgpt/service/support/permission/auth/dataset';
|
||||
|
||||
@@ -26,7 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
appName: name,
|
||||
billSource: BillSourceEnum.training,
|
||||
vectorModel: getVectorModel(dataset.vectorModel).name,
|
||||
agentModel: getQAModel(dataset.agentModel).name
|
||||
agentModel: getLLMModel(dataset.agentModel).name
|
||||
});
|
||||
|
||||
jsonRes<string>(res, {
|
||||
|
||||
@@ -2,8 +2,9 @@ import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
import { getTeamDatasetValidSub } from '@fastgpt/service/support/wallet/sub/utils';
|
||||
import { getVectorCountByTeamId } from '@fastgpt/service/common/vectorStore/controller';
|
||||
import { getTeamSubPlanStatus } from '@fastgpt/service/support/wallet/sub/utils';
|
||||
import { getStandardSubPlan } from '@/service/support/wallet/sub/utils';
|
||||
import { FeTeamSubType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
@@ -15,20 +16,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
authToken: true
|
||||
});
|
||||
|
||||
const [{ sub, maxSize }, usedSize] = await Promise.all([
|
||||
getTeamDatasetValidSub({
|
||||
jsonRes<FeTeamSubType>(res, {
|
||||
data: await getTeamSubPlanStatus({
|
||||
teamId,
|
||||
freeSize: global.feConfigs?.subscription?.datasetStoreFreeSize
|
||||
}),
|
||||
getVectorCountByTeamId(teamId)
|
||||
]);
|
||||
|
||||
jsonRes(res, {
|
||||
data: {
|
||||
sub,
|
||||
maxSize,
|
||||
usedSize
|
||||
}
|
||||
standardPlans: getStandardSubPlan()
|
||||
})
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
@@ -5,12 +5,15 @@ import { withNextCors } from '@fastgpt/service/common/middle/cors';
|
||||
import { pushGenerateVectorBill } from '@/service/support/wallet/bill/push';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { authTeamBalance } from '@/service/support/permission/auth/bill';
|
||||
import { getVectorsByText, GetVectorProps } from '@fastgpt/service/core/ai/embedding';
|
||||
import { getVectorsByText } from '@fastgpt/service/core/ai/embedding';
|
||||
import { updateApiKeyUsage } from '@fastgpt/service/support/openapi/tools';
|
||||
import { getBillSourceByAuthType } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import { getVectorModel } from '@/service/core/ai/model';
|
||||
|
||||
type Props = GetVectorProps & {
|
||||
type Props = {
|
||||
input: string | string[];
|
||||
model: string;
|
||||
dimensions?: number;
|
||||
billId?: string;
|
||||
};
|
||||
|
||||
@@ -33,7 +36,10 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
|
||||
await authTeamBalance(teamId);
|
||||
|
||||
const { charsLength, vectors } = await getVectorsByText({ input: query, model });
|
||||
const { charsLength, vectors } = await getVectorsByText({
|
||||
input: query,
|
||||
model: getVectorModel(model)
|
||||
});
|
||||
|
||||
res.json({
|
||||
object: 'list',
|
||||
|
||||
@@ -15,7 +15,7 @@ import ChatTest, { type ChatTestComponentRef } from '@/components/core/module/Fl
|
||||
import { getFlowStore } from '@/components/core/module/Flow/FlowProvider';
|
||||
import { flowNode2Modules, filterExportModules } from '@/components/core/module/utils';
|
||||
import { useAppStore } from '@/web/core/app/store/useAppStore';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
|
||||
const ImportSettings = dynamic(() => import('@/components/core/module/Flow/ImportSettings'));
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { AppSchema } from '@fastgpt/global/core/app/type.d';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
||||
@@ -9,7 +9,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useCopyData } from '@/web/common/hooks/useCopyData';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { fileToBase64 } from '@/web/common/file/utils';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
enum UsingWayEnum {
|
||||
link = 'link',
|
||||
@@ -25,6 +25,7 @@ const SelectUsingWayModal = ({ share, onClose }: { share: OutLinkSchema; onClose
|
||||
multiple: false,
|
||||
fileType: 'image/*'
|
||||
});
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
const VariableTypeList = [
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user