Skip to content

fix: Runflow component output error #6942

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

jeevic
Copy link
Contributor

@jeevic jeevic commented Mar 6, 2025

bug description

use Runflow component in workflow or tool model exception below:
WeChat044a0e6e07ba31bc9107d2be77858e85

Related code:

_base_outputs: list[Output] = [
        Output(name="flow_outputs_data", display_name="Flow Data Output", method="data_output", hidden=True),
        Output(
            name="flow_outputs_dataframe", display_name="Flow Dataframe Output", method="dataframe_output", hidden=True
        ),
        Output(name="flow_outputs_message", display_name="Flow Message Output", method="message_output"),
    ]
    default_keys = ["code", "_type", "flow_name_selected", "session_id"]
    FLOW_INPUTS: list[dotdict] = []
    flow_tweak_data: dict = {}

    @abstractmethod
    async def run_flow_with_tweaks(self) -> list[Data]:
        """Run the flow with tweaks."""

    async def data_output(self) -> Data:
        """Return the data output."""
        run_outputs = await self.run_flow_with_tweaks()
        first_output = run_outputs[0]

        if isinstance(first_output, Data):
            return first_output

        message_data = first_output.outputs[0].results["message"].data
        return Data(data=message_data)

    async def dataframe_output(self) -> DataFrame:
        """Return the dataframe output."""
        run_outputs = await self.run_flow_with_tweaks()
        first_output = run_outputs[0]

        if isinstance(first_output, DataFrame):
            return first_output

        message_data = first_output.outputs[0].results["message"].data
        return DataFrame(data=message_data if isinstance(message_data, list) else [message_data])

    async def message_output(self) -> Message:
        """Return the message output."""
        run_outputs = await self.run_flow_with_tweaks()
        message_result = run_outputs[0].outputs[0].results["message"]

        if isinstance(message_result, Message):
            return message_result

        if isinstance(message_result, str):
            return Message(content=message_result)

        return Message(content=message_result.data["text"])

debugger and fix

debugger found get run_outputs result not correctly

WeChat0194768c512e2708499c9a05b5ec9341

  1. run_outputs[0].outputs.results is dict type without message attribute 。 so use code get flow result
    _, message_result = next(iter(run_outputs[0].outputs[0].results.items()))

  2. return Message Object have text attribute not content attribute

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Mar 6, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 6, 2025
Copy link

codspeed-hq bot commented Mar 6, 2025

CodSpeed Performance Report

Merging #6942 will improve performances by 54.17%

Comparing qifu-llm:fix_runflow_component (35bbf98) with main (e82b23f)

Summary

⚡ 2 improvements
✅ 17 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_build_flow_invalid_job_id 12.4 ms 8 ms +54.17%
test_cancel_nonexistent_build 12.2 ms 8.7 ms +39.51%

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 21, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 22, 2025
Copy link
Contributor

autofix-ci bot commented Mar 23, 2025

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 23, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 25, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 27, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 28, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 31, 2025
@edwinjosechittilappilly
Copy link
Collaborator

@jeevic Can you grant the Edit access to the maintainers?

Also Please update the PR with the latest changes in main

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 12, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 15, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 16, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 17, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 17, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 18, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 25, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 28, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 30, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants