Fix some types

This commit is contained in:
powermaker450 2024-06-26 14:35:11 +00:00
parent 3073cb7e6d
commit 3c1901fa80
2 changed files with 15 additions and 18 deletions

View file

@ -120,18 +120,15 @@ client.connect().then(async () => {
});
const response = await assistant.chat.completions.create({
// @ts-ignore
messages: session,
model: imageModel,
temperature: temperature,
});
// @ts-ignore
response.choices.at(0).message.content = response.choices
.at(0)
.message.content.replace("</s>", "");
response.choices.at(0)!.message.content = response.choices
.at(0)!
.message.content!.replace("</s>", "");
// @ts-ignore
session.push(response.choices.at(0).message);
session.push(response.choices.at(0)!.message);
await client.sendMessage({
converseId: message.converseId,
@ -157,14 +154,12 @@ client.connect().then(async () => {
});
const response = await assistant.chat.completions.create({
// @ts-ignore
messages: session,
model: textModel,
temperature: temperature,
});
// @ts-ignore
session.push(response.choices.at(0).message);
session.push(response.choices.at(0)!.message);
await client.sendMessage({
converseId: message.converseId,
@ -200,14 +195,12 @@ client.connect().then(async () => {
});
const response = await assistant.chat.completions.create({
// @ts-ignore
messages: session,
model: textModel,
temperature: temperature,
});
// @ts-ignore
session.push(response.choices.at(0).message);
session.push(response.choices.at(0)!.message);
await client.sendMessage({
converseId: message.converseId,

View file

@ -1,11 +1,15 @@
import OpenAI from "openai";
import { ChatCompletionRole } from "openai/resources";
import {
ChatCompletionAssistantMessageParam,
ChatCompletionSystemMessageParam,
ChatCompletionUserMessageParam,
} from "openai/resources";
import { TailchatWsClient } from "tailchat-client-sdk";
interface ChatCompletion {
role: ChatCompletionRole;
content: string;
}
type ChatCompletion =
| ChatCompletionSystemMessageParam
| ChatCompletionUserMessageParam
| ChatCompletionAssistantMessageParam;
interface ImageUrl {
role: "user";