Skip to content

Commit 7942805

Browse files
authored
fix: usage repeat (#5735)
* fix: usage repeat * remove invalid code
1 parent b8c2c7a commit 7942805

File tree

3 files changed

+53
-50
lines changed

3 files changed

+53
-50
lines changed

packages/service/core/workflow/dispatch/ai/agent/toolCall.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ export const runToolCall = async (
386386
initToolNodes(runtimeNodes, [toolNode.nodeId], startParams);
387387
const toolRunResponse = await runWorkflow({
388388
...workflowProps,
389+
usageId: undefined,
389390
isToolCall: true
390391
});
391392

packages/service/support/wallet/usage/schema.ts

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,60 @@ import {
88
} from '@fastgpt/global/support/user/team/constant';
99
import { UsageCollectionName, UsageItemCollectionName } from './constants';
1010

11-
const UsageSchema = new Schema({
12-
teamId: {
13-
type: Schema.Types.ObjectId,
14-
ref: TeamCollectionName,
15-
required: true
16-
},
17-
tmbId: {
18-
type: Schema.Types.ObjectId,
19-
ref: TeamMemberCollectionName,
20-
required: true
21-
},
22-
source: {
23-
type: String,
24-
enum: Object.values(UsageSourceEnum),
25-
required: true
26-
},
27-
appName: {
28-
// usage name
29-
type: String,
30-
default: ''
31-
},
32-
totalPoints: {
33-
// total points
34-
type: Number,
35-
required: true
36-
},
37-
appId: {
38-
type: Schema.Types.ObjectId,
39-
ref: 'apps',
40-
required: false
41-
},
42-
pluginId: {
43-
type: Schema.Types.ObjectId,
44-
ref: 'plugins',
45-
required: false
46-
},
47-
time: {
48-
type: Date,
49-
default: () => new Date()
50-
},
11+
const UsageSchema = new Schema(
12+
{
13+
teamId: {
14+
type: Schema.Types.ObjectId,
15+
ref: TeamCollectionName,
16+
required: true
17+
},
18+
tmbId: {
19+
type: Schema.Types.ObjectId,
20+
ref: TeamMemberCollectionName,
21+
required: true
22+
},
23+
source: {
24+
type: String,
25+
enum: Object.values(UsageSourceEnum),
26+
required: true
27+
},
28+
appName: {
29+
// usage name
30+
type: String,
31+
default: ''
32+
},
33+
totalPoints: {
34+
// total points
35+
type: Number,
36+
required: true
37+
},
38+
appId: {
39+
type: Schema.Types.ObjectId,
40+
ref: 'apps',
41+
required: false
42+
},
43+
pluginId: {
44+
type: Schema.Types.ObjectId,
45+
ref: 'plugins',
46+
required: false
47+
},
48+
time: {
49+
type: Date,
50+
default: () => new Date()
51+
},
5152

52-
// @description It will not be used again in the future.
53-
list: {
54-
type: Array
53+
// @description It will not be used again in the future.
54+
list: {
55+
type: Array
56+
}
57+
},
58+
{
59+
// Auto update time
60+
timestamps: {
61+
updatedAt: 'time'
62+
}
5563
}
56-
});
64+
);
5765

5866
UsageSchema.virtual('usageItems', {
5967
ref: UsageItemCollectionName,

packages/service/support/wallet/usage/type.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)