Skip to content

Commit a0bc8d7

Browse files
committed
fix: openai
1 parent fab27d8 commit a0bc8d7

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

components/openai/actions/chat/chat.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import openai from "../../openai.app.mjs";
22
import common from "../common/common.mjs";
33
import constants from "../../common/constants.mjs";
4-
import { ConfigurationError } from "@pipedream/platform";
54

65
export default {
76
...common,
@@ -145,11 +144,7 @@ export default {
145144
},
146145
},
147146
async run({ $ }) {
148-
if (this.audio && !this.modelId.includes("gpt-4o-audio-preview")) {
149-
throw new ConfigurationError("Use of audio files requires using the `gpt-4o-audio-preview` model.");
150-
}
151-
152-
const args = this._getChatArgs();
147+
const args = await this._getChatArgs();
153148

154149
const response = await this.openai.createChatCompletion({
155150
$,

components/openai/actions/common/common.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default {
118118

119119
return content;
120120
},
121-
_getChatArgs() {
121+
async _getChatArgs() {
122122
if (this.messages && this.messages.length && !this.userMessage) {
123123
throw new ConfigurationError(
124124
`When you provide previous messages, you must provide the next User Message for the assistant to answer. See the OpenAI Chat format docs here: ${CHAT_DOCS_MESSAGE_FORMAT_URL}`,
@@ -164,7 +164,7 @@ export default {
164164

165165
messages.push({
166166
"role": "user",
167-
"content": this._getUserMessageContent(),
167+
"content": await this._getUserMessageContent(),
168168
});
169169

170170
const responseFormat = {};

0 commit comments

Comments
 (0)