Change some types

This commit is contained in:
powermaker450 2024-07-19 17:05:29 -04:00
parent 7d975fda8e
commit 49e561da12
2 changed files with 11 additions and 7 deletions

View file

@ -1,7 +1,7 @@
import { TailchatWsClient, stripMentionTag } from "tailchat-client-sdk";
import { OpenAI } from "openai";
import * as fs from "fs";
import { ImageRequestData, Messages } from "./types";
import { ImageRequestData, ImageSize, Messages } from "./types";
import {
checkFile,
getUsername,
@ -90,7 +90,7 @@ client.connect().then(async () => {
model: createImageModel,
prompt: prompt,
n: 1,
size: "512x512",
size: ImageSize.Small,
};
const response: ImagesResponse =

View file

@ -22,12 +22,16 @@ export interface ImageMessage {
];
}
export type Message =
export type AnyChatCompletion =
| ChatCompletionMessage
| ChatCompletionUserMessageParam
| ChatCompletionSystemMessageParam;
export type validImgSize = "256x256" | "512x512" | "1024x1024";
export enum ImageSize {
Small = "256x256",
Medium = "512x512",
Large = "1024x1024"
}
export type validImgAmount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
@ -35,7 +39,7 @@ export interface ImageRequestData {
model: Model;
prompt: string;
n?: validImgAmount;
size?: validImgSize;
size?: ImageSize;
}
export interface ImagePrompt {
@ -44,7 +48,7 @@ export interface ImagePrompt {
message: any;
prompt: string;
amount?: validImgAmount;
size?: validImgSize;
size?: ImageSize;
}
export type Model =
@ -78,4 +82,4 @@ export type Temperature =
| 1.9
| 2.0;
export type Messages = Array<Message | ImageMessage>;
export type Messages = Array<AnyChatCompletion | ImageMessage>;