Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

571 variable interpolation #589

Merged
merged 70 commits into from
Oct 22, 2024
Merged

571 variable interpolation #589

merged 70 commits into from
Oct 22, 2024

Conversation

iandjx
Copy link
Collaborator

@iandjx iandjx commented Sep 30, 2024

  • Enhanced the CrewAppForm component to handle variable choices and kickoff variables, including UI updates.
  • Integrated variable selection and creation in SortableItem and TaskForm components.
  • Added session variable update logic in StructuredInputForm with API integration.
  • Refactored task building logic in agent-backend with helper functions and session variable interpolation.
  • Simplified variable fetching logic in the database layer.
  • Added new helper functions for task management in agent-backend.
  • Improved session and task API logic to handle new variable-related features.

iandjx and others added 30 commits September 18, 2024 14:19
@iandjx iandjx marked this pull request as ready for review October 4, 2024 00:54
Copy link
Contributor

@tomlynchRNA tomlynchRNA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments apply to agents and tasks even if I only commented one one

isStructuredOutput,
variableIds: (variableIds || []).map(toObjectId)
variableIds: (variableIds || []).map(toObjectId),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A variable ID here can refer to a variable that was deleted

const selectedAgents = agentIds?.map(a => agentChoices.find(ac => ac._id === a));
const variableIdsOfSelectedAgents = selectedAgents?.map(a => a?.variableIds || []).flat();
const variablesOfSelectedAgents = variableIdsOfSelectedAgents?.map(v =>
variableChoices?.find(vc => vc._id === v)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable may not be found, suggest to filter this list for safety but also handle this in backend when saving tasks, agents, etc

setKickOffVariables(v || []);
}}
options={combinedVariables.map(v => ({
label: v.name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncaught error here because the variable can be null see above comment

crewAppVariables.push(...variables);

variables.forEach(variable => {
if (!crewAppVariables.some(v => (v._id as ObjectId).equals(variable._id))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable can be null, need to handle or filter above

@iandjx
Copy link
Collaborator Author

iandjx commented Oct 4, 2024

comments apply to agents and tasks even if I only commented one one

Added changes such that error gets returned if a non-existent variable is included when adding a new agent/task or editing an agent/task

Added logic to fitler out undefined variables in crewapp form

tested by

  1. deleting a variable before hitting save when adding/editing a task/agent
  2. deleting a variable before creating a new app

@ragyabraham ragyabraham merged commit f1b3208 into develop Oct 22, 2024
7 checks passed
@ragyabraham ragyabraham deleted the 571-variable-interpolation branch October 22, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants