Skip to content

feat: ai flow chat #5842

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

Merged
merged 11 commits into from
Jun 2, 2025
Merged

feat: ai flow chat #5842

merged 11 commits into from
Jun 2, 2025

Conversation

HugoCasa
Copy link
Contributor

@HugoCasa HugoCasa commented May 29, 2025

  • feat: ai flow chat
  • youpi

Important

Introduces AI flow chat feature, enhancing flow editor with AI-driven interactions and module management.

  • AI Chat Integration:
    • Added AIChat and FlowAIChat components for AI-driven interactions in flow editing.
    • Introduced chatMode store to toggle between 'script' and 'flow' modes.
    • Implemented FlowAIButton for toggling AI panel visibility.
  • Flow Module Enhancements:
    • Updated FlowModuleComponent.svelte to integrate AI chat features, including toggleAiPanel and addSelectedLinesToAiChat functions.
    • Modified FlowErrorHandlerItem.svelte and FlowModuleSchemaMap.svelte to support AI-driven step generation.
    • Enhanced flowStateUtils.ts with functions like insertNewFailureModule for AI-generated module insertion.
  • UI and Context Updates:
    • Adjusted FlowEditor.svelte to manage AI panel size and interactions.
    • Updated FlowModuleSchemaItem.svelte and VirtualItem.svelte for improved UI consistency with AI features.
    • Set up FlowEditorContext to include AI-related functions and state management.

This description was created by Ellipsis for 262b87f. You can customize this summary. It will automatically update as commits are pushed.

Copy link

cloudflare-workers-and-pages bot commented May 29, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 262b87f
Status: ✅  Deploy successful!
Preview URL: https://075b6522.windmill.pages.dev
Branch Preview URL: https://hc-ai-flow-chat.windmill.pages.dev

View logs

@HugoCasa HugoCasa marked this pull request as ready for review June 2, 2025 12:28
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 0bd5aa8 in 4 minutes and 22 seconds. Click for details.
  • Reviewed 6916 lines of code in 46 files
  • Skipped 1 files when reviewing.
  • Skipped posting 9 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/src/lib/components/copilot/chat/script/CodeDisplay.svelte:44
  • Draft comment:
    Consider memoizing or caching the result of getSmartLang since its output is used repeatedly for determining highlight language. This can improve performance by avoiding redundant computations.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. frontend/src/lib/components/flow.ts:38
  • Draft comment:
    Avoid using direct store mutation patterns like '$flowStore = $flowStore' to trigger reactivity. Instead, use the store’s update() method to ensure proper reactivity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. frontend/src/lib/stores.ts:51
  • Draft comment:
    The 'awarenessStore' is initialized with 'undefined'. It is safer and more predictable to initialize it with an empty object ({}), unless 'undefined' is intentional.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. frontend/src/routes/flows/dev/+page.svelte:247
  • Draft comment:
    Updating the flow store by parsing JSON on every editor change can be expensive. Consider debouncing the JSON parsing and update to improve performance during rapid typing.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. frontend/src/lib/components/flows/flowStateUtils.ts:313
  • Draft comment:
    The use of a leading semicolon in the assignment (e.g. ';[module, state] = await createInlineScriptModule(...)') may reduce code readability. Consider using a more conventional assignment syntax.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. frontend/src/lib/components/copilot/chat/flow/core.ts:579
  • Draft comment:
    Typo detected: "foorloop" should be "forloop".
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While this is technically a typo in a newly added file, it's a very minor issue in documentation. The meaning is still clear from context. The typo appears in a documentation string that explains module nesting limitations. The rules say not to make comments that are obvious or unimportant. The typo could theoretically confuse a non-native English speaker. Documentation accuracy is important for maintainability. The typo is extremely minor and the meaning is very clear from context - "foorloop" appears right next to "branchone/branchall" which makes it obvious what was meant. This is the kind of trivial issue that clutters PR reviews. This comment should be deleted as it points out an extremely minor documentation typo that doesn't impact understanding.
7. frontend/src/lib/components/copilot/chat/flow/core.ts:584
  • Draft comment:
    Typographical error: The sentence appears to be missing a word. Consider changing "you should the property type in the schema" to "you should set the property type in the schema".
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment correctly identifies a grammatical error, this is in a documentation string that is part of a system message to an AI assistant. The missing word doesn't significantly impact understanding since the meaning is still clear from context. The rules state we should not make purely informative comments or comments that are obvious/unimportant. The error does make the text slightly less professional. A missing word could theoretically cause confusion for some readers. The meaning remains clear despite the missing word, and this is an internal system message, not user-facing documentation. The benefit of fixing this minor grammatical issue doesn't outweigh the noise it adds to the PR review. This comment should be removed as it points out a minor grammatical issue that doesn't significantly impact understanding or functionality.
8. frontend/src/lib/components/copilot/chat/script/core.ts:58
  • Draft comment:
    Typographical suggestion: "objects types" may be intended to be "object types" for improved clarity and grammar.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment points out a real grammatical issue, it's an extremely minor one that doesn't affect code functionality or readability significantly. The rules state not to make comments that are obvious or unimportant. A small grammatical fix like this would fall into that category. The grammar error could potentially cause confusion for non-native English speakers. The plural form "objects types" is technically incorrect. While technically correct, this is still too minor of an issue to warrant a PR comment. The meaning is still clear even with the grammatical error. Delete the comment as it's too minor and falls under the "do not make comments that are obvious or unimportant" rule.
9. frontend/src/lib/components/flows/content/FlowInputsQuick.svelte:99
  • Draft comment:
    Typographical suggestion: The log message 'ongenerate' on this line seems to be a typo. Consider changing it to 'onGenerate' for consistency with the function name.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor style issue about the casing of a debug log message. Debug logs are typically temporary and not part of the core functionality. The inconsistency doesn't affect the behavior of the code. This seems like an overly pedantic comment that doesn't add much value. The casing inconsistency could be seen as a minor code quality issue that's worth fixing while we're here. It would make the code slightly more consistent. While consistency is good, this is an extremely minor issue with a debug log that may be temporary. The comment creates noise without meaningful benefit. Delete this comment as it's too minor and focuses on an unimportant debug log statement rather than meaningful code issues.

Workflow ID: wflow_mdS7hBAyxy00gNXw

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

role: 'system'
content: string
} {
const content = `You are a helpful assitant that creates and edit workflows on the Windmill platform. You're provided with a a bunch of tools to help you edit the flow.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical errors found in the system message text:

  • assitant should be assistant.
  • The phrase a a bunch has a duplicated article; please update to a bunch.
Suggested change
const content = `You are a helpful assitant that creates and edit workflows on the Windmill platform. You're provided with a a bunch of tools to help you edit the flow.
const content = `You are a helpful assistant that creates and edit workflows on the Windmill platform. You're provided with a bunch of tools to help you edit the flow.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed cff2fb5 in 2 minutes and 29 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_LddbUTTKazykjGF5

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

lastDeployedCode,
diffMode
}}
applyCode={(code) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The new callback now takes a code parameter, which shadows the outer code prop. Consider renaming it (e.g. newCode) and adding an explicit type for clarity.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 6dff80d in 2 minutes and 40 seconds. Click for details.
  • Reviewed 175 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/src/lib/components/copilot/chat/AIChat.svelte:34
  • Draft comment:
    Updated flowHelpers API: now using getFlowAndSelectedId that returns both flow and selectedId. Ensure all consumers (e.g. prepareFlowUserMessage) are updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that all consumers of the updated API are updated accordingly. This falls under the rule of not asking the author to ensure things are tested or reviewed. Therefore, this comment should be removed.
2. frontend/src/lib/components/copilot/chat/AIChat.svelte:69
  • Draft comment:
    Enhanced canApplyCode check by ensuring chat mode is 'script'. This additional condition helps to avoid accidental code application.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining what the code change does without suggesting any action or asking for clarification. It doesn't align with the rules for useful comments.
3. frontend/src/lib/components/copilot/chat/AIChat.svelte:128
  • Draft comment:
    Passing flowHelpers.getFlowAndSelectedId() to prepareFlowUserMessage ensures the selected step ID is included in the user message.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states what the code is doing without offering any critique or suggestion.
4. frontend/src/lib/components/copilot/chat/HistoryManager.svelte.ts:86
  • Draft comment:
    Removed leftover console.log debug messages for database initialization and chat updates. This cleanup improves log clarity in production.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining what was done in the code without suggesting any changes or asking for confirmation. It doesn't align with the rules for useful comments.
5. frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte:81
  • Draft comment:
    Refactored helper API: getFlowAndSelectedId now returns both flow and selectedId; setCode changed to be async with improved error handling. Verify that client calls now pass the step id.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50% The comment is asking the PR author to verify that client calls now pass the step id, which violates the rule against asking the author to confirm their intention or ensure behavior. However, it also provides information about changes made, which could be useful for understanding the context of the changes. The comment is partially informative and partially asking for verification, which is not allowed.
6. frontend/src/lib/components/copilot/chat/flow/core.ts:30
  • Draft comment:
    Updated FlowAIChatHelpers interface: setCode now requires a step id and returns a Promise. The tool definition for set_code is also updated. Confirm that all invocations reflect these changes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that all invocations reflect the changes made to the setCode method. This falls under the rule of not asking the author to confirm or double-check things. Therefore, this comment should be removed.
7. frontend/src/lib/components/copilot/chat/flow/core.ts:596
  • Draft comment:
    Modified prepareFlowUserMessage to accept an object with flow and selectedId, now including the currently selected step in the output. This helps clarify which step is active.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing a change made in the code without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest improvements.
8. frontend/src/lib/components/copilot/chat/flow/core.ts:618
  • Draft comment:
    Typographical note: There appears to be a stray backtick at the end of the line (`${instructions}``). This might be unintentional, so please verify if it was meant to be removed.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_3165qwfOESYZjNkI

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 262b87f in 1 minute and 55 seconds. Click for details.
  • Reviewed 26 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/src/lib/components/copilot/chat/flow/core.ts:557
  • Draft comment:
    Removed confirmation step for raw scripts. Confirm that omitting user approval is intentional.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. frontend/src/lib/components/copilot/chat/flow/core.ts:560
  • Draft comment:
    New instructions clarify that step input keys/types are auto-inferred and remind to update the schema for flow_input. This improves clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. frontend/src/lib/components/copilot/chat/flow/core.ts:575
  • Draft comment:
    The added note about variable accessibility in step inputs enhances guidance on usage; ensure consistency with overall design.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. frontend/src/lib/components/copilot/chat/flow/core.ts:581
  • Draft comment:
    Typo: Consider replacing "It's id is 'preprocessor'" with "Its id is 'preprocessor'".
  • Reason this comment was not posted:
    Comment was on unchanged code.
5. frontend/src/lib/components/copilot/chat/flow/core.ts:582
  • Draft comment:
    Typo: In "when linking it's input" change "it's" to "its", and in "It's id is 'failure'" change "It's" to "Its".
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_4SFRcGvV7ZA4rWAZ

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@rubenfiszel rubenfiszel merged commit 68ebf66 into main Jun 2, 2025
9 checks passed
@rubenfiszel rubenfiszel deleted the hc/ai-flow-chat branch June 2, 2025 20:14
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants