Skip to content

Commit 661ee79

Browse files
authored
fix: CQ module output (#445)
1 parent 60ee160 commit 661ee79

File tree

7 files changed

+72
-6
lines changed

7 files changed

+72
-6
lines changed

packages/global/support/user/constant.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,24 @@ export const InformTypeMap = {
77
label: '系统通知'
88
}
99
};
10+
11+
export enum TeamMemberRoleEnum {
12+
owner = 'owner',
13+
admin = 'admin',
14+
member = 'member',
15+
visitor = 'visitor'
16+
}
17+
export const TeamMemberRoleMap = {
18+
[TeamMemberRoleEnum.owner]: {
19+
label: 'user.team.role.owner'
20+
},
21+
[TeamMemberRoleEnum.admin]: {
22+
label: 'user.team.role.admin'
23+
},
24+
[TeamMemberRoleEnum.member]: {
25+
label: 'user.team.role.member'
26+
},
27+
[TeamMemberRoleEnum.visitor]: {
28+
label: 'user.team.role.visitor'
29+
}
30+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export type CreateTeamProps = {
2+
ownerId: string;
3+
name: string;
4+
avatar?: string;
5+
};
6+
export type UpdateTeamProps = {
7+
id: string;
8+
name?: string;
9+
avatar?: string;
10+
};
11+
export type updateTeamBalanceProps = {
12+
id: string;
13+
balance: number;
14+
};
15+
16+
export type CreateTeamMemberProps = {
17+
ownerId: string;
18+
teamId: string;
19+
userId: string;
20+
name?: string;
21+
};

packages/global/support/user/type.d.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { InformTypeEnum } from './constant';
1+
import { InformTypeEnum, TeamMemberRoleEnum } from './constant';
22

33
export type UserModelSchema = {
44
_id: string;
@@ -30,3 +30,19 @@ export type UserInformSchema = {
3030
content: string;
3131
read: boolean;
3232
};
33+
34+
export type TeamSchema = {
35+
_id: string;
36+
name: string;
37+
ownerId: string;
38+
avatar: string;
39+
createTime: Date;
40+
};
41+
42+
export type TeamMemberSchema = {
43+
_id: string;
44+
name: string;
45+
teamId: string;
46+
userId: string;
47+
role: `${TeamMemberRoleEnum}`;
48+
};

packages/service/support/user/schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { hashStr } from '@fastgpt/global/common/string/tools';
44
import { PRICE_SCALE } from '@fastgpt/global/common/bill/constants';
55
import type { UserModelSchema } from '@fastgpt/global/support/user/type';
66

7+
export const userCollectionName = 'users';
8+
79
const UserSchema = new Schema({
810
username: {
911
// 可以是手机/邮箱,新的验证都只用手机
@@ -60,4 +62,5 @@ const UserSchema = new Schema({
6062
}
6163
});
6264

63-
export const MongoUser: Model<UserModelSchema> = models['user'] || model('user', UserSchema);
65+
export const MongoUser: Model<UserModelSchema> =
66+
models[userCollectionName] || model(userCollectionName, UserSchema);

projects/app/src/components/core/module/Flow/components/nodes/NodeCQNode.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,13 @@ const NodeCQNode = ({ data }: NodeProps<FlowModuleItemType>) => {
121121

122122
onChangeNode({
123123
moduleId,
124-
type: 'updateOutput',
125-
key: agentKey,
126-
value: outputs.concat({
124+
type: 'addOutput',
125+
value: {
127126
key,
128127
label: '',
129128
type: FlowNodeOutputTypeEnum.hidden,
130129
targets: []
131-
})
130+
}
132131
});
133132
}}
134133
>

projects/app/src/service/moduleDispatch/agent/classifyQuestion.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ ${systemPrompt}
127127
tokens: response.usage?.total_tokens || 0
128128
};
129129
} catch (error) {
130+
console.log(agentFunction.parameters);
131+
console.log(response.choices?.[0]?.message);
132+
130133
console.log('Your model may not support function_call', error);
131134

132135
return {

projects/app/src/service/moduleDispatch/agent/extract.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ async function functionCall({
141141
try {
142142
return JSON.parse(response.choices?.[0]?.message?.function_call?.arguments || '{}');
143143
} catch (error) {
144+
console.log(agentFunction.parameters);
145+
console.log(response.choices?.[0]?.message);
146+
console.log('Your model may not support function_call', error);
144147
return {};
145148
}
146149
})();

0 commit comments

Comments
 (0)