remove un-needed util
This commit is contained in:
@@ -182,9 +182,6 @@ export function Thread() {
|
|||||||
return;
|
return;
|
||||||
setFirstTokenReceived(false);
|
setFirstTokenReceived(false);
|
||||||
|
|
||||||
// TODO: check configurable object for modelname camelcase or snakecase else do openai format
|
|
||||||
const isOpenAI = true;
|
|
||||||
|
|
||||||
const newHumanMessage: Message = {
|
const newHumanMessage: Message = {
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
type: "human",
|
type: "human",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import type { Base64ContentBlock } from "@langchain/core/messages";
|
import type { Base64ContentBlock } from "@langchain/core/messages";
|
||||||
import { convertToOpenAIImageBlock } from "@langchain/core/messages";
|
|
||||||
|
|
||||||
// Returns a Promise of a typed multimodal block for images
|
// Returns a Promise of a typed multimodal block for images
|
||||||
export async function fileToImageBlock(
|
export async function fileToImageBlock(
|
||||||
@@ -46,15 +45,3 @@ export async function fileToBase64(file: File): Promise<string> {
|
|||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility to convert base64 image blocks to OpenAI image_url format
|
|
||||||
export function toOpenAIImageBlock(block: Base64ContentBlock | any) {
|
|
||||||
if (block.type === "image" && block.source_type === "base64") {
|
|
||||||
return convertToOpenAIImageBlock(block);
|
|
||||||
}
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cleanBase64 = (base64String: string): string => {
|
|
||||||
return base64String.replace(/^data:.*?;base64,/, "");
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user