Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-mindworkplate
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 78ed5c19
authored
Jun 26, 2026
by
潘诗林
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:大模型解析优化
1 parent
87abdb57
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/prelearn/PreLearnBigModelService.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/prelearn/PreLearnBigModelService.java
View file @
78ed5c1
...
@@ -286,7 +286,7 @@ public class PreLearnBigModelService {
...
@@ -286,7 +286,7 @@ public class PreLearnBigModelService {
public
void
pollTaskResults
()
{
public
void
pollTaskResults
()
{
log
.
info
(
"pollTaskResults: 开始轮询大模型任务结果"
);
log
.
info
(
"pollTaskResults: 开始轮询大模型任务结果"
);
List
<
PreLearnProductScript
>
pendingList
=
preLearnProductScriptMapper
List
<
PreLearnProductScript
>
pendingList
=
preLearnProductScriptMapper
.
selectPendingPolling
(
AiStatusEnum
.
GENERATING
.
getValue
(),
2
0
);
.
selectPendingPolling
(
AiStatusEnum
.
GENERATING
.
getValue
(),
5
0
);
if
(
CollectionUtils
.
isEmpty
(
pendingList
))
{
if
(
CollectionUtils
.
isEmpty
(
pendingList
))
{
log
.
info
(
"pollTaskResults: 无待轮询的记录"
);
log
.
info
(
"pollTaskResults: 无待轮询的记录"
);
...
@@ -308,21 +308,47 @@ public class PreLearnBigModelService {
...
@@ -308,21 +308,47 @@ public class PreLearnBigModelService {
TaskQueryResult
result
=
queryTaskResult
(
script
.
getModelTaskId
());
TaskQueryResult
result
=
queryTaskResult
(
script
.
getModelTaskId
());
if
(
result
.
isCompleted
())
{
if
(
result
.
isCompleted
())
{
// 成功: 写入response_content,更新状态为READY
// 检查 scriptJson 外层的 is_legal 字段
boolean
isLegal
=
false
;
String
legalMsg
=
null
;
if
(
StringUtils
.
hasText
(
result
.
getScriptJson
()))
{
try
{
JSONObject
outerJson
=
JSONObject
.
parseObject
(
result
.
getScriptJson
());
if
(
outerJson
.
containsKey
(
"is_legal"
)
&&
outerJson
.
getBooleanValue
(
"is_legal"
))
{
isLegal
=
true
;
legalMsg
=
outerJson
.
getString
(
"msg"
);
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"pollTaskResults: 解析is_legal失败, scriptId={}"
,
script
.
getId
(),
e
);
}
}
if
(
isLegal
)
{
// 合法: 写入response_content,更新状态为READY
preLearnProductScriptMapper
.
updateScriptReady
(
preLearnProductScriptMapper
.
updateScriptReady
(
script
.
getId
(),
script
.
getId
(),
result
.
getScriptJson
(),
result
.
getScriptJson
(),
"READY"
);
AiStatusEnum
.
READY
.
getValue
()
);
log
.
info
(
"pollTaskResults: 剧本生成成功, scriptId={}, taskId={}"
,
log
.
info
(
"pollTaskResults: 剧本生成成功, scriptId={}, taskId={}"
,
script
.
getId
(),
script
.
getModelTaskId
());
script
.
getId
(),
script
.
getModelTaskId
());
readyCount
++;
readyCount
++;
}
else
{
// is_legal=false: 标记为FAILED,记录msg
preLearnProductScriptMapper
.
updateScriptFailed
(
script
.
getId
(),
legalMsg
,
AiStatusEnum
.
FAILED
.
getValue
());
log
.
warn
(
"pollTaskResults: 剧本不合法, scriptId={}, taskId={}, msg={}"
,
script
.
getId
(),
script
.
getModelTaskId
(),
legalMsg
);
failedCount
++;
}
}
else
if
(
result
.
isFailed
())
{
}
else
if
(
result
.
isFailed
())
{
// 失败: 写入error_msg,更新状态为FAILED
//
大模型调用
失败: 写入error_msg,更新状态为FAILED
preLearnProductScriptMapper
.
updateScriptFailed
(
preLearnProductScriptMapper
.
updateScriptFailed
(
script
.
getId
(),
script
.
getId
(),
result
.
getErrorMsg
(),
result
.
getErrorMsg
(),
"FAILED"
);
AiStatusEnum
.
FAILED
.
getValue
()
);
log
.
warn
(
"pollTaskResults: 剧本生成失败, scriptId={}, taskId={}, error={}"
,
log
.
warn
(
"pollTaskResults: 剧本生成失败, scriptId={}, taskId={}, error={}"
,
script
.
getId
(),
script
.
getModelTaskId
(),
result
.
getErrorMsg
());
script
.
getId
(),
script
.
getModelTaskId
(),
result
.
getErrorMsg
());
failedCount
++;
failedCount
++;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment