mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-07-25 16:04:30 +08:00
13 lines
514 B
TypeScript
13 lines
514 B
TypeScript
import type { ReferenceImage } from "@/types/image";
|
|
|
|
export function imageReferenceLabel(index: number) {
|
|
return `图片${index + 1}`;
|
|
}
|
|
|
|
export function buildImageReferencePromptText(prompt: string, references: ReferenceImage[]) {
|
|
const text = prompt.trim();
|
|
if (!references.length) return text;
|
|
const labels = references.map((_, index) => imageReferenceLabel(index));
|
|
return `参考图片编号:${labels.join("、")}。请按这些编号理解提示词中的图片引用。\n\n${text}`;
|
|
}
|