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
a4c5216c
authored
Jun 22, 2026
by
Archer
Committed by
GitHub
Jun 22, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract log (#7161)
parent
01d716f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
+40
-1
packages/service/core/workflow/dispatch/ai/extract.ts
+21
-1
packages/service/test/core/workflow/dispatch/ai/extract.test.ts
+19
-0
No files found.
packages/service/core/workflow/dispatch/ai/extract.ts
View file @
a4c5216c
...
...
@@ -241,12 +241,32 @@ const completions = async (props: ActionProps) => {
}
try
{
const
arg
=
json5
.
parse
(
jsonStr
);
if
(
!
arg
||
typeof
arg
!==
'object'
||
Array
.
isArray
(
arg
))
{
logger
.
warn
(
'Content extract result is not an object'
,
{
requestId
,
model
:
extractModel
.
model
,
finishReason
,
answerLength
:
answer
.
length
,
jsonLength
:
jsonStr
.
length
,
resultType
:
Array
.
isArray
(
arg
)
?
'array'
:
typeof
arg
});
return
{
rawResponse
:
answer
,
inputTokens
,
outputTokens
,
usedUserOpenAIKey
,
arg
:
{}
};
}
return
{
rawResponse
:
answer
,
inputTokens
,
outputTokens
,
usedUserOpenAIKey
,
arg
:
json5
.
parse
(
jsonStr
)
as
Record
<
string
,
any
>
arg
:
arg
as
Record
<
string
,
any
>
};
}
catch
(
error
)
{
logger
.
warn
(
'Failed to parse extract result'
,
{
...
...
packages/service/test/core/workflow/dispatch/ai/extract.test.ts
View file @
a4c5216c
...
...
@@ -209,6 +209,25 @@ describe('dispatchContentExtract', () => {
});
});
it
(
'ignores scalar JSON responses and keeps the workflow running'
,
async
()
=>
{
getLLMModelMock
.
mockReturnValue
({
model
:
'gpt-4o'
,
name
:
'GPT-4o'
,
maxContext
:
128000
,
reasoning
:
false
,
toolChoice
:
false
});
createLLMResponseMock
.
mockResolvedValue
(
mockLLMResponse
(
'1'
));
const
result
=
await
dispatchContentExtract
(
createProps
());
expect
(
result
.
data
).
toMatchObject
({
success
:
true
,
name
:
''
});
expect
(
result
.
error
).
toBeUndefined
();
});
it
(
'extracts multiple fields and removes fields outside the schema'
,
async
()
=>
{
getLLMModelMock
.
mockReturnValue
({
model
:
'gpt-4o'
,
...
...
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