chatgpt-jdasa
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -178,3 +178,3 @@ import Keyv from 'keyv'; | ||
*/ | ||
content: string; | ||
content: any; | ||
/** | ||
@@ -449,3 +449,3 @@ * The name of the user in a multi-user chat | ||
*/ | ||
sendMessage(text: string, opts?: SendMessageOptions): Promise<ChatMessage>; | ||
sendMessage(text: string, opts: SendMessageOptions, image_url: string): Promise<ChatMessage>; | ||
get apiKey(): string; | ||
@@ -455,3 +455,3 @@ set apiKey(apiKey: string); | ||
set apiOrg(apiOrg: string); | ||
protected _buildMessages(text: string, opts: SendMessageOptions): Promise<{ | ||
protected _buildMessages(text: string, opts: SendMessageOptions, image_url: string): Promise<{ | ||
messages: openai.ChatCompletionRequestMessage[]; | ||
@@ -458,0 +458,0 @@ maxTokens: number; |
@@ -202,3 +202,3 @@ // src/chatgpt-api.ts | ||
*/ | ||
async sendMessage(text, opts = {}) { | ||
async sendMessage(text, opts = {}, image_url) { | ||
const { | ||
@@ -229,3 +229,4 @@ parentMessageId, | ||
text, | ||
opts | ||
opts, | ||
image_url | ||
); | ||
@@ -281,3 +282,2 @@ const result = { | ||
const delta = response.choices[0].delta; | ||
console.log("delta=%o", delta); | ||
if (delta) { | ||
@@ -392,3 +392,3 @@ result.delta = delta == null ? void 0 : delta.content; | ||
} | ||
async _buildMessages(text, opts) { | ||
async _buildMessages(text, opts, image_url) { | ||
const { systemMessage = this._systemMessage } = opts; | ||
@@ -410,3 +410,14 @@ let { parentMessageId } = opts; | ||
role: "user", | ||
content: text, | ||
content: [ | ||
{ | ||
"type": "text", | ||
"text": text | ||
}, | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": image_url | ||
} | ||
} | ||
], | ||
name: opts.name | ||
@@ -413,0 +424,0 @@ } |
{ | ||
"name": "chatgpt-jdasa", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Node.js client for the official ChatGPT API,support gpt-4o and image_url.", | ||
@@ -5,0 +5,0 @@ "author": "Travis Fischer <travis@transitivebullsh.it>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132196
1332