Feature/OpenAI Response API (#5014)

* - Added support for built-in OpenAI tools including web search, code interpreter, and image generation.
- Enhanced file handling by extracting artifacts and file annotations from response metadata.
- Implemented download functionality for file annotations in the UI.
- Updated chat history management to include additional kwargs for artifacts, file annotations, and used tools.
- Improved UI components to display used tools and file annotations effectively.

* remove redundant currentContainerId

* update comment
This commit is contained in:
Henry Heng
2025-08-07 17:59:05 +01:00
committed by GitHub
parent 3187377c61
commit b608219642
7 changed files with 860 additions and 14 deletions
+58 -1
View File
@@ -244,6 +244,63 @@ export const updateOutdatedNodeData = (newComponentNodeData, existingComponentNo
}
}
}
// Handle loadConfig parameters - preserve configuration objects
if (existingComponentNodeData.inputs && initNewComponentNodeData.inputParams) {
// Find parameters with loadConfig: true
const loadConfigParams = initNewComponentNodeData.inputParams.filter((param) => param.loadConfig === true)
for (const param of loadConfigParams) {
const configKey = `${param.name}Config`
// Preserve top-level config objects (e.g., agentModelConfig)
if (existingComponentNodeData.inputs[configKey]) {
initNewComponentNodeData.inputs[configKey] = existingComponentNodeData.inputs[configKey]
}
}
// Handle array parameters that might contain loadConfig items
const arrayParams = initNewComponentNodeData.inputParams.filter((param) => param.type === 'array' && param.array)
for (const arrayParam of arrayParams) {
if (existingComponentNodeData.inputs[arrayParam.name] && Array.isArray(existingComponentNodeData.inputs[arrayParam.name])) {
const existingArray = existingComponentNodeData.inputs[arrayParam.name]
// Find loadConfig parameters within the array definition
const arrayLoadConfigParams = arrayParam.array.filter((subParam) => subParam.loadConfig === true)
if (arrayLoadConfigParams.length > 0) {
// Process each array item to preserve config objects
const updatedArray = existingArray.map((existingItem) => {
if (typeof existingItem === 'object' && existingItem !== null) {
const updatedItem = { ...existingItem }
// Preserve config objects for each loadConfig parameter in the array
for (const loadConfigParam of arrayLoadConfigParams) {
const configKey = `${loadConfigParam.name}Config`
if (existingItem[configKey]) {
updatedItem[configKey] = existingItem[configKey]
}
}
return updatedItem
}
return existingItem
})
initNewComponentNodeData.inputs[arrayParam.name] = updatedArray
}
}
}
// Also preserve any config keys that exist in the existing data but might not be explicitly handled above
// This catches edge cases where config keys exist but don't follow the expected pattern
for (const key in existingComponentNodeData.inputs) {
if (key.endsWith('Config') && !initNewComponentNodeData.inputs[key]) {
initNewComponentNodeData.inputs[key] = existingComponentNodeData.inputs[key]
}
}
}
// Check for tabs
const inputParamsWithTabIdentifiers = initNewComponentNodeData.inputParams.filter((param) => param.tabIdentifier) || []
@@ -268,7 +325,7 @@ export const updateOutdatedNodeData = (newComponentNodeData, existingComponentNo
initNewComponentNodeData.label = existingComponentNodeData.label
}
// Special case for Condition node to update outputAnchors
// Special case for Sequential Condition node to update outputAnchors
if (initNewComponentNodeData.name.includes('seqCondition')) {
const options = existingComponentNodeData.outputAnchors[0].options || []