nuxt-chatgpt 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/module.json +1 -1
- package/dist/runtime/constants/models.d.ts +0 -1
- package/dist/runtime/constants/models.mjs +0 -1
- package/dist/runtime/server/api/chat-completion.mjs +1 -1
- package/dist/runtime/server/api/chat.mjs +1 -1
- package/dist/runtime/server/api/image-generate.d.ts +1 -1
- package/dist/runtime/server/api/image-generate.mjs +3 -3
- package/dist/runtime/utils/model-map.d.ts +0 -1
- package/dist/runtime/utils/model-map.mjs +0 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ The `generateImage` method requires one parameters:
|
|
|
80
80
|
| Name | Type | Default | Description |
|
|
81
81
|
|--|--|--|--|
|
|
82
82
|
|**message**|`String`| A text description of the desired image(s). The maximum length is 1000 characters.
|
|
83
|
-
|**model**|`String`|`dall-e-
|
|
83
|
+
|**model**|`String`|`dall-e-3`| The model to use for image generation. Only dall-e-3 is supported at this time.
|
|
84
84
|
|**options**|`Object`|`{ n: 1, quality: 'standard', response_format: 'url', size: '1024x1024', style: 'natural' }`|An optional object that specifies any additional options you want to pass to the API request, such as, the number of images to generate, quality, size and style of the generated images.
|
|
85
85
|
|
|
86
86
|
Available models:
|
|
@@ -100,7 +100,6 @@ Available models:
|
|
|
100
100
|
- gpt-4-32k
|
|
101
101
|
- gpt-4-32k-0314
|
|
102
102
|
- gpt-4-32k-0613
|
|
103
|
-
- dall-e-2
|
|
104
103
|
- dall-e-3
|
|
105
104
|
|
|
106
105
|
### Simple `chat` usage
|
|
@@ -276,7 +275,7 @@ async function sendMessage() {
|
|
|
276
275
|
```
|
|
277
276
|
|
|
278
277
|
### Simple `generateImage` usage
|
|
279
|
-
In the following example, the model is unspecified, and the dall-e-
|
|
278
|
+
In the following example, the model is unspecified, and the dall-e-3 model will be used by default.
|
|
280
279
|
|
|
281
280
|
```js
|
|
282
281
|
const { generateImage } = useChatgpt()
|
|
@@ -327,7 +326,7 @@ const loading = ref(false)
|
|
|
327
326
|
async function sendPrompt() {
|
|
328
327
|
loading.value = true
|
|
329
328
|
try {
|
|
330
|
-
images.value = await generateImage(inputData.value, 'dall-e-
|
|
329
|
+
images.value = await generateImage(inputData.value, 'dall-e-3', {
|
|
331
330
|
n: 1,
|
|
332
331
|
quality: 'standard',
|
|
333
332
|
response_format: 'url',
|
package/dist/module.json
CHANGED
|
@@ -13,5 +13,4 @@ export declare const MODEL_GPT_4_0613 = "gpt-4-0613";
|
|
|
13
13
|
export declare const MODEL_GPT_4_32k: string;
|
|
14
14
|
export declare const MODEL_GPT_4_32k_0314: string;
|
|
15
15
|
export declare const MODEL_GPT_4_32k_0613 = "gpt-4-32k-0613";
|
|
16
|
-
export declare const MODEL_GPT_DALL_E_2 = "dall-e-2";
|
|
17
16
|
export declare const MODEL_GPT_DALL_E_3 = "dall-e-3";
|
|
@@ -13,5 +13,4 @@ export const MODEL_GPT_4_0613 = "gpt-4-0613";
|
|
|
13
13
|
export const MODEL_GPT_4_32k = "gpt-4-32k";
|
|
14
14
|
export const MODEL_GPT_4_32k_0314 = "gpt-4-32k-0314";
|
|
15
15
|
export const MODEL_GPT_4_32k_0613 = "gpt-4-32k-0613";
|
|
16
|
-
export const MODEL_GPT_DALL_E_2 = "dall-e-2";
|
|
17
16
|
export const MODEL_GPT_DALL_E_3 = "dall-e-3";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<OpenAI.Images.Image[]>>;
|
|
2
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<OpenAI.Images.Image[] | undefined>>;
|
|
3
3
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
import { createError, defineEventHandler, readBody } from "h3";
|
|
3
3
|
import { defaultDaleOptions } from "../../constants/options.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { MODEL_GPT_DALL_E_3 } from "../../constants/models.mjs";
|
|
5
5
|
import { modelMap } from "../../utils/model-map.mjs";
|
|
6
6
|
import { useRuntimeConfig } from "#imports";
|
|
7
7
|
export default defineEventHandler(async (event) => {
|
|
@@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
|
|
|
17
17
|
});
|
|
18
18
|
const requestOptions = {
|
|
19
19
|
prompt: message,
|
|
20
|
-
model: !model ? modelMap[
|
|
20
|
+
model: !model ? modelMap[MODEL_GPT_DALL_E_3] : modelMap[model],
|
|
21
21
|
...options || defaultDaleOptions
|
|
22
22
|
};
|
|
23
23
|
try {
|
|
@@ -26,7 +26,7 @@ export default defineEventHandler(async (event) => {
|
|
|
26
26
|
} catch (error) {
|
|
27
27
|
throw createError({
|
|
28
28
|
statusCode: 500,
|
|
29
|
-
message:
|
|
29
|
+
message: error
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
MODEL_GPT_4_32k,
|
|
15
15
|
MODEL_GPT_4_32k_0314,
|
|
16
16
|
MODEL_GPT_4_32k_0613,
|
|
17
|
-
MODEL_GPT_DALL_E_2,
|
|
18
17
|
MODEL_GPT_DALL_E_3
|
|
19
18
|
} from "../constants/models.mjs";
|
|
20
19
|
export const modelMap = {
|
|
@@ -33,7 +32,6 @@ export const modelMap = {
|
|
|
33
32
|
[MODEL_GPT_4_32k]: MODEL_GPT_4_32k,
|
|
34
33
|
[MODEL_GPT_4_32k_0314]: MODEL_GPT_4_32k_0314,
|
|
35
34
|
[MODEL_GPT_4_32k_0613]: MODEL_GPT_4_32k_0613,
|
|
36
|
-
[MODEL_GPT_DALL_E_2]: MODEL_GPT_DALL_E_2,
|
|
37
35
|
[MODEL_GPT_DALL_E_3]: MODEL_GPT_DALL_E_3,
|
|
38
36
|
default: MODEL_GPT_4_MINI
|
|
39
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-chatgpt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "ChatGPT integration for Nuxt 3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@nuxt/kit": "latest",
|
|
59
59
|
"defu": "latest",
|
|
60
|
-
"openai": "4.
|
|
60
|
+
"openai": "^4.96.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@nuxt/eslint-config": "latest",
|