fix: params[action] conflict

This commit is contained in:
Shivam Mishra
2025-12-17 19:13:29 +05:30
parent 0cf4ee1e2a
commit 5a3c15e9ba
4 changed files with 26 additions and 26 deletions
@@ -36,25 +36,25 @@ class EditorAPI extends ApiClient {
return this.labelSuggestion(conversationId, signal);
}
// All other types are rewrite actions
return this.rewrite({ content, action: type, conversationId }, signal);
// All other types are rewrite operations
return this.rewrite({ content, operation: type, conversationId }, signal);
}
/**
* Rewrites content with a specific action.
* Rewrites content with a specific operation.
* @param {Object} options - The rewrite options.
* @param {string} options.content - The content to rewrite.
* @param {string} options.action - The rewrite action (fix_spelling_grammar, casual, professional, etc).
* @param {string} options.operation - The rewrite operation (fix_spelling_grammar, casual, professional, etc).
* @param {string} [options.conversationId] - The conversation ID for context (required for 'improve').
* @param {AbortSignal} [signal] - AbortSignal to cancel the request.
* @returns {Promise} A promise that resolves with the rewritten content.
*/
rewrite({ content, action, conversationId }, signal) {
rewrite({ content, operation, conversationId }, signal) {
return axios.post(
`${this.url}/rewrite`,
{
content,
action,
operation,
conversation_display_id: conversationId,
},
{ signal }