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

Fix #68: Improve AGiXT SDK Integration in ADHD Task Management Panel #70

Closed
wants to merge 2 commits into from

Conversation

birdup000
Copy link
Owner

Resolves #68

The following modifications were applied:

<modification>
  <file>app/hooks/useAIAssistant.ts</file>
  <operation>replace</operation>
  <target>      const result = await agixt.runChain(
        'Task Suggestions',
        prompt,
        selectedAgent,
        false,
        1,
        { conversation_name: `task_suggestions_${Date.now()}` }
      );</target>
  <content>      const result = await agixt.runChain(
        'Task Suggestions',
        prompt,
        selectedAgent,
        { conversation_name: `task_suggestions_${Date.now()}` }
      );</content>
</modification>
<modification>
  <file>app/hooks/useAIAssistant.ts</file>
  <operation>replace</operation>
  <target>      const result = await agixt.runChain(
        'Task Optimization',
        prompt,
        selectedAgent,
        false,
        1,
        { conversation_name: `task_optimization_${Date.now()}` }
      );</target>
  <content>      const result = await agixt.runChain(
        'Task Optimization',
        prompt,
        selectedAgent,
        { conversation_name: `task_optimization_${Date.now()}` }
      );</content>
</modification>
<modification>
  <file>app/hooks/useAIAssistant.ts</file>
  <operation>replace</operation>
  <target>      const result = await agixt.runChain(
        'Task Analysis',
        prompt,
        selectedAgent,
        false,
        1,
        { conversation_name: `task_analysis_${Date.now()}` }
      );</target>
  <content>      const result = await agixt.runChain(
        'Task Analysis',
        prompt,
        selectedAgent,
        { conversation_name: `task_analysis_${Date.now()}` }
      );</content>
</modification>
<modification>
  <file>app/utils/agixt.ts</file>
  <operation>replace</operation>
  <target>const handleRunChain = async (task: any, selectedAgent: string, backendUrl: string, authToken: string) => {
  if (!selectedAgent) {
    return;
  }

  try {
    const agixt = await initializeAGiXT(backendUrl, authToken);
    if (!agixt) {
      return;
    }
    const conversationName = task.conversationId || `Chain_${task.id}`;
    if (!task.conversationId) {
      await agixt.newConversation(selectedAgent, conversationName);
      task.conversationId = conversationName;
    }

    const result = await agixt.runChain(
      'Task Management',
      task.text,
      selectedAgent,
      false,
      1,
      {
        conversation_name: conversationName,
      }
    );

    // Create a checkpoint after each step in the chain
    const checkpoint = await createCheckpoint(
      task.id,
      {
        chainStep: result, // Assuming result contains relevant data
        agentState: {}, // Replace with actual agent state if available
      },
      backendUrl,
      authToken
    );

    if (checkpoint) {
      task.checkpoints = [...(task.checkpoints || []), checkpoint];
    }

    const updatedTask = { ...task, status: 'Running' as const };
    return updatedTask;
  } catch (error) {
    console.error('Error running chain:', error);
    const updatedTask = { ...task, status: 'Failed' as const };
    return updatedTask;
  }
};</target>
  <content>const handleRunChain = async (task: any, selectedAgent: string, backendUrl: string, authToken: string) => {
  if (!selectedAgent) {
    return;
  }

  try {
    const agixt = await initializeAGiXT(backendUrl, authToken);
    if (!agixt) {
      return;
    }
    const conversationName = task.conversationId || `Chain_${task.id}`;
    if (!task.conversationId) {
      await agixt.newConversation(selectedAgent, conversationName);
      task.conversationId = conversationName;
    }

    const result = await agixt.runChain(
      'Task Management',
      task.text,
      selectedAgent,
      {
        conversation_name: conversationName,
      }
    );

    // Create a checkpoint after each step in the chain
    const checkpoint = await createCheckpoint(
      task.id,
      {
        chainStep: result, // Assuming result contains relevant data
        agentState: {}, // Replace with actual agent state if available
      },
      backendUrl,
      authToken
    );

    if (checkpoint) {
      task.checkpoints = [...(task.checkpoints || []), checkpoint];
    }

    const updatedTask = { ...task, status: 'Running' as const };
    return updatedTask;
  } catch (error) {
    console.error('Error running chain:', error);
    const updatedTask = { ...task, status: 'Failed' as const };
    return updatedTask;
  }
};</content>
</modification>
<modification>
  <file>app/utils/agixt.ts</file>
  <operation>replace</operation>
  <target>    const result = await agixt.prompt(
      selectedAgent,
      userInput,
      conversationName
    );</target>
  <content>    const result = await agixt.prompt(
      selectedAgent,
      userInput,
      {},
      conversationName
    );</content>
</modification>

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.

Improve AGiXT SDK Integration in ADHD Task Management Panel
1 participant