thejaswin123 / aigencontent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

page_type urlFragment products languages extensions description
sample
Word-Add-in-AI-Assistant
office-add-ins
office-word
office
typescript
contentType technologies createdDate
samples
Add-ins
11/17/2023 10:00:00 AM
Create a Word Add-in that produces content or chat with AI to assit your writting.

Create a Word AI-Assistant Add-in

Summary

This add-in demonstrates Word add-in capabilities to insert content generated by AI or edited manually into Document Comment Footnote and Header. There're two mode: chat mode and predefined prompt prefix to generate text/picture.

Sample Demo Video

Watch the video

Features

  • Select the 'Generation Text' option from dropdown list and select the source words from document, submit, generated text returned from Azure OpenAI service, select where you want to insert the generated text into.
  • Generate picture. Select the 'Generate Picture' option and select the source words from document, submit, insert the picture into the cusor pisiton inside document.
  • Switch to chat mode. You can send whatever text words to the chat box, insert the generated text into Document/Comment/Footnote/Header.
  • You can configure the drop down list to whatever prompt prefix you like. Clone the project and open config.tsx. Change the AssistanceOption and GenerateOption following the format of the existing GenerateText and GeneratePicture.
  • You need to input the Azure OpenAI account once you relaunch/reload the add-in. You can persist the account details: apiKey endpoint deployment in AIKeyConfigDialog.tsx or just refill in it whenever the add in ask.

Applies to

  • Word on Windows, Mac, and in a browser.

Prerequisites

Run the sample

Manually run on your local machine

If you prefer to run the sample with clear and step-by-step instructions, follow the detailed steps provided below.

  1. Install a recent version of npm and Node.js on your computer. To verify if you've already installed these tools, run the commands node -v and npm -v in your terminal.
  2. Clone the repo to your local workspace or directly download the source code.
  3. Open the Word-Scenario-based-Add-in-Samples\Word-Add-in-AI-Assistant folder in Visual Studio Code. You can see the sample code and make code changes to the sample.
  4. Required: Fill in the parameters apiKey, endpoint and deployment in src/taskpane/components/utility/config.tsx to persist the Azure OpenAI account or you can skip this step to fill in the account when you operate the AI related UI.
  5. cd src folder and execute following commands in your CLI to start the sample add-in on desktop, make sure the CLI is run as administrator:
    npm install
    npm start
  6. Or you can skip the last step and start debugging the project by hitting the F5 key in Visual Studio Code.

Next steps

You may explore additional resources at the following links:

Questions and feedback

  • Did you experience any problems with the sample? Create an issue and we'll help you out.
  • We'd love to get your feedback about this sample. Go to our Office samples survey to give feedback and suggest improvements.
  • For general questions about developing Office Add-ins, go to Microsoft Q&A using the office-js-dev tag.

Copyright

Copyright (c) 2021 Microsoft Corporation. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Note: The taskpane.html file contains an image URL that tracks diagnostic data for this sample add-in. Please remove the image tag if you reuse this sample in your own code project.

About


Languages

Language:JavaScript 100.0%