mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
Context extract support value type (#1620)
* perf: chat box components * perf: chatbox context * feat: extract support value type * workflow performance * update doc * feat: error response * feat: error response * oauth sort * perf: logo * fix: update laf account * perf: team permission api * update type
This commit is contained in:
@@ -211,10 +211,10 @@ data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"in
|
|||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
event: moduleStatus
|
event: flowNodeStatus
|
||||||
data: {"status":"running","name":"知识库搜索"}
|
data: {"status":"running","name":"知识库搜索"}
|
||||||
|
|
||||||
event: moduleStatus
|
event: flowNodeStatus
|
||||||
data: {"status":"running","name":"AI 对话"}
|
data: {"status":"running","name":"AI 对话"}
|
||||||
|
|
||||||
event: answer
|
event: answer
|
||||||
@@ -238,7 +238,7 @@ data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index"
|
|||||||
event: answer
|
event: answer
|
||||||
data: [DONE]
|
data: [DONE]
|
||||||
|
|
||||||
event: appStreamResponse
|
event: flowResponses
|
||||||
data: [{"moduleName":"知识库搜索","moduleType":"datasetSearchNode","runningTime":1.78},{"question":"导演是谁","quoteList":[{"id":"654f2e49b64caef1d9431e8b","q":"电影《铃芽之旅》的导演是谁?","a":"电影《铃芽之旅》的导演是新海诚!","indexes":[{"type":"qa","dataId":"3515487","text":"电影《铃芽之旅》的导演是谁?","_id":"654f2e49b64caef1d9431e8c","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8935586214065552},{"id":"6552e14c50f4a2a8e632af11","q":"导演是谁?","a":"电影《铃芽之旅》的导演是新海诚。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3644565","text":"导演是谁?\n电影《铃芽之旅》的导演是新海诚。","_id":"6552e14dde5cc7ba3954e417"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8890955448150635},{"id":"654f34a0b64caef1d946337e","q":"本作的主人公是谁?","a":"本作的主人公是名叫铃芽的少女。","indexes":[{"type":"qa","dataId":"3515541","text":"本作的主人公是谁?","_id":"654f34a0b64caef1d946337f","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8738770484924316},{"id":"654f3002b64caef1d944207a","q":"电影《铃芽之旅》男主角是谁?","a":"电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。","indexes":[{"type":"qa","dataId":"3515538","text":"电影《铃芽之旅》男主角是谁?","_id":"654f3002b64caef1d944207b","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8607980012893677},{"id":"654f2fc8b64caef1d943fd46","q":"电影《铃芽之旅》的编剧是谁?","a":"新海诚是本片的编剧。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3515550","text":"电影《铃芽之旅》的编剧是谁?22","_id":"654f2fc8b64caef1d943fd47"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8468944430351257}],"moduleName":"AI 对话","moduleType":"chatNode","runningTime":1.86}]
|
data: [{"moduleName":"知识库搜索","moduleType":"datasetSearchNode","runningTime":1.78},{"question":"导演是谁","quoteList":[{"id":"654f2e49b64caef1d9431e8b","q":"电影《铃芽之旅》的导演是谁?","a":"电影《铃芽之旅》的导演是新海诚!","indexes":[{"type":"qa","dataId":"3515487","text":"电影《铃芽之旅》的导演是谁?","_id":"654f2e49b64caef1d9431e8c","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8935586214065552},{"id":"6552e14c50f4a2a8e632af11","q":"导演是谁?","a":"电影《铃芽之旅》的导演是新海诚。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3644565","text":"导演是谁?\n电影《铃芽之旅》的导演是新海诚。","_id":"6552e14dde5cc7ba3954e417"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8890955448150635},{"id":"654f34a0b64caef1d946337e","q":"本作的主人公是谁?","a":"本作的主人公是名叫铃芽的少女。","indexes":[{"type":"qa","dataId":"3515541","text":"本作的主人公是谁?","_id":"654f34a0b64caef1d946337f","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8738770484924316},{"id":"654f3002b64caef1d944207a","q":"电影《铃芽之旅》男主角是谁?","a":"电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。","indexes":[{"type":"qa","dataId":"3515538","text":"电影《铃芽之旅》男主角是谁?","_id":"654f3002b64caef1d944207b","defaultIndex":true}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8607980012893677},{"id":"654f2fc8b64caef1d943fd46","q":"电影《铃芽之旅》的编剧是谁?","a":"新海诚是本片的编剧。","indexes":[{"defaultIndex":true,"type":"qa","dataId":"3515550","text":"电影《铃芽之旅》的编剧是谁?22","_id":"654f2fc8b64caef1d943fd47"}],"datasetId":"646627f4f7b896cfd8910e38","collectionId":"653279b16cd42ab509e766e8","sourceName":"data (81).csv","sourceId":"64fd3b6423aa1307b65896f6","score":0.8468944430351257}],"moduleName":"AI 对话","moduleType":"chatNode","runningTime":1.86}]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -29,5 +29,6 @@ SANDBOX_URL=内网地址
|
|||||||
## V4.8.2 更新说明
|
## V4.8.2 更新说明
|
||||||
|
|
||||||
1. 新增 - js代码运行节点(更完整的type提醒,后续继续完善)
|
1. 新增 - js代码运行节点(更完整的type提醒,后续继续完善)
|
||||||
2. 修复 - 新增的站点同步无法使用
|
2. 新增 - 内容提取节点支持数据类型选择
|
||||||
3. 修复 - 定时任务无法输入内容
|
3. 修复 - 新增的站点同步无法使用
|
||||||
|
4. 修复 - 定时任务无法输入内容
|
@@ -24,22 +24,26 @@ A2:
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Prompt_ExtractJson = `你可以从 <对话记录></对话记录> 中提取指定 JSON 信息,你仅需返回 JSON 字符串,无需回答问题。
|
export const Prompt_ExtractJson = `你可以从 <对话记录></对话记录> 中提取指定 Json 信息,你仅需返回 Json 字符串,无需回答问题。
|
||||||
<提取要求>
|
<提取要求>
|
||||||
{{description}}
|
{{description}}
|
||||||
</提取要求>
|
</提取要求>
|
||||||
|
|
||||||
<字段说明>
|
<提取规则>
|
||||||
1. 下面的 JSON 字符串均按照 JSON Schema 的规则描述。
|
- 本次需提取的 json 字符串,需符合 JsonSchema 的规则。
|
||||||
2. key 代表字段名;description 代表字段的描述;enum 是可选值,代表可选的 value。
|
- type 代表数据类型; key 代表字段名; description 代表字段的描述; enum 是枚举值,代表可选的 value。
|
||||||
3. 如果没有可提取的内容,忽略该字段。
|
- 如果没有可提取的内容,忽略该字段。
|
||||||
4. 本次需提取的JSON Schema:{{json}}
|
</提取规则>
|
||||||
</字段说明>
|
|
||||||
|
<JsonSchema>
|
||||||
|
{{json}}
|
||||||
|
</JsonSchema>
|
||||||
|
|
||||||
<对话记录>
|
<对话记录>
|
||||||
{{text}}
|
{{text}}
|
||||||
</对话记录>
|
</对话记录>
|
||||||
`;
|
|
||||||
|
提取的 json 字符串:`;
|
||||||
|
|
||||||
export const Prompt_CQJson = `请帮我执行一个“问题分类”任务,将问题分类为以下几种类型之一:
|
export const Prompt_CQJson = `请帮我执行一个“问题分类”任务,将问题分类为以下几种类型之一:
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ export type DispatchNodeResponseType = {
|
|||||||
runningTime?: number;
|
runningTime?: number;
|
||||||
query?: string;
|
query?: string;
|
||||||
textOutput?: string;
|
textOutput?: string;
|
||||||
|
error?: Record<string, any>;
|
||||||
customInputs?: Record<string, any>;
|
customInputs?: Record<string, any>;
|
||||||
customOutputs?: Record<string, any>;
|
customOutputs?: Record<string, any>;
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ export const ContextExtractModule: FlowNodeTemplateType = {
|
|||||||
label: '',
|
label: '',
|
||||||
valueType: WorkflowIOValueTypeEnum.any,
|
valueType: WorkflowIOValueTypeEnum.any,
|
||||||
description: "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
|
description: "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
|
||||||
value: [] // {desc: string; key: string; required: boolean; enum: string[]}[]
|
value: [] // {valueType: string; desc: string; key: string; required: boolean; enum: string[]}[]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
|
@@ -115,6 +115,7 @@ export type ClassifyQuestionAgentItemType = {
|
|||||||
key: string;
|
key: string;
|
||||||
};
|
};
|
||||||
export type ContextExtractAgentItemType = {
|
export type ContextExtractAgentItemType = {
|
||||||
|
valueType: 'string' | 'number' | 'boolean';
|
||||||
desc: string;
|
desc: string;
|
||||||
key: string;
|
key: string;
|
||||||
required: boolean;
|
required: boolean;
|
||||||
|
@@ -14,7 +14,6 @@ export type CreateTeamProps = {
|
|||||||
lafAccount?: LafAccountType;
|
lafAccount?: LafAccountType;
|
||||||
};
|
};
|
||||||
export type UpdateTeamProps = {
|
export type UpdateTeamProps = {
|
||||||
teamId: string;
|
|
||||||
name?: string;
|
name?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
teamDomain?: string;
|
teamDomain?: string;
|
||||||
|
@@ -11,6 +11,7 @@ export type BillSchemaType = {
|
|||||||
status: 'SUCCESS' | 'REFUND' | 'NOTPAY' | 'CLOSED';
|
status: 'SUCCESS' | 'REFUND' | 'NOTPAY' | 'CLOSED';
|
||||||
type: `${BillTypeEnum}`;
|
type: `${BillTypeEnum}`;
|
||||||
price: number;
|
price: number;
|
||||||
|
hasInvoice: boolean;
|
||||||
metadata: {
|
metadata: {
|
||||||
payWay: `${BillPayWayEnum}`;
|
payWay: `${BillPayWayEnum}`;
|
||||||
subMode?: `${SubModeEnum}`;
|
subMode?: `${SubModeEnum}`;
|
||||||
@@ -20,7 +21,6 @@ export type BillSchemaType = {
|
|||||||
extraPoints?: number;
|
extraPoints?: number;
|
||||||
invoice: boolean;
|
invoice: boolean;
|
||||||
};
|
};
|
||||||
username: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ChatNodeUsageType = {
|
export type ChatNodeUsageType = {
|
||||||
|
@@ -183,7 +183,7 @@ ${description ? `- ${description}` : ''}
|
|||||||
> = {};
|
> = {};
|
||||||
extractKeys.forEach((item) => {
|
extractKeys.forEach((item) => {
|
||||||
properties[item.key] = {
|
properties[item.key] = {
|
||||||
type: 'string',
|
type: item.valueType || 'string',
|
||||||
description: item.desc,
|
description: item.desc,
|
||||||
...(item.enum ? { enum: item.enum.split('\n') } : {})
|
...(item.enum ? { enum: item.enum.split('\n') } : {})
|
||||||
};
|
};
|
||||||
@@ -198,7 +198,7 @@ ${description ? `- ${description}` : ''}
|
|||||||
required: []
|
required: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
console.log(properties);
|
||||||
return {
|
return {
|
||||||
filterMessages,
|
filterMessages,
|
||||||
agentFunction
|
agentFunction
|
||||||
@@ -319,12 +319,16 @@ const completions = async ({
|
|||||||
content: replaceVariable(extractModel.customExtractPrompt || Prompt_ExtractJson, {
|
content: replaceVariable(extractModel.customExtractPrompt || Prompt_ExtractJson, {
|
||||||
description,
|
description,
|
||||||
json: extractKeys
|
json: extractKeys
|
||||||
.map(
|
.map((item) => {
|
||||||
(item) =>
|
const valueType = item.valueType || 'string';
|
||||||
`{"key":"${item.key}", "description":"${item.desc}"${
|
if (valueType !== 'string' && valueType !== 'number') {
|
||||||
item.enum ? `, "enum":"[${item.enum.split('\n')}]"` : ''
|
item.enum = undefined;
|
||||||
}}`
|
}
|
||||||
)
|
|
||||||
|
return `{"type":${item.valueType || 'string'}, "key":"${item.key}", "description":"${item.desc}" ${
|
||||||
|
item.enum ? `, "enum":"[${item.enum.split('\n')}]"` : ''
|
||||||
|
}}`;
|
||||||
|
})
|
||||||
.join('\n'),
|
.join('\n'),
|
||||||
text: `${histories.map((item) => `${item.obj}:${chatValue2RuntimePrompt(item.value).text}`).join('\n')}
|
text: `${histories.map((item) => `${item.obj}:${chatValue2RuntimePrompt(item.value).text}`).join('\n')}
|
||||||
Human: ${content}`
|
Human: ${content}`
|
||||||
@@ -365,6 +369,7 @@ Human: ${content}`
|
|||||||
arg: json5.parse(jsonStr) as Record<string, any>
|
arg: json5.parse(jsonStr) as Record<string, any>
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log('Extract error, ai answer:', answer);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return {
|
return {
|
||||||
rawResponse: answer,
|
rawResponse: answer,
|
||||||
|
@@ -45,7 +45,11 @@ export const dispatchRunCode = async (props: RunCodeType): Promise<RunCodeRespon
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
[NodeOutputKeyEnum.error]: formatHttpError(error)
|
[NodeOutputKeyEnum.error]: formatHttpError(error),
|
||||||
|
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||||
|
customInputs: customVariables,
|
||||||
|
error: formatHttpError(error)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -5,6 +5,7 @@ import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
|
|||||||
import { parseHeaderCert } from '../controller';
|
import { parseHeaderCert } from '../controller';
|
||||||
import { getTmbInfoByTmbId } from '../../user/team/controller';
|
import { getTmbInfoByTmbId } from '../../user/team/controller';
|
||||||
import { UserErrEnum } from '../../../../global/common/error/code/user';
|
import { UserErrEnum } from '../../../../global/common/error/code/user';
|
||||||
|
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
|
||||||
|
|
||||||
export async function authUserNotVisitor(props: AuthModeType): Promise<
|
export async function authUserNotVisitor(props: AuthModeType): Promise<
|
||||||
AuthResponseType & {
|
AuthResponseType & {
|
||||||
@@ -47,3 +48,19 @@ export async function authUserRole(props: AuthModeType): Promise<
|
|||||||
canWrite
|
canWrite
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* auth teamMember in team role */
|
||||||
|
export async function authTeamOwner(props: AuthModeType): Promise<
|
||||||
|
AuthResponseType & {
|
||||||
|
role: `${TeamMemberRoleEnum}`;
|
||||||
|
teamOwner: boolean;
|
||||||
|
}
|
||||||
|
> {
|
||||||
|
const authRes = await authUserRole(props);
|
||||||
|
|
||||||
|
if (authRes.role !== TeamMemberRoleEnum.owner) {
|
||||||
|
return Promise.reject(TeamErrEnum.unAuthTeam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return authRes;
|
||||||
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '@fastgpt/global/support/user/team/constant';
|
} from '@fastgpt/global/support/user/team/constant';
|
||||||
import { MongoTeamMember } from './teamMemberSchema';
|
import { MongoTeamMember } from './teamMemberSchema';
|
||||||
import { MongoTeam } from './teamSchema';
|
import { MongoTeam } from './teamSchema';
|
||||||
|
import { UpdateTeamProps } from '@fastgpt/global/support/user/team/controller';
|
||||||
|
|
||||||
async function getTeamMember(match: Record<string, any>): Promise<TeamItemType> {
|
async function getTeamMember(match: Record<string, any>): Promise<TeamItemType> {
|
||||||
const tmb = (await MongoTeamMember.findOne(match).populate('teamId')) as TeamMemberWithTeamSchema;
|
const tmb = (await MongoTeamMember.findOne(match).populate('teamId')) as TeamMemberWithTeamSchema;
|
||||||
@@ -108,3 +109,18 @@ export async function createDefaultTeam({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function updateTeam({
|
||||||
|
teamId,
|
||||||
|
name,
|
||||||
|
avatar,
|
||||||
|
teamDomain,
|
||||||
|
lafAccount
|
||||||
|
}: UpdateTeamProps & { teamId: string }) {
|
||||||
|
await MongoTeam.findByIdAndUpdate(teamId, {
|
||||||
|
name,
|
||||||
|
avatar,
|
||||||
|
teamDomain,
|
||||||
|
lafAccount
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@@ -44,18 +44,17 @@ export const useConfirm = (props?: {
|
|||||||
const confirmCb = useRef<Function>();
|
const confirmCb = useRef<Function>();
|
||||||
const cancelCb = useRef<any>();
|
const cancelCb = useRef<any>();
|
||||||
|
|
||||||
const openConfirm = (
|
const openConfirm = useCallback(
|
||||||
confirm?: Function,
|
(confirm?: Function, cancel?: any, customContent?: string | React.ReactNode) => {
|
||||||
cancel?: any,
|
confirmCb.current = confirm;
|
||||||
customContent?: string | React.ReactNode
|
cancelCb.current = cancel;
|
||||||
) => {
|
|
||||||
confirmCb.current = confirm;
|
|
||||||
cancelCb.current = cancel;
|
|
||||||
|
|
||||||
customContent && setCustomContent(customContent);
|
customContent && setCustomContent(customContent);
|
||||||
|
|
||||||
return onOpen;
|
return onOpen;
|
||||||
};
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
const ConfirmModal = useCallback(
|
const ConfirmModal = useCallback(
|
||||||
({
|
({
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
"App": "App",
|
"App": "App",
|
||||||
"Code editor": "Code edit",
|
"Code editor": "Code edit",
|
||||||
"Export": "Export",
|
"Export": "Export",
|
||||||
|
"Field name": "Name",
|
||||||
"Folder": "Folder",
|
"Folder": "Folder",
|
||||||
"Is open": "Opened",
|
"Is open": "Opened",
|
||||||
"Login": "Login",
|
"Login": "Login",
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"Custom inputs": "Custom inputs",
|
"Custom inputs": "Custom inputs",
|
||||||
"Custom outputs": "Custom outputs"
|
"Custom outputs": "Custom outputs",
|
||||||
|
"Error": "Error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
"App": "应用",
|
"App": "应用",
|
||||||
"Code editor": "代码编辑",
|
"Code editor": "代码编辑",
|
||||||
"Export": "导出",
|
"Export": "导出",
|
||||||
|
"Field name": "字段名",
|
||||||
"Folder": "文件夹",
|
"Folder": "文件夹",
|
||||||
"Is open": "是否开启",
|
"Is open": "是否开启",
|
||||||
"Login": "登录",
|
"Login": "登录",
|
||||||
@@ -476,7 +477,7 @@
|
|||||||
"context total length": "上下文总长度",
|
"context total length": "上下文总长度",
|
||||||
"module cq": "问题分类列表",
|
"module cq": "问题分类列表",
|
||||||
"module cq result": "分类结果",
|
"module cq result": "分类结果",
|
||||||
"module extract description": "提取要求描述",
|
"module extract description": "提取背景描述",
|
||||||
"module extract result": "提取结果",
|
"module extract result": "提取结果",
|
||||||
"module historyPreview": "完整记录",
|
"module historyPreview": "完整记录",
|
||||||
"module http body": "请求体",
|
"module http body": "请求体",
|
||||||
@@ -584,8 +585,7 @@
|
|||||||
"success": "开始同步"
|
"success": "开始同步"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"training": {
|
"training": {}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"Auxiliary Data": "辅助数据",
|
"Auxiliary Data": "辅助数据",
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"Custom inputs": "自定义输入",
|
"Custom inputs": "自定义输入",
|
||||||
"Custom outputs": "自定义输出"
|
"Custom outputs": "自定义输出",
|
||||||
|
"Error": "错误信息"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,6 @@ import MyTooltip from '../../MyTooltip';
|
|||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||||
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
||||||
import { customAlphabet } from 'nanoid';
|
|
||||||
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
|
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
|
||||||
import { addDays } from 'date-fns';
|
import { addDays } from 'date-fns';
|
||||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||||
@@ -15,9 +14,10 @@ import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants'
|
|||||||
import { ChatBoxInputFormType, ChatBoxInputType, UserInputFileItemType } from '../type';
|
import { ChatBoxInputFormType, ChatBoxInputType, UserInputFileItemType } from '../type';
|
||||||
import { textareaMinH } from '../constants';
|
import { textareaMinH } from '../constants';
|
||||||
import { UseFormReturn, useFieldArray } from 'react-hook-form';
|
import { UseFormReturn, useFieldArray } from 'react-hook-form';
|
||||||
import { useChatProviderStore } from '../Provider';
|
import { ChatBoxContext } from '../Provider';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
import { useContextSelector } from 'use-context-selector';
|
||||||
|
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||||
|
|
||||||
const InputGuideBox = dynamic(() => import('./InputGuideBox'));
|
const InputGuideBox = dynamic(() => import('./InputGuideBox'));
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ const ChatInput = ({
|
|||||||
whisperConfig,
|
whisperConfig,
|
||||||
autoTTSResponse,
|
autoTTSResponse,
|
||||||
chatInputGuide
|
chatInputGuide
|
||||||
} = useChatProviderStore();
|
} = useContextSelector(ChatBoxContext, (v) => v);
|
||||||
const { isPc, whisperModel } = useSystemStore();
|
const { isPc, whisperModel } = useSystemStore();
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -119,7 +119,7 @@ const ChatInput = ({
|
|||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const item = {
|
const item = {
|
||||||
id: nanoid(),
|
id: getNanoid(6),
|
||||||
rawFile: file,
|
rawFile: file,
|
||||||
type: ChatFileTypeEnum.image,
|
type: ChatFileTypeEnum.image,
|
||||||
name: file.name,
|
name: file.name,
|
||||||
@@ -132,7 +132,7 @@ const ChatInput = ({
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
resolve({
|
resolve({
|
||||||
id: nanoid(),
|
id: getNanoid(6),
|
||||||
rawFile: file,
|
rawFile: file,
|
||||||
type: ChatFileTypeEnum.file,
|
type: ChatFileTypeEnum.file,
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
@@ -7,7 +7,8 @@ import { queryChatInputGuideList } from '@/web/core/chat/inputGuide/api';
|
|||||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import HighlightText from '@fastgpt/web/components/common/String/HighlightText';
|
import HighlightText from '@fastgpt/web/components/common/String/HighlightText';
|
||||||
import { useChatProviderStore } from '../Provider';
|
import { ChatBoxContext } from '../Provider';
|
||||||
|
import { useContextSelector } from 'use-context-selector';
|
||||||
|
|
||||||
export default function InputGuideBox({
|
export default function InputGuideBox({
|
||||||
appId,
|
appId,
|
||||||
@@ -22,7 +23,7 @@ export default function InputGuideBox({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { chatT } = useI18n();
|
const { chatT } = useI18n();
|
||||||
const { chatInputGuide } = useChatProviderStore();
|
const chatInputGuide = useContextSelector(ChatBoxContext, (v) => v.chatInputGuide);
|
||||||
|
|
||||||
const { data = [] } = useRequest2(
|
const { data = [] } = useRequest2(
|
||||||
async () => {
|
async () => {
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
|
|
||||||
const MarkModal = () => {
|
|
||||||
const [adminMarkData, setAdminMarkData] = useState<{
|
|
||||||
chatItemId: string;
|
|
||||||
dataId?: string;
|
|
||||||
datasetId?: string;
|
|
||||||
collectionId?: string;
|
|
||||||
q: string;
|
|
||||||
a: string;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
return <div>MarkModal</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MarkModal;
|
|
@@ -1,7 +1,6 @@
|
|||||||
import React, { useContext, createContext, useState, useMemo, useEffect, useCallback } from 'react';
|
import React, { useState, useMemo } from 'react';
|
||||||
import { useAudioPlay } from '@/web/common/utils/voice';
|
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||||
import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||||
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/index.d';
|
|
||||||
import {
|
import {
|
||||||
AppChatConfigType,
|
AppChatConfigType,
|
||||||
AppTTSConfigType,
|
AppTTSConfigType,
|
||||||
@@ -15,6 +14,7 @@ import {
|
|||||||
defaultTTSConfig,
|
defaultTTSConfig,
|
||||||
defaultWhisperConfig
|
defaultWhisperConfig
|
||||||
} from '@fastgpt/global/core/app/constants';
|
} from '@fastgpt/global/core/app/constants';
|
||||||
|
import { createContext } from 'use-context-selector';
|
||||||
|
|
||||||
type useChatStoreType = OutLinkChatAuthProps & {
|
type useChatStoreType = OutLinkChatAuthProps & {
|
||||||
welcomeText: string;
|
welcomeText: string;
|
||||||
@@ -46,7 +46,7 @@ type useChatStoreType = OutLinkChatAuthProps & {
|
|||||||
isChatting: boolean;
|
isChatting: boolean;
|
||||||
chatInputGuide: ChatInputGuideConfigType;
|
chatInputGuide: ChatInputGuideConfigType;
|
||||||
};
|
};
|
||||||
const StateContext = createContext<useChatStoreType>({
|
export const ChatBoxContext = createContext<useChatStoreType>({
|
||||||
welcomeText: '',
|
welcomeText: '',
|
||||||
variableList: [],
|
variableList: [],
|
||||||
questionGuide: false,
|
questionGuide: false,
|
||||||
@@ -109,8 +109,6 @@ export type ChatProviderProps = OutLinkChatAuthProps & {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useChatProviderStore = () => useContext(StateContext);
|
|
||||||
|
|
||||||
const Provider = ({
|
const Provider = ({
|
||||||
shareId,
|
shareId,
|
||||||
outLinkUid,
|
outLinkUid,
|
||||||
@@ -186,7 +184,7 @@ const Provider = ({
|
|||||||
chatInputGuide
|
chatInputGuide
|
||||||
};
|
};
|
||||||
|
|
||||||
return <StateContext.Provider value={value}>{children}</StateContext.Provider>;
|
return <ChatBoxContext.Provider value={value}>{children}</ChatBoxContext.Provider>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(Provider);
|
export default React.memo(Provider);
|
||||||
|
@@ -7,7 +7,8 @@ import { useTranslation } from 'next-i18next';
|
|||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import { formatChatValue2InputType } from '../utils';
|
import { formatChatValue2InputType } from '../utils';
|
||||||
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
||||||
import { useChatProviderStore } from '../Provider';
|
import { ChatBoxContext } from '../Provider';
|
||||||
|
import { useContextSelector } from 'use-context-selector';
|
||||||
|
|
||||||
export type ChatControllerProps = {
|
export type ChatControllerProps = {
|
||||||
isLastChild: boolean;
|
isLastChild: boolean;
|
||||||
@@ -45,7 +46,7 @@ const ChatController = ({
|
|||||||
cancelAudio,
|
cancelAudio,
|
||||||
audioPlayingChatId,
|
audioPlayingChatId,
|
||||||
setAudioPlayingChatId
|
setAudioPlayingChatId
|
||||||
} = useChatProviderStore();
|
} = useContextSelector(ChatBoxContext, (v) => v);
|
||||||
const controlIconStyle = {
|
const controlIconStyle = {
|
||||||
w: '14px',
|
w: '14px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
@@ -25,8 +25,9 @@ import {
|
|||||||
ChatStatusEnum
|
ChatStatusEnum
|
||||||
} from '@fastgpt/global/core/chat/constants';
|
} from '@fastgpt/global/core/chat/constants';
|
||||||
import FilesBlock from './FilesBox';
|
import FilesBlock from './FilesBox';
|
||||||
import { useChatProviderStore } from '../Provider';
|
import { ChatBoxContext } from '../Provider';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
|
import { useContextSelector } from 'use-context-selector';
|
||||||
|
|
||||||
const colorMap = {
|
const colorMap = {
|
||||||
[ChatStatusEnum.loading]: {
|
[ChatStatusEnum.loading]: {
|
||||||
@@ -78,7 +79,7 @@ const ChatItem = ({
|
|||||||
bg: 'myGray.50'
|
bg: 'myGray.50'
|
||||||
};
|
};
|
||||||
|
|
||||||
const { isChatting } = useChatProviderStore();
|
const isChatting = useContextSelector(ChatBoxContext, (v) => v.isChatting);
|
||||||
const { chat } = chatControllerProps;
|
const { chat } = chatControllerProps;
|
||||||
|
|
||||||
const ContentCard = useMemo(() => {
|
const ContentCard = useMemo(() => {
|
||||||
|
@@ -4,8 +4,8 @@ import { ModalBody, Box, useTheme } from '@chakra-ui/react';
|
|||||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||||
import QuoteItem from '../core/dataset/QuoteItem';
|
import QuoteItem from '../../core/dataset/QuoteItem';
|
||||||
import RawSourceBox from '../core/dataset/RawSourceBox';
|
import RawSourceBox from '../../core/dataset/RawSourceBox';
|
||||||
|
|
||||||
const QuoteModal = ({
|
const QuoteModal = ({
|
||||||
rawSearch = [],
|
rawSearch = [],
|
@@ -7,7 +7,7 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
|
|||||||
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||||
import MyTooltip from '../MyTooltip';
|
import MyTooltip from '../../MyTooltip';
|
||||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||||
import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
|
import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
|
||||||
import ChatBoxDivider from '@/components/core/chat/Divider';
|
import ChatBoxDivider from '@/components/core/chat/Divider';
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { ModalBody, useTheme, ModalFooter, Button, Box, Card, Flex, Grid } from '@chakra-ui/react';
|
import { ModalBody, useTheme, ModalFooter, Button, Box, Card, Flex, Grid } from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import Avatar from '../Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||||
import DatasetSelectModal, { useDatasetSelect } from '@/components/core/dataset/SelectModal';
|
import DatasetSelectModal, { useDatasetSelect } from '@/components/core/dataset/SelectModal';
|
@@ -1,14 +1,14 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { Box, useTheme, Flex, Image, BoxProps } from '@chakra-ui/react';
|
import { Box, useTheme, Flex, Image, BoxProps } from '@chakra-ui/react';
|
||||||
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type.d';
|
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type.d';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { moduleTemplatesFlat } from '@fastgpt/global/core/workflow/template/constants';
|
import { moduleTemplatesFlat } from '@fastgpt/global/core/workflow/template/constants';
|
||||||
|
|
||||||
import Tabs from '../Tabs';
|
import Tabs from '../../Tabs';
|
||||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||||
import MyTooltip from '../MyTooltip';
|
import MyTooltip from '../../MyTooltip';
|
||||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||||
import Markdown from '../Markdown';
|
import Markdown from '../../Markdown';
|
||||||
import { QuoteList } from './QuoteModal';
|
import { QuoteList } from './QuoteModal';
|
||||||
import { DatasetSearchModeMap } from '@fastgpt/global/core/dataset/constants';
|
import { DatasetSearchModeMap } from '@fastgpt/global/core/dataset/constants';
|
||||||
import { formatNumber } from '@fastgpt/global/common/math/tools';
|
import { formatNumber } from '@fastgpt/global/common/math/tools';
|
||||||
@@ -185,6 +185,7 @@ export const ResponseBox = React.memo(function ResponseBox({
|
|||||||
label={t('core.chat.response.context total length')}
|
label={t('core.chat.response.context total length')}
|
||||||
value={activeModule?.contextTotalLen}
|
value={activeModule?.contextTotalLen}
|
||||||
/>
|
/>
|
||||||
|
<Row label={workflowT('response.Error')} value={activeModule?.error} />
|
||||||
</>
|
</>
|
||||||
|
|
||||||
{/* ai chat */}
|
{/* ai chat */}
|
@@ -15,14 +15,12 @@ import type {
|
|||||||
ChatSiteItemType,
|
ChatSiteItemType,
|
||||||
UserChatItemValueItemType
|
UserChatItemValueItemType
|
||||||
} from '@fastgpt/global/core/chat/type.d';
|
} from '@fastgpt/global/core/chat/type.d';
|
||||||
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type.d';
|
|
||||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||||
import { Box, Flex, Checkbox } from '@chakra-ui/react';
|
import { Box, Flex, Checkbox } from '@chakra-ui/react';
|
||||||
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
||||||
import { chats2GPTMessages } from '@fastgpt/global/core/chat/adapt';
|
import { chats2GPTMessages } from '@fastgpt/global/core/chat/adapt';
|
||||||
import { VariableInputEnum } from '@fastgpt/global/core/workflow/constants';
|
import { VariableInputEnum } from '@fastgpt/global/core/workflow/constants';
|
||||||
import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
@@ -32,7 +30,7 @@ import {
|
|||||||
updateChatAdminFeedback,
|
updateChatAdminFeedback,
|
||||||
updateChatUserFeedback
|
updateChatUserFeedback
|
||||||
} from '@/web/core/chat/api';
|
} from '@/web/core/chat/api';
|
||||||
import type { AdminMarkType } from './SelectMarkCollection';
|
import type { AdminMarkType } from './components/SelectMarkCollection';
|
||||||
|
|
||||||
import MyTooltip from '../MyTooltip';
|
import MyTooltip from '../MyTooltip';
|
||||||
|
|
||||||
@@ -52,7 +50,7 @@ import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/c
|
|||||||
import { formatChatValue2InputType } from './utils';
|
import { formatChatValue2InputType } from './utils';
|
||||||
import { textareaMinH } from './constants';
|
import { textareaMinH } from './constants';
|
||||||
import { SseResponseEventEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
import { SseResponseEventEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
||||||
import ChatProvider, { useChatProviderStore } from './Provider';
|
import ChatProvider, { ChatBoxContext } from './Provider';
|
||||||
|
|
||||||
import ChatItem from './components/ChatItem';
|
import ChatItem from './components/ChatItem';
|
||||||
|
|
||||||
@@ -60,11 +58,12 @@ import dynamic from 'next/dynamic';
|
|||||||
import { useCreation } from 'ahooks';
|
import { useCreation } from 'ahooks';
|
||||||
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
||||||
import type { StreamResponseType } from '@/web/common/api/fetch';
|
import type { StreamResponseType } from '@/web/common/api/fetch';
|
||||||
|
import { useContextSelector } from 'use-context-selector';
|
||||||
|
|
||||||
const ResponseTags = dynamic(() => import('./ResponseTags'));
|
const ResponseTags = dynamic(() => import('./components/ResponseTags'));
|
||||||
const FeedbackModal = dynamic(() => import('./FeedbackModal'));
|
const FeedbackModal = dynamic(() => import('./components/FeedbackModal'));
|
||||||
const ReadFeedbackModal = dynamic(() => import('./ReadFeedbackModal'));
|
const ReadFeedbackModal = dynamic(() => import('./components/ReadFeedbackModal'));
|
||||||
const SelectMarkCollection = dynamic(() => import('./SelectMarkCollection'));
|
const SelectMarkCollection = dynamic(() => import('./components/SelectMarkCollection'));
|
||||||
const Empty = dynamic(() => import('./components/Empty'));
|
const Empty = dynamic(() => import('./components/Empty'));
|
||||||
const WelcomeBox = dynamic(() => import('./components/WelcomeBox'));
|
const WelcomeBox = dynamic(() => import('./components/WelcomeBox'));
|
||||||
const VariableInput = dynamic(() => import('./components/VariableInput'));
|
const VariableInput = dynamic(() => import('./components/VariableInput'));
|
||||||
@@ -158,7 +157,7 @@ const ChatBox = (
|
|||||||
chatHistories,
|
chatHistories,
|
||||||
setChatHistories,
|
setChatHistories,
|
||||||
isChatting
|
isChatting
|
||||||
} = useChatProviderStore();
|
} = useContextSelector(ChatBoxContext, (v) => v);
|
||||||
|
|
||||||
// compute variable input is finish.
|
// compute variable input is finish.
|
||||||
const chatForm = useForm<ChatBoxInputFormType>({
|
const chatForm = useForm<ChatBoxInputFormType>({
|
||||||
|
@@ -102,7 +102,13 @@ const Navbar = ({ unread }: { unread: number }) => {
|
|||||||
cursor={'pointer'}
|
cursor={'pointer'}
|
||||||
onClick={() => router.push('/account')}
|
onClick={() => router.push('/account')}
|
||||||
>
|
>
|
||||||
<Avatar w={'36px'} h={'36px'} src={userInfo?.avatar} fallbackSrc={HUMAN_ICON} />
|
<Avatar
|
||||||
|
w={'36px'}
|
||||||
|
h={'36px'}
|
||||||
|
src={userInfo?.avatar}
|
||||||
|
fallbackSrc={HUMAN_ICON}
|
||||||
|
borderRadius={'50%'}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
{/* 导航列表 */}
|
{/* 导航列表 */}
|
||||||
<Box flex={1}>
|
<Box flex={1}>
|
||||||
|
@@ -29,13 +29,13 @@ const NodeCode = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
|||||||
content: workflowT('code.Reset template confirm')
|
content: workflowT('code.Reset template confirm')
|
||||||
});
|
});
|
||||||
|
|
||||||
const CustomComponent = useMemo(
|
const CustomComponent = useMemo(() => {
|
||||||
() => ({
|
return {
|
||||||
[NodeInputKeyEnum.code]: (item: FlowNodeInputItemType) => {
|
[NodeInputKeyEnum.code]: (item: FlowNodeInputItemType) => {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Flex mb={1} alignItems={'flex-end'}>
|
<Flex mb={1} alignItems={'flex-end'}>
|
||||||
<Box flex={'1'}>{workflowT('Code')}</Box>
|
<Box flex={'1'}>Javascript{workflowT('Code')}</Box>
|
||||||
<Box
|
<Box
|
||||||
cursor={'pointer'}
|
cursor={'pointer'}
|
||||||
color={'primary.500'}
|
color={'primary.500'}
|
||||||
@@ -74,9 +74,8 @@ const NodeCode = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}),
|
};
|
||||||
[nodeId, onChangeNode, openConfirm, workflowT]
|
}, [nodeId, onChangeNode, openConfirm, workflowT]);
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeCard minW={'400px'} selected={selected} {...data}>
|
<NodeCard minW={'400px'} selected={selected} {...data}>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo, useState } from 'react';
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -15,8 +15,11 @@ import MyModal from '@fastgpt/web/components/common/MyModal';
|
|||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import MyTooltip from '@/components/MyTooltip';
|
import MyTooltip from '@/components/MyTooltip';
|
||||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||||
|
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||||
|
import { fnValueTypeSelect } from '@/web/core/workflow/constants/dataType';
|
||||||
|
|
||||||
export const defaultField: ContextExtractAgentItemType = {
|
export const defaultField: ContextExtractAgentItemType = {
|
||||||
|
valueType: 'string',
|
||||||
required: false,
|
required: false,
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
desc: '',
|
desc: '',
|
||||||
@@ -34,10 +37,11 @@ const ExtractFieldModal = ({
|
|||||||
onSubmit: (data: ContextExtractAgentItemType) => void;
|
onSubmit: (data: ContextExtractAgentItemType) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { register, handleSubmit, watch } = useForm<ContextExtractAgentItemType>({
|
const { register, setValue, handleSubmit, watch } = useForm<ContextExtractAgentItemType>({
|
||||||
defaultValues: defaultField
|
defaultValues: defaultField
|
||||||
});
|
});
|
||||||
const required = watch('required');
|
const required = watch('required');
|
||||||
|
const valueType = watch('valueType');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyModal
|
<MyModal
|
||||||
@@ -68,8 +72,21 @@ const ExtractFieldModal = ({
|
|||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Flex alignItems={'center'} mt={5}>
|
||||||
|
<Box flex={['0 0 80px', '0 0 100px']}>{t('core.module.Data Type')}</Box>
|
||||||
|
<Box flex={'1 0 0'}>
|
||||||
|
<MySelect
|
||||||
|
list={fnValueTypeSelect}
|
||||||
|
value={valueType}
|
||||||
|
onchange={(e: any) => {
|
||||||
|
setValue('valueType', e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Flex mt={5} alignItems={'center'}>
|
<Flex mt={5} alignItems={'center'}>
|
||||||
<Box flex={['0 0 80px', '0 0 100px']}>{t('core.module.Field key')}</Box>
|
<Box flex={['0 0 80px', '0 0 100px']}>{t('Field name')}</Box>
|
||||||
<Input
|
<Input
|
||||||
bg={'myGray.50'}
|
bg={'myGray.50'}
|
||||||
placeholder="name/age/sql"
|
placeholder="name/age/sql"
|
||||||
@@ -84,21 +101,23 @@ const ExtractFieldModal = ({
|
|||||||
{...register('desc', { required: true })}
|
{...register('desc', { required: true })}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box mt={5}>
|
{(valueType === 'string' || valueType === 'number') && (
|
||||||
<Flex alignItems={'center'}>
|
<Box mt={5}>
|
||||||
{t('core.module.extract.Enum Value')}({t('common.choosable')})
|
<Flex alignItems={'center'}>
|
||||||
<MyTooltip label={t('core.module.extract.Enum Description')} forceShow>
|
{t('core.module.extract.Enum Value')}({t('common.choosable')})
|
||||||
<QuestionOutlineIcon ml={1} />
|
<MyTooltip label={t('core.module.extract.Enum Description')} forceShow>
|
||||||
</MyTooltip>
|
<QuestionOutlineIcon ml={1} />
|
||||||
</Flex>
|
</MyTooltip>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Textarea
|
<Textarea
|
||||||
rows={5}
|
rows={5}
|
||||||
bg={'myGray.50'}
|
bg={'myGray.50'}
|
||||||
placeholder={'apple\npeach\nwatermelon'}
|
placeholder={'apple\npeach\nwatermelon'}
|
||||||
{...register('enum')}
|
{...register('enum')}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
|
@@ -18,7 +18,6 @@ import NodeCard from '../render/NodeCard';
|
|||||||
import Container from '../../components/Container';
|
import Container from '../../components/Container';
|
||||||
import { AddIcon } from '@chakra-ui/icons';
|
import { AddIcon } from '@chakra-ui/icons';
|
||||||
import RenderInput from '../render/RenderInput';
|
import RenderInput from '../render/RenderInput';
|
||||||
import Divider from '../../components/Divider';
|
|
||||||
import type { ContextExtractAgentItemType } from '@fastgpt/global/core/workflow/type/index.d';
|
import type { ContextExtractAgentItemType } from '@fastgpt/global/core/workflow/type/index.d';
|
||||||
import RenderOutput from '../render/RenderOutput';
|
import RenderOutput from '../render/RenderOutput';
|
||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
@@ -79,7 +78,7 @@ const NodeExtract = ({ data }: NodeProps<FlowNodeItemType>) => {
|
|||||||
<Table bg={'white'}>
|
<Table bg={'white'}>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th bg={'myGray.50'}>字段 key</Th>
|
<Th bg={'myGray.50'}>字段名</Th>
|
||||||
<Th bg={'myGray.50'}>字段描述</Th>
|
<Th bg={'myGray.50'}>字段描述</Th>
|
||||||
<Th bg={'myGray.50'}>必须</Th>
|
<Th bg={'myGray.50'}>必须</Th>
|
||||||
<Th bg={'myGray.50'}></Th>
|
<Th bg={'myGray.50'}></Th>
|
||||||
|
@@ -79,7 +79,6 @@ const NodeLaf = (props: NodeProps<FlowNodeItemType>) => {
|
|||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await putUpdateTeam({
|
await putUpdateTeam({
|
||||||
teamId: userInfo?.team.teamId || '',
|
|
||||||
lafAccount: { token: '', appid: '', pat: '' }
|
lafAccount: { token: '', appid: '', pat: '' }
|
||||||
});
|
});
|
||||||
initUserInfo();
|
initUserInfo();
|
||||||
|
@@ -2,10 +2,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|||||||
import { Box, Button, Card, Flex } from '@chakra-ui/react';
|
import { Box, Button, Card, Flex } from '@chakra-ui/react';
|
||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import type {
|
import type { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/index.d';
|
||||||
FlowNodeItemType,
|
|
||||||
FlowNodeTemplateType
|
|
||||||
} from '@fastgpt/global/core/workflow/type/index.d';
|
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useEditTitle } from '@/web/common/hooks/useEditTitle';
|
import { useEditTitle } from '@/web/common/hooks/useEditTitle';
|
||||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||||
@@ -16,7 +13,7 @@ import { ToolTargetHandle } from './Handle/ToolHandle';
|
|||||||
import { useEditTextarea } from '@fastgpt/web/hooks/useEditTextarea';
|
import { useEditTextarea } from '@fastgpt/web/hooks/useEditTextarea';
|
||||||
import { ConnectionSourceHandle, ConnectionTargetHandle } from './Handle/ConnectionHandle';
|
import { ConnectionSourceHandle, ConnectionTargetHandle } from './Handle/ConnectionHandle';
|
||||||
import { useDebug } from '../../hooks/useDebug';
|
import { useDebug } from '../../hooks/useDebug';
|
||||||
import { ResponseBox } from '@/components/ChatBox/WholeResponseModal';
|
import { ResponseBox } from '@/components/ChatBox/components/WholeResponseModal';
|
||||||
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
|
||||||
import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
||||||
import { storeNode2FlowNode, updateFlowNodeVersion } from '@/web/core/workflow/utils';
|
import { storeNode2FlowNode, updateFlowNodeVersion } from '@/web/core/workflow/utils';
|
||||||
@@ -27,7 +24,6 @@ import { useI18n } from '@/web/context/I18n';
|
|||||||
import { moduleTemplatesFlat } from '@fastgpt/global/core/workflow/template/constants';
|
import { moduleTemplatesFlat } from '@fastgpt/global/core/workflow/template/constants';
|
||||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||||
import MyTooltip from '@/components/MyTooltip';
|
import MyTooltip from '@/components/MyTooltip';
|
||||||
import { isEqual } from 'lodash';
|
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
|
|
||||||
type Props = FlowNodeItemType & {
|
type Props = FlowNodeItemType & {
|
||||||
|
@@ -20,6 +20,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
|
|||||||
import { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io.d';
|
import { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io.d';
|
||||||
import { useContextSelector } from 'use-context-selector';
|
import { useContextSelector } from 'use-context-selector';
|
||||||
import { WorkflowContext } from '@/components/core/workflow/context';
|
import { WorkflowContext } from '@/components/core/workflow/context';
|
||||||
|
import { fnValueTypeSelect } from '@/web/core/workflow/constants/dataType';
|
||||||
|
|
||||||
const EditFieldModal = ({
|
const EditFieldModal = ({
|
||||||
defaultValue = defaultEditFormData,
|
defaultValue = defaultEditFormData,
|
||||||
@@ -35,21 +36,6 @@ const EditFieldModal = ({
|
|||||||
});
|
});
|
||||||
const valueType = watch('valueType');
|
const valueType = watch('valueType');
|
||||||
|
|
||||||
const selectTypeList = useRef([
|
|
||||||
{
|
|
||||||
label: t('core.module.valueType.string'),
|
|
||||||
value: 'string'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('core.module.valueType.number'),
|
|
||||||
value: 'number'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('core.module.valueType.boolean'),
|
|
||||||
value: 'boolean'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
const { mutate: onclickSubmit } = useRequest({
|
const { mutate: onclickSubmit } = useRequest({
|
||||||
mutationFn: async (e: FlowNodeInputItemType) => {
|
mutationFn: async (e: FlowNodeInputItemType) => {
|
||||||
const inputConfig: FlowNodeInputItemType = {
|
const inputConfig: FlowNodeInputItemType = {
|
||||||
@@ -105,7 +91,7 @@ const EditFieldModal = ({
|
|||||||
<Box flex={'0 0 80px'}>{t('core.module.Data Type')}</Box>
|
<Box flex={'0 0 80px'}>{t('core.module.Data Type')}</Box>
|
||||||
<Box flex={'1 0 0'}>
|
<Box flex={'1 0 0'}>
|
||||||
<MySelect
|
<MySelect
|
||||||
list={selectTypeList.current}
|
list={fnValueTypeSelect}
|
||||||
value={valueType}
|
value={valueType}
|
||||||
onchange={(e: any) => {
|
onchange={(e: any) => {
|
||||||
setValue('valueType', e);
|
setValue('valueType', e);
|
||||||
|
@@ -84,7 +84,6 @@ const LafAccountModal = ({
|
|||||||
mutationFn: async (data: LafAccountType) => {
|
mutationFn: async (data: LafAccountType) => {
|
||||||
if (!userInfo?.team.teamId) return;
|
if (!userInfo?.team.teamId) return;
|
||||||
return putUpdateTeam({
|
return putUpdateTeam({
|
||||||
teamId: userInfo?.team.teamId,
|
|
||||||
lafAccount: data
|
lafAccount: data
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -142,7 +141,6 @@ const LafAccountModal = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
onResetForm();
|
onResetForm();
|
||||||
putUpdateTeam({
|
putUpdateTeam({
|
||||||
teamId: userInfo?.team.teamId || '',
|
|
||||||
lafAccount: { token: '', appid: '', pat: '' }
|
lafAccount: { token: '', appid: '', pat: '' }
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
@@ -83,7 +83,6 @@ function EditModal({
|
|||||||
mutationFn: async (data: FormDataType) => {
|
mutationFn: async (data: FormDataType) => {
|
||||||
if (!data.id) return Promise.resolve('');
|
if (!data.id) return Promise.resolve('');
|
||||||
return putUpdateTeam({
|
return putUpdateTeam({
|
||||||
teamId: data.id,
|
|
||||||
name: data.name,
|
name: data.name,
|
||||||
avatar: data.avatar
|
avatar: data.avatar
|
||||||
});
|
});
|
||||||
|
@@ -4,7 +4,6 @@ import { useTranslation } from 'next-i18next';
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
getTeamMembers,
|
getTeamMembers,
|
||||||
putUpdateMember,
|
|
||||||
delRemoveMember,
|
delRemoveMember,
|
||||||
getTeamList,
|
getTeamList,
|
||||||
delLeaveTeam,
|
delLeaveTeam,
|
||||||
@@ -68,17 +67,10 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
['getMembers', userInfo?.team?.teamId],
|
['getMembers', userInfo?.team?.teamId],
|
||||||
() => {
|
() => {
|
||||||
if (!userInfo?.team?.teamId) return [];
|
if (!userInfo?.team?.teamId) return [];
|
||||||
return getTeamMembers(userInfo.team.teamId);
|
return getTeamMembers();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const { mutate: onUpdateMember, isLoading: isLoadingUpdateMember } = useRequest({
|
|
||||||
mutationFn: putUpdateMember,
|
|
||||||
onSuccess() {
|
|
||||||
refetchMembers();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const { mutate: onRemoveMember, isLoading: isLoadingRemoveMember } = useRequest({
|
const { mutate: onRemoveMember, isLoading: isLoadingRemoveMember } = useRequest({
|
||||||
mutationFn: delRemoveMember,
|
mutationFn: delRemoveMember,
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
@@ -147,13 +139,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
<TeamList />
|
<TeamList />
|
||||||
<TeamCard />
|
<TeamCard />
|
||||||
<Loading
|
<Loading
|
||||||
loading={
|
loading={isLoadingRemoveMember || isLoadingTeams || isLoadingLeaveTeam || isSwitchTeam}
|
||||||
isLoadingUpdateMember ||
|
|
||||||
isLoadingRemoveMember ||
|
|
||||||
isLoadingTeams ||
|
|
||||||
isLoadingLeaveTeam ||
|
|
||||||
isSwitchTeam
|
|
||||||
}
|
|
||||||
fixed={false}
|
fixed={false}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
@@ -57,7 +57,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
|||||||
// tags Async
|
// tags Async
|
||||||
const { mutate: onclickUpdate, isLoading: isUpdating } = useRequest({
|
const { mutate: onclickUpdate, isLoading: isUpdating } = useRequest({
|
||||||
mutationFn: async (data: FormType) => {
|
mutationFn: async (data: FormType) => {
|
||||||
return putUpdateTeam({ teamDomain: data.teamDomain, teamId: teamInfo?.teamId });
|
return putUpdateTeam({ teamDomain: data.teamDomain });
|
||||||
},
|
},
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
initUserInfo();
|
initUserInfo();
|
||||||
|
@@ -59,7 +59,7 @@ const UsageTable = () => {
|
|||||||
const [selectTmbId, setSelectTmbId] = useState(userInfo?.team?.tmbId);
|
const [selectTmbId, setSelectTmbId] = useState(userInfo?.team?.tmbId);
|
||||||
const { data: members = [] } = useQuery(['getMembers', userInfo?.team?.teamId], () => {
|
const { data: members = [] } = useQuery(['getMembers', userInfo?.team?.teamId], () => {
|
||||||
if (!userInfo?.team?.teamId) return [];
|
if (!userInfo?.team?.teamId) return [];
|
||||||
return getTeamMembers(userInfo.team.teamId);
|
return getTeamMembers();
|
||||||
});
|
});
|
||||||
const tmbList = useMemo(
|
const tmbList = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
21
projects/app/src/pages/api/support/user/team/update.ts
Normal file
21
projects/app/src/pages/api/support/user/team/update.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';
|
||||||
|
import { NextAPI } from '@/service/middleware/entry';
|
||||||
|
import { UpdateTeamProps } from '@fastgpt/global/support/user/team/controller';
|
||||||
|
import { authTeamOwner } from '@fastgpt/service/support/permission/auth/user';
|
||||||
|
import { updateTeam } from '@fastgpt/service/support/user/team/controller';
|
||||||
|
|
||||||
|
export type updateQuery = {};
|
||||||
|
|
||||||
|
export type updateBody = {};
|
||||||
|
|
||||||
|
export type updateResponse = {};
|
||||||
|
|
||||||
|
async function handler(req: ApiRequestProps<updateBody, updateQuery>, res: ApiResponseType<any>) {
|
||||||
|
const body = req.body as UpdateTeamProps;
|
||||||
|
|
||||||
|
const { teamId } = await authTeamOwner({ req, authToken: true });
|
||||||
|
|
||||||
|
await updateTeam({ teamId, ...body });
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NextAPI(handler);
|
@@ -26,13 +26,13 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => {
|
|||||||
const redirectUri = `${location.origin}/login/provider`;
|
const redirectUri = `${location.origin}/login/provider`;
|
||||||
|
|
||||||
const oAuthList = [
|
const oAuthList = [
|
||||||
...(feConfigs?.oauth?.github
|
...(feConfigs?.oauth?.wechat && pageType !== LoginPageTypeEnum.wechat
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: t('support.user.login.Github'),
|
label: t('support.user.login.Wechat'),
|
||||||
provider: OAuthEnum.github,
|
provider: OAuthEnum.wechat,
|
||||||
icon: 'common/gitFill',
|
icon: 'common/wechatFill',
|
||||||
redirectUrl: `https://github.com/login/oauth/authorize?client_id=${feConfigs?.oauth?.github}&redirect_uri=${redirectUri}&state=${state.current}&scope=user:email%20read:user`
|
pageType: LoginPageTypeEnum.wechat
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
@@ -46,13 +46,13 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
...(feConfigs?.oauth?.wechat && pageType !== LoginPageTypeEnum.wechat
|
...(feConfigs?.oauth?.github
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: t('support.user.login.Wechat'),
|
label: t('support.user.login.Github'),
|
||||||
provider: OAuthEnum.wechat,
|
provider: OAuthEnum.github,
|
||||||
icon: 'common/wechatFill',
|
icon: 'common/gitFill',
|
||||||
pageType: LoginPageTypeEnum.wechat
|
redirectUrl: `https://github.com/login/oauth/authorize?client_id=${feConfigs?.oauth?.github}&redirect_uri=${redirectUri}&state=${state.current}&scope=user:email%20read:user`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
@@ -118,7 +118,6 @@ function responseError(
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
putUpdateTeam({
|
putUpdateTeam({
|
||||||
teamId: useUserStore.getState().userInfo?.team.teamId || '',
|
|
||||||
lafAccount: {
|
lafAccount: {
|
||||||
...useUserStore.getState().userInfo?.team?.lafAccount,
|
...useUserStore.getState().userInfo?.team?.lafAccount,
|
||||||
token: res
|
token: res
|
||||||
|
@@ -85,3 +85,18 @@ export const FlowValueTypeMap = {
|
|||||||
description: ''
|
description: ''
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const fnValueTypeSelect = [
|
||||||
|
{
|
||||||
|
label: 'String',
|
||||||
|
value: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Number',
|
||||||
|
value: 'number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Boolean',
|
||||||
|
value: 'boolean'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
@@ -22,18 +22,15 @@ export const getTeamList = (status: `${TeamMemberSchema['status']}`) =>
|
|||||||
GET<TeamItemType[]>(`/proApi/support/user/team/list`, { status });
|
GET<TeamItemType[]>(`/proApi/support/user/team/list`, { status });
|
||||||
export const postCreateTeam = (data: CreateTeamProps) =>
|
export const postCreateTeam = (data: CreateTeamProps) =>
|
||||||
POST<string>(`/proApi/support/user/team/create`, data);
|
POST<string>(`/proApi/support/user/team/create`, data);
|
||||||
export const putUpdateTeam = (data: UpdateTeamProps) =>
|
export const putUpdateTeam = (data: UpdateTeamProps) => PUT(`/support/user/team/update`, data);
|
||||||
PUT(`/proApi/support/user/team/update`, data);
|
|
||||||
export const putSwitchTeam = (teamId: string) =>
|
export const putSwitchTeam = (teamId: string) =>
|
||||||
PUT<string>(`/proApi/support/user/team/switch`, { teamId });
|
PUT<string>(`/proApi/support/user/team/switch`, { teamId });
|
||||||
|
|
||||||
/* --------------- team member ---------------- */
|
/* --------------- team member ---------------- */
|
||||||
export const getTeamMembers = (teamId: string) =>
|
export const getTeamMembers = () =>
|
||||||
GET<TeamMemberItemType[]>(`/proApi/support/user/team/member/list`, { teamId });
|
GET<TeamMemberItemType[]>(`/proApi/support/user/team/member/list`);
|
||||||
export const postInviteTeamMember = (data: InviteMemberProps) =>
|
export const postInviteTeamMember = (data: InviteMemberProps) =>
|
||||||
POST<InviteMemberResponse>(`/proApi/support/user/team/member/invite`, data);
|
POST<InviteMemberResponse>(`/proApi/support/user/team/member/invite`, data);
|
||||||
export const putUpdateMember = (data: UpdateTeamMemberProps) =>
|
|
||||||
PUT(`/proApi/support/user/team/member/update`, data);
|
|
||||||
export const putUpdateMemberName = (name: string) =>
|
export const putUpdateMemberName = (name: string) =>
|
||||||
PUT(`/proApi/support/user/team/member/updateName`, { name });
|
PUT(`/proApi/support/user/team/member/updateName`, { name });
|
||||||
export const delRemoveMember = (props: DelMemberProps) =>
|
export const delRemoveMember = (props: DelMemberProps) =>
|
||||||
|
Reference in New Issue
Block a user