- Notifications
You must be signed in to change notification settings - Fork0
License
NotificationsYou must be signed in to change notification settings
cimdalli/graphiql-plugin-chatgpt
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A GraphiQL plugin to get a generated query based on the current query via ChatGPT API.
Use your favorite package manager to install the package:
# yarnyarn add graphiql-plugin-chatgpt# npmnpm install --save graphiql-plugin-chatgpt
The following packages are peer dependencies, so make sure you have them installed as well:
#yarnyarn add react react-dom graphql @graphiql/react#npmnpm install --save react react-dom graphql @graphiql/react
import{useChatGPTPlugin}from"graphiql-plugin-chatgpt"import"graphiql-plugin-chatgpt/dist/graphiql-plugin-chatgpt.css"functionApp(){// ...constchatGPTPlugin=useChatGPTPlugin({config:{provider:"openai",apiKey:getOpenAIApiKey()},userId:getUserId(),query:query,onEdit:setQuery,});return(<GraphiQLquery={query}onEditQuery={setQuery}plugins={[chatGPTPlugin]}/>);}
| field | required | type | description |
|---|---|---|---|
| config | true | OpenAIProviderConfig | API service config |
| query | true | string | Current query |
| userId | true | string | User identifier (required to prevent side-effects from other users run) |
| onEdit | true | (query: string)=>void | Query setter function (run onSet query button click) |
exporttypeOpenAIProviderConfig=DefaultOpenAIProviderConfig|AzureOpenAIProviderConfig// You can use your OpenAI api key// https://platform.openai.com/account/api-keystypeDefaultOpenAIProviderConfig={provider:"openai"apiKey:string}typeAzureOpenAIProviderConfig={provider:"azure"apiKey:stringendpoint:stringapiVersion:string}
This project was highly inspired from the @cx0's hackathon project (https://github.com/cx0/chatGPT-for-genetics)
About
No description, website, or topics provided.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
