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

Added hook gf_openai_post_save_result to trigger after OpenAI result is stored on an entry. #9

Merged
merged 2 commits into from
Apr 6, 2023

Conversation

saifsultanc
Copy link
Contributor

@saifsultanc saifsultanc commented Apr 4, 2023

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2190755593/45844?folderId=7098280

Summary

Gravity Form Open AI doesn't store the generated value till the end of the entry creation. This results in generated value being inaccessible until the entry has completely processing.

The new action hook enables the user to customize behavior and tap the generated value and customize as per their use case.

For instance, the case of the user using the generated value to reload back onto the form with the GP Reload Form can do the following:

// Replace 342 with the form id, and 3 with the targetted field id.
add_action( 'gf_openai_post_save_result_to_field_342', 'gw_openai_post_save_result' ); 
function gw_openai_post_save_result( $result ) {
	$_POST['input_3'] = $result;
}

Checklist

  • Updated customer telling them that a fix/addition is in the works.
  • Added/Improved Cypress tests or a note under Summary why tests are not included in the PR.
  • Added a link to this PR in the Help Scout ticket(s) in the form of a note
  • Added/updated hook documentation if applicable.
  • Sent a [packed build]

Copy link
Contributor

@claygriffiths claygriffiths left a comment

Choose a reason for hiding this comment

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

I like it! Just one potential name change if you're on board.

class-gwiz-gf-openai.php Outdated Show resolved Hide resolved
@saifsultanc saifsultanc merged commit 897b2c8 into master Apr 6, 2023
1 check passed
@saifsultanc saifsultanc deleted the saif/add/gf_openai_post_save_result-hook branch April 6, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants