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

Feature: OverrideConfig allows partial override #1815

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

mokeyish
Copy link
Contributor

@mokeyish mokeyish commented Feb 26, 2024

图片

with this PR, we can set partial value. no need to set full config.

  • case 1:

    curl http://127.0.0.1:8711/api/v1/prediction/be46c4d4-52cf-4d1b-9a76-c195643dfa0b \
      -X POST \
      -d '{"question": "Hey, how are you?", "overrideConfig": {"config": {"ver":123} }}' \
      -H "Content-Type: application/json"
    # output
    # {"text":"\nver: 123\nurl: http://google.com\n","chatMessageId":"e0dfb81a-99d2-4e8a-b2e4-28bd73e769a2","chatId":"7e38918a-a037-46a8-a964-7e0d3abe6cf1"}
    
  • case 2:

    curl http://127.0.0.1:8711/api/v1/prediction/be46c4d4-52cf-4d1b-9a76-c195643dfa0b \
      -X POST \
      -d '{"question": "Hey, how are you?", "overrideConfig": {"config": {"url": "https://github.com"} }}' \
      -H "Content-Type: application/json"
    # output
    # {"text":"\nver: 12345\nurl: https://github.com\n","chatMessageId":"e0dfb81a-99d2-4e8a-b2e4-28bd73e769a2","chatId":"7e38918a-a037-46a8-a964-7e0d3abe6cf1"}
    

@HenryHengZJ
Copy link
Contributor

thanks @mokeyish !!

For future reference:

1.) Have a Custom JS Function node with multiple Input Variables:
image

2.) When calling API with overrideConfig, with only 1 input variable is provided

{
    "question": "hello!",
    "overrideConfig": {
        "functionInputVariables": {
            "character": "sarcastic"
        }
    }
}

This will results in error saying another variable (in this case $action) is not defined

3.) This PR fixes that

@HenryHengZJ HenryHengZJ merged commit 850e506 into FlowiseAI:main Feb 26, 2024
2 checks passed
@mokeyish mokeyish deleted the patch-4 branch February 27, 2024 05:26
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.

2 participants