Skip to content

File annotation breaks the link #67

@abomariam

Description

@abomariam

GPT-4 returns the links as Markup link [Label](example_url). If you modify this format by entering anything before the closing ), the URL will not be displayed correctly.

Here is the response message from OpenAI APIs

{
  "annotations" : [ {
    "container_id" : "cntr_6974532f1fc081908fe0d2ce44b37d7004739b160af8b41f",
    "end_index" : 126,
    "file_id" : "cfile_6974534d264881918c4226c3de03483c",
    "filename" : "attendee_report_nutcracker_2024_12_07_2pm.csv",
    "start_index" : 63,
    "type" : "container_file_citation"
  } ],
  "text" : "Here is your attendee report in CSV format: [Download the CSV](sandbox:/mnt/data/attendee_report_nutcracker_2024_12_07_2pm.csv)",
  "type" : "output_text",
  "logprobs" : [ ]
}

And here is the equivilant ChatKit message with annotations

{
	"type": "thread.item.done",
	"item": {
		"id": "msg_032763fb84653fcd006924534a6f548190b105c0640d3d908f",
		"thread_id": "db166398-82ea-4695-8877-6a92a9d870c1",
		"created_at": "2025-11-24T12:45:01.298359",
		"type": "assistant_message",
		"content": [
			{
				"annotations": [
					{
						"type": "annotation",
						"source": {
							"title": "attendee_report_nutcracker_2024_12_07_2pm.csv",
							"type": "file",
							"filename": "attendee_report_nutcracker_2024_12_07_2pm.csv"
						},
						"index": 126
					}
				],
				"text": "Here is your attendee report in CSV format: [Download the CSV](sandbox:/mnt/data/attendee_report_nutcracker_2024_12_07_2pm.csv)",
				"type": "output_text"
			}
		]
	}
}

The URL text ends at index 126, but we can't add the annotation before the closing ) at index 127 or it'll break the UI.

Here is how it looks:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions