Chore/API for AgentflowV2 (#4696)

* Enhancement: Introduce prepended chat history handling in Agent and LLM nodes.

- Added support for `prependedChatHistory` in both `Agent` and `LLM` classes to allow for initial message context.
- Implemented validation for history schema in execution flow to ensure proper format.
- Refactored utility functions to include JSON sanitization and validation methods for improved data handling.

* update prediction swagger
This commit is contained in:
Henry Heng
2025-06-22 13:16:35 +01:00
committed by GitHub
parent 035b5555a9
commit 543800562e
9 changed files with 426 additions and 89 deletions
@@ -48,21 +48,30 @@ const OverrideConfigTable = ({ columns, onToggle, rows, sx }) => {
return <SwitchInput onChange={(enabled) => handleChange(enabled, row)} value={row.enabled} />
} else if (key === 'type' && row.schema) {
// If there's schema information, add a tooltip
const schemaContent =
'[<br>' +
row.schema
.map(
(item) =>
`&nbsp;&nbsp;${JSON.stringify(
{
[item.name]: item.type
},
null,
2
)}`
)
.join(',<br>') +
'<br>]'
let schemaContent
if (Array.isArray(row.schema)) {
// Handle array format: [{ name: "field", type: "string" }, ...]
schemaContent =
'[<br>' +
row.schema
.map(
(item) =>
`&nbsp;&nbsp;${JSON.stringify(
{
[item.name]: item.type
},
null,
2
)}`
)
.join(',<br>') +
'<br>]'
} else if (typeof row.schema === 'object' && row.schema !== null) {
// Handle object format: { "field": "string", "field2": "number", ... }
schemaContent = JSON.stringify(row.schema, null, 2).replace(/\n/g, '<br>').replace(/ /g, '&nbsp;')
} else {
schemaContent = 'No schema available'
}
return (
<Stack direction='row' alignItems='center' spacing={1}>
+24 -15
View File
@@ -11,21 +11,30 @@ export const TableViewOnly = ({ columns, rows, sx }) => {
return row[key] ? <Chip label='Enabled' color='primary' /> : <Chip label='Disabled' />
} else if (key === 'type' && row.schema) {
// If there's schema information, add a tooltip
const schemaContent =
'[<br>' +
row.schema
.map(
(item) =>
`&nbsp;&nbsp;${JSON.stringify(
{
[item.name]: item.type
},
null,
2
)}`
)
.join(',<br>') +
'<br>]'
let schemaContent
if (Array.isArray(row.schema)) {
// Handle array format: [{ name: "field", type: "string" }, ...]
schemaContent =
'[<br>' +
row.schema
.map(
(item) =>
`&nbsp;&nbsp;${JSON.stringify(
{
[item.name]: item.type
},
null,
2
)}`
)
.join(',<br>') +
'<br>]'
} else if (typeof row.schema === 'object' && row.schema !== null) {
// Handle object format: { "field": "string", "field2": "number", ... }
schemaContent = JSON.stringify(row.schema, null, 2).replace(/\n/g, '<br>').replace(/ /g, '&nbsp;')
} else {
schemaContent = 'No schema available'
}
return (
<Stack direction='row' alignItems='center' spacing={1}>