Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
d057ba29
authored
May 06, 2024
by
Archer
Committed by
GitHub
May 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: custom feedback plugin (#1365)
parent
b500631a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
17 deletions
+30
-17
packages/service/core/workflow/dispatch/index.ts
+30
-16
projects/app/data/pluginTemplates/customFeedback.json
+0
-0
projects/app/src/service/support/wallet/usage/push.ts
+0
-1
No files found.
packages/service/core/workflow/dispatch/index.ts
View file @
d057ba29
...
@@ -69,21 +69,25 @@ const callbackMap: Record<`${FlowNodeTypeEnum}`, Function> = {
...
@@ -69,21 +69,25 @@ const callbackMap: Record<`${FlowNodeTypeEnum}`, Function> = {
[
FlowNodeTypeEnum
.
globalVariable
]:
()
=>
Promise
.
resolve
()
[
FlowNodeTypeEnum
.
globalVariable
]:
()
=>
Promise
.
resolve
()
};
};
/* running */
type
Props
=
ChatDispatchProps
&
{
export
async
function
dispatchWorkFlow
({
res
,
runtimeNodes
=
[],
runtimeEdges
=
[],
histories
=
[],
variables
=
{},
user
,
stream
=
false
,
detail
=
false
,
...
props
}:
ChatDispatchProps
&
{
runtimeNodes
:
RuntimeNodeItemType
[];
runtimeNodes
:
RuntimeNodeItemType
[];
runtimeEdges
:
RuntimeEdgeItemType
[];
runtimeEdges
:
RuntimeEdgeItemType
[];
}):
Promise
<
DispatchFlowResponse
>
{
};
/* running */
export
async
function
dispatchWorkFlow
(
data
:
Props
):
Promise
<
DispatchFlowResponse
>
{
let
{
res
,
runtimeNodes
=
[],
runtimeEdges
=
[],
histories
=
[],
variables
=
{},
user
,
stream
=
false
,
detail
=
false
,
...
props
}
=
data
;
// set sse response headers
// set sse response headers
if
(
stream
&&
res
)
{
if
(
stream
&&
res
)
{
res
.
setHeader
(
'Content-Type'
,
'text/event-stream;charset=utf-8'
);
res
.
setHeader
(
'Content-Type'
,
'text/event-stream;charset=utf-8'
);
...
@@ -93,7 +97,7 @@ export async function dispatchWorkFlow({
...
@@ -93,7 +97,7 @@ export async function dispatchWorkFlow({
}
}
variables
=
{
variables
=
{
...
getSystemVariable
(
{
timezone
:
user
.
timezone
}
),
...
getSystemVariable
(
data
),
...
variables
...
variables
};
};
...
@@ -384,9 +388,19 @@ export function responseStatus({
...
@@ -384,9 +388,19 @@ export function responseStatus({
}
}
/* get system variable */
/* get system variable */
export
function
getSystemVariable
({
timezone
}:
{
timezone
:
string
})
{
export
function
getSystemVariable
({
user
,
appId
,
chatId
,
responseChatItemId
,
histories
=
[]
}:
Props
)
{
return
{
return
{
cTime
:
getSystemTime
(
timezone
)
appId
,
chatId
,
responseChatItemId
,
histories
,
cTime
:
getSystemTime
(
user
.
timezone
)
};
};
}
}
...
...
projects/app/data/pluginTemplates/customFeedback.json
View file @
d057ba29
This diff is collapsed.
Click to expand it.
projects/app/src/service/support/wallet/usage/push.ts
View file @
d057ba29
...
@@ -42,7 +42,6 @@ export const pushChatUsage = ({
...
@@ -42,7 +42,6 @@ export const pushChatUsage = ({
addLog
.
info
(
`finish completions`
,
{
addLog
.
info
(
`finish completions`
,
{
source
,
source
,
teamId
,
teamId
,
tmbId
,
totalPoints
totalPoints
});
});
return
{
totalPoints
};
return
{
totalPoints
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment