Skip to content

Commit 39f3aed

Browse files
committed
Limit DedupT(AI) query output to 20000 characters
related: runtimes/automation/issues/667 Signed-off-by: Lan Xia <[email protected]>
1 parent fbf78a2 commit 39f3aed

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

TestResultSummaryService/routes/getPossibleIssuesByAI.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ module.exports = async (req, res) => {
2626
// TODO: output should be refined to error and exeception only
2727
}
2828
if (output) {
29-
output += testName + ' ';
29+
// DedupT API has character limit of 20000.
30+
// If the testName + output is > 20000 characters, get only last 20000 characters in the output.
31+
output = output.substring(
32+
Math.max(0, output.length + (testName.length + 1) - 20000),
33+
output.length
34+
);
35+
output = testName + output;
3036
const response = await got.post(
3137
'http://9.46.100.175:8080/search',
3238
{
@@ -50,7 +56,7 @@ module.exports = async (req, res) => {
5056
});
5157
}
5258
} else {
53-
res.send('expect testName query parameter');
59+
res.send('expect testName and testOutputId query parameter');
5460
}
5561
} catch (error) {
5662
const rawError = error.response?.data || error.message;

test-result-summary-client/src/Build/PossibleIssuesByAI.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ const PossibleIssuesByAI = ({
5858
dataIndex: 'rationale',
5959
key: 'rationale',
6060
render: (value) => {
61-
return <pre>{value}</pre>;
61+
return value.map((item) => {
62+
return <pre>{item}</pre>;
63+
});
6264
},
6365
},
6466
];

0 commit comments

Comments
 (0)