ChatGPT 3.0.0

Welcome to the "ChatGPT" app for ServiceNow - created and maintained by Sascha Wildgrube.

Features

Users with the x_snc_chat_gpt.user role can have conversations with ChatGPT.

Ask ChatGPT to review code contained in Script Includes.

Developers can connect to the OpenAI API and send prompts to ChatGPT.

Start with the script include function x_snc_chat_gpt.Prompt().

Perform the installation instructions below!

Go to the background scripts and execute this:

gs.info(x_snc_chat_gpt.Prompt("Say something smart"));

Disclaimer

ChatGPT is NOT an officially supported ServiceNow product.

ChatGPT does NOT come with any kind of warranty. If you use it, you own it!

System Requirements

Installation

  1. Create an account on GitHub - if not done already.
  2. Create a personal access token for your GitHub account.
  3. Add credentials to access GitHub - use "Basic Auth".
  4. Fork the repository https://github.com/saschawildgrube/servicenow-devtools.
  5. Go to Studio and import the DevTools application from source control.
  6. Perform all installation steps for the DevTools application documented here: https://www.wildgrube.com/servicenow-devtools/ 
  7. Fork the repository https://github.com/saschawildgrube/servicenow-reactor.
  8. Go to Studio and import the Reactor application from source control.
  9. Perform all installation steps for the Reactor application documented here: https://www.wildgrube.com/servicenow-reactor/ 
  10. Fork the repository https://github.com/saschawildgrube/servicenow-chatgpt.
  11. Go to Studio and import the ChatGPT application from source control.
  12. The InstallApp() function must be executed.
    Run the following script as a background script in scope x_snc_chat_gpt:
  13. x_snc_devtools.InstallApp("x_snc_chat_gpt");
  14. Get an OpenAI API key.
  15. Copy the API key to the global system property: "openai.apikey"

Reference

Configuration Options

Roles

UI Actions

Script Includes

  • AppGetDependencies

    Retrieves information about the app's dependencies to other apps and required versions.

  • AppGetProperty

    Gets a system property of this application.

  • AppInstall

    This script installs Chat GPT.

  • AppSetDefaults

    Sets all system properties to default values.

  • AppSetProperty

    Sets a system property of this application.

  • ChatGPTClientAPI

    Provides access to server sided capabilities to the client.

  • ConversationPrompt

    Sends a prompt to the ChatGPT engine using a given conversation as context.

  • Debug

    Produces a log output in the application log using the DevTools Debug function.

  • DevTools

    Implements the extension point for DevTools.

  • DevToolsGetApplicationStatus

    The function DevToolsGetApplicationStatus is called by the DevTools extension point instance class and returns the application status object with additional status information to be displayed on the "DevTools Application Overview" page.

  • DevToolsGetFormatConfig

    The DevToolsGetFormatConfig function is called by the DevTools extension point instance class and returns an object with field formatting information.

  • DevToolsGetLinkDirectory

    The DevToolsGetLinkDirectory function is called by the DevTools extension point instance class and returns an extended (or modified) link directory object that serves as the basis for the DevTools Link page.

  • DevToolsGetParentRecord

    The DevToolsGetParentRecord function is called by the DevTools extension point instance class and returns a parent record for the given record if it can be determined.

  • DevToolsRenderDebugDump

    The function DevToolsRenderDebugDump is called by the DevTools extension point instance class and returns additional debug information provided by the application.

  • ExtractTextFromRecord

    Extracts all text from a record that may contain relevant information.

  • GetConversationRecord

    Returns an existing GlideRecord object representing a Chat GPT conversation.

  • GetOrCreateConversationRecord

    Returns a new or existing GlideRecord object representing a Chat GPT conversation based.

  • HtmlRenderPageCodeReview

    Renders the Code Review page.

  • IsActive

    Returns true if the application is active, otherwise false.

  • Log

    Produces a log output in the application log.

  • Prompt

    Sends a prompt to the ChatGPT engine and returns the answer string.

  • PromptCodeReview

    Sends a promot to the ChatGPT engine asking for a code review of the given source code.

  • PromptQuestionAboutRecords

    Sends a question to the ChatGPT engine to be answered based on contents contained in one or more records.

  • PromptQuestionAboutText

    Sends a question to the ChatGPT engine to be answered based on a given text.

License

Copyright 2023 by Sascha Wildgrube

Licensed under the Apache License, Version 2.0 (the "License")

You may not use ChatGPT except in compliance with the License.

You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Release Notes

3.0.0 - 2023-03-24

  1. Backward incompatible change: Function Prompt() no longer considers conversations - use ConversationPrompt() instead!
  2. DevTools 1.59.0 is now required.
  3. Reactor 1.4.0 is now required.
  4. Added the "Code Review" UI Action for Script Includes.
  5. Added function PromptCodeReview().
  6. Added function PromptQuestionAboutText().
  7. Added function PromptQuestionAboutRecords().
  8. Added function ExtractTextFromRecord().
  9. Added menu item for creating a new conversation.

2.0.0 - 2023-02-05

  1. Backward incompatible change: Renamed function ChatGPT() to Prompt().
  2. DevTools 1.55.0 is now required.
  3. Introduced the conversation table to enable users to have conversations with ChatGPT.
  4. Introduced the user and admin roles.
  5. Added various ATF tests.

1.0.0 - 2023-01-17

First baselined version