⚡ (openai) Add Messages sequence type
To make it easy to just plug a sequence of user / assistant messages to Chat completion task Closes #387
This commit is contained in:
@@ -103,7 +103,12 @@ const saveVariableValueIfAny =
|
||||
if (!foundVariable) return state
|
||||
|
||||
const newSessionState = await updateVariables(state)([
|
||||
{ ...foundVariable, value: reply },
|
||||
{
|
||||
...foundVariable,
|
||||
value: Array.isArray(foundVariable.value)
|
||||
? foundVariable.value.concat(reply)
|
||||
: reply,
|
||||
},
|
||||
])
|
||||
|
||||
return newSessionState
|
||||
|
||||
@@ -124,15 +124,12 @@ const computeRuntimeOptions =
|
||||
|
||||
const getPrefilledInputValue =
|
||||
(variables: SessionState['typebot']['variables']) => (block: InputBlock) => {
|
||||
return (
|
||||
variables
|
||||
.find(
|
||||
(variable) =>
|
||||
variable.id === block.options.variableId &&
|
||||
isDefined(variable.value)
|
||||
)
|
||||
?.value?.toString() ?? undefined
|
||||
)
|
||||
const variableValue = variables.find(
|
||||
(variable) =>
|
||||
variable.id === block.options.variableId && isDefined(variable.value)
|
||||
)?.value
|
||||
if (!variableValue || Array.isArray(variableValue)) return
|
||||
return variableValue
|
||||
}
|
||||
|
||||
const parseBubbleBlock =
|
||||
|
||||
Reference in New Issue
Block a user