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

View file

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