Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add baseURL option and update npm deps #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
.nuxt
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@

# Changelog

## v0.2.6

[compare changes](https://github.com/schnapsterdog/nuxt-chatgpt/compare/v0.2.5...v0.2.6)

### 🚀 Enhancements

- Add baseURL option and update npm deps. ([b559888](https://github.com/schnapsterdog/nuxt-chatgpt/commit/b559888))

### ❤️ Contributors

- Bit0r ([@Bit0r](http://github.com/Bit0r))

## v0.2.5

[compare changes](https://github.com/schnapsterdog/nuxt-chatgpt/compare/v0.2.4...v0.2.5)
Expand Down Expand Up @@ -174,4 +186,3 @@
### ❤️ Contributors

- SchnapsterDog <[email protected]>

24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div>
<div>
<h1>Nuxt Chatgpt + Image Generator<a href="https://nuxtchatgpt.com" target="_blank">🔥(VIEW DEMO)🔥</a></h3>

</div>
<div style="display:flex; width:100%; justify-content:center">
<img src="images/logo.png" alt="Logo">
Expand Down Expand Up @@ -56,15 +56,16 @@ export default defineNuxtConfig({

// entirely optional
chatgpt: {
apiKey: 'Your apiKey here goes here'
apiKey: 'Your apiKey here goes here',
baseURL: 'Your baseURL here goes here',
},
})
```
That's it! You can now use Nuxt Chatgpt in your Nuxt app 🔥

## Usage & Examples

To access the `chat`, `chatCompletion`, and `generateImage` methods in the nuxt-chatgpt module, you can use the `useChatgpt()` composable, which provides easy access to them.
To access the `chat`, `chatCompletion`, and `generateImage` methods in the nuxt-chatgpt module, you can use the `useChatgpt()` composable, which provides easy access to them.

The `chat`, and `chatCompletion` methods requires three parameters:

Expand Down Expand Up @@ -103,7 +104,7 @@ Available models:
- dall-e-2
- dall-e-3

### Simple `chat` usage
### Simple `chat` usage
In the following example, the model is unspecified, and the gpt-4o-mini model will be used by default.

```js
Expand Down Expand Up @@ -168,7 +169,7 @@ async function sendMessage() {
</template>
```

### Simple `chatCompletion` usage
### Simple `chatCompletion` usage
In the following example, the model is unspecified, and the gpt-4o-mini model will be used by default.

```js
Expand All @@ -187,12 +188,12 @@ async function sendMessage() {
chatTree.value.push(message)

const response = await chatCompletion(chatTree.value)

const responseMessage = {
role: response[0].message.role,
content: response[0].message.content
}

chatTree.value.push(responseMessage)
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
Expand Down Expand Up @@ -240,12 +241,12 @@ async function sendMessage() {
chatTree.value.push(message)

const response = await chatCompletion(chatTree.value, 'gpt-4o-mini')

const responseMessage = {
role: response[0].message.role,
content: response[0].message.content
}

chatTree.value.push(responseMessage)
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
Expand Down Expand Up @@ -275,7 +276,7 @@ async function sendMessage() {
</template>
```

### Simple `generateImage` usage
### Simple `generateImage` usage
In the following example, the model is unspecified, and the dall-e-2 model will be used by default.

```js
Expand Down Expand Up @@ -371,6 +372,7 @@ The `chatCompletion` method is similar to the `chat` method, but it provides add
| Name | Type | Default | Description |
|--|--|--|--|
|**apiKey**|`String`|`xxxxxx`|Your apiKey here goes here
|**baseURL**|`String`|`https://api.openai.com/v1`|Your baseURL here goes here
|**isEnabled**|`Boolean`|`true`| Enable or disable the module. `True` by default.

<!-- CONTRIBUTING -->
Expand Down Expand Up @@ -458,4 +460,4 @@ Use this space to list resources you find helpful and would like to give credit
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-chatgpt.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/nuxt-chatgpt
[license-src]: https://img.shields.io/npm/l/nuxt-chatgpt.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-chatgpt
[license-href]: https://npmjs.com/package/nuxt-chatgpt
16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FlatCompat } from "@eslint/eslintrc"
import js from "@eslint/js"
import path from "node:path"
import { fileURLToPath } from "node:url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})

export default [{
ignores: ["**/dist", "**/node_modules", "**/.nuxt"],
}, ...compat.extends("@nuxt/eslint-config")]
Loading