mirror of
https://github.com/cline/cline.git
synced 2026-09-19 02:05:44 +08:00
* cleaning up a bit * cleaning up some more * readme * added max limit * making it portable * ignore * committing plans for now * strealit hooked up, multi model runs, better db torage * docs * VALID attempts * logging * more stability * strategy * cleaning deps * docs * streamlit dashboard work * dashboard showing bad cases * better parallelization pt1 * global worker pool for even better more robust parallelization * bumping up default max parallel requests from 20 -> 80 * better devx * better docs * docs * better devx * better docs * better presentation * dark mode * removed unused import --------- Co-authored-by: Cline Evaluation <cline@example.com>
26 lines
642 B
TypeScript
26 lines
642 B
TypeScript
import { Anthropic } from "@anthropic-ai/sdk"
|
|
|
|
const formatImagesIntoBlocks = (images?: string[]): Anthropic.ImageBlockParam[] => {
|
|
return images
|
|
? images.map((dataUrl) => {
|
|
// data:image/png;base64,base64string
|
|
const [rest, base64] = dataUrl.split(",")
|
|
const mimeType = rest.split(":")[1].split(";")[0]
|
|
return {
|
|
type: "image",
|
|
source: {
|
|
type: "base64",
|
|
media_type: mimeType,
|
|
data: base64,
|
|
},
|
|
} as Anthropic.ImageBlockParam
|
|
})
|
|
: []
|
|
}
|
|
|
|
export const formatResponse = {
|
|
imageBlocks: (images?: string[]): Anthropic.ImageBlockParam[] => {
|
|
return formatImagesIntoBlocks(images)
|
|
},
|
|
}
|