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

View file

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