Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

cimdalli/graphiql-plugin-chatgpt

Repository files navigation

npm

A GraphiQL plugin to get a generated query based on the current query via ChatGPT API.

Screenshot

Install

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

Usage

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]}/>);}

Props

fieldrequiredtypedescription
configtrueOpenAIProviderConfigAPI service config
querytruestringCurrent query
userIdtruestringUser identifier (required to prevent side-effects from other users run)
onEdittrue(query: string)=>voidQuery setter function (run onSet query button click)

Types

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}

Credits

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

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp