Fix some types
This commit is contained in:
parent
3073cb7e6d
commit
3c1901fa80
19
src/bot.ts
19
src/bot.ts
|
@ -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,
|
||||
|
|
14
src/types.ts
14
src/types.ts
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue