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

Squiggle AI: Minor Bugs / Changes #3423

Open
OAGr opened this issue Nov 5, 2024 · 1 comment
Open

Squiggle AI: Minor Bugs / Changes #3423

OAGr opened this issue Nov 5, 2024 · 1 comment
Labels
AI AI functionality

Comments

@OAGr
Copy link
Contributor

OAGr commented Nov 5, 2024

  1. Once I start a workflow, it changes the view to show the wrong workflow.
  2. On the top, it shows "0.00s" much of the time, even if it took a lot of time. (Edit: It looks like this only happens once I reload the page)
image

Just thinking about this - it would also be nice if we could show the full prompt in the "Actions" view.

@OAGr OAGr added the AI AI functionality label Nov 5, 2024
@OAGr
Copy link
Contributor Author

OAGr commented Nov 6, 2024

I checked the time issue.

I think I know what's going on, but not sure how to best fix.

in v2_0.ts we have

export function decodeV2_0JsonToClientWorkflow(
  json: Prisma.JsonValue
): ClientWorkflow {
  /*
   * Here we go from SerializedWorkflow to Workflow to ClientWorkflow.
   *
   * TODO: Instead, we could go directly from SerializedWorkflow to
   * ClientWorkflow (useful especially if workflow implementation is
   * deprecated, so we can't resume it but still want to show it).
   */
  const { bundle, entrypoint } = v2WorkflowDataSchema.parse(json);
  const codec = getAiCodec();
  const deserializer = codec.makeDeserializer(bundle);
  const workflow = deserializer.deserialize(entrypoint);

  return workflow.asClientWorkflow();
}

Then, in asClientWorkflow, it calls,

 ? {
            status: "finished",
            result: this.getFinalResult(),
          }

This calls:

    const endTime = Date.now();
    const runTimeMs = endTime - this.startTime;

The problem here is that this.startTime came from when the Workflow was initialized - when using a deserializer, this registers as "just now", not when the workflow really started.

One way of fixing this is, instead of using this.startTime, you use the start time of the first Run. I think this is available. That said, this is kind of unelegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI AI functionality
Projects
Status: 🆕 To prioritize
Development

No branches or pull requests

1 participant