Merge Request for AI Functionality into ai-service
Merge Request for AI Functionality.
Background
-
This MR integrates a basic AI functionality into the AskAiEditor
-
Although future iterations will allow admins to define a list of prompts for users, this MVP version allows users to ask AI anything.
Objective
The goal is to offer users a way to interact with AI to generate text, while giving them full control over whether the text is inserted into the document, replaced, or discarded.
User Flow Implemented
- User selects text: Highlight text within the editor.
- AI Window: An AI window pops up with a prompt field.
- Enter Prompt: User inputs their query or statement.
- Send Query: User sends the query by pressing enter or clicking a send button.
- AI Response: The AI-generated text replaces the prompt field in the AI window.
-
User Options: Below the AI response, the user is presented with four actions:
- Replace current selection
- Insert below
- Try again
- Discard
Actions Explained
- Replace current selection: Deletes the selected text and replaces it with the AI's response.
- Insert below: Retains the selected text and adds a new paragraph below with the AI's response.
- Try again: Removes the prior AI response and triggers a new AI query, repeating the process.
- Discard: Closes the AI tooltip "modal".
Additional Notes
- All actions respect the HTML responses and interact seamlessly with existing text.
- No breaking changes introduced.
- Ensure to replace chatgpt api key on https://gitlab.coko.foundation/wax/wax-prosemirror/-/blob/replace-text-draft/editors/demo/src/AskAIEditor/config/config.js with the actual API key for Ketida.
- This code addresses the issue https://gitlab.coko.foundation/ketida/ketida/-/issues/714