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({
|
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,
|
||||||
|
|
14
src/types.ts
14
src/types.ts
|
@ -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";
|
||||||
|
|
Loading…
Reference in a new issue