mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-08-05 17:04:27 +08:00
feat: label image references in generation
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user