wax-prosemirror merge requestshttps://gitlab.coko.foundation/wax/wax-prosemirror/-/merge_requests2023-09-18T16:06:33Zhttps://gitlab.coko.foundation/wax/wax-prosemirror/-/merge_requests/491Merge Request for AI Functionality into ai-service2023-09-18T16:06:33ZpaulwababuMerge Request for AI Functionality into ai-service### Merge Request for AI Functionality.
#### Background
1. This MR integrates a basic AI functionality into the AskAiEditor
2. Although future iterations will allow admins to define a list of prompts for users, this MVP version allows ...### Merge Request for AI Functionality.
#### Background
1. This MR integrates a basic AI functionality into the AskAiEditor
2. 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
1. **User selects text**: Highlight text within the editor.
2. **AI Window**: An AI window pops up with a prompt field.
3. **Enter Prompt**: User inputs their query or statement.
4. **Send Query**: User sends the query by pressing enter or clicking a send button.
5. **AI Response**: The AI-generated text replaces the prompt field in the AI window.
6. **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