Add prompt-based picture command

This commit is contained in:
Codex
2026-05-22 14:06:36 +00:00
parent 2a816e27a5
commit 5f1633141f
4 changed files with 250 additions and 6 deletions

View File

@@ -90,6 +90,20 @@ func TestParseCommand(t *testing.T) {
}
}
func TestPictureGenerationInstruction(t *testing.T) {
instruction := pictureGenerationInstruction("generate a blue cube")
for _, want := range []string{"Telegram /pic command", "built-in image generation", "generate a blue cube"} {
if !strings.Contains(instruction, want) {
t.Fatalf("instruction missing %q in %q", want, instruction)
}
}
for _, unwanted := range []string{"/home", "repo/playground"} {
if strings.Contains(instruction, unwanted) {
t.Fatalf("instruction contains non-portable text %q: %q", unwanted, instruction)
}
}
}
func TestSplitAssistantMessageSegmentsWithPhotoDirective(t *testing.T) {
photoPath := filepath.Join(string(filepath.Separator), "workspace", "photo.jpg")
text := fmt.Sprintf("before\n<!-- telegram-photo {\"path\":%q,\"caption\":\"hello\"} -->\nafter", photoPath)