Skip to content

feat: add the model tag to TUI HTTP req/resp event#26

Merged
kemingy merged 3 commits into
mainfrom
tui_model
Apr 29, 2026
Merged

feat: add the model tag to TUI HTTP req/resp event#26
kemingy merged 3 commits into
mainfrom
tui_model

Conversation

@kemingy
Copy link
Copy Markdown
Member

@kemingy kemingy commented Apr 24, 2026

No description provided.

Signed-off-by: Keming <kemingyang@tensorchord.ai>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds provider/model tagging to the TUI’s HTTP request/response events so the selected model is visible directly in the event list.

Changes:

  • Extend displayRecord to carry Provider and Model metadata and render it as a tag beside the endpoint label.
  • Parse provider from the HTTP URL and model from the decoded JSON body (with a Gemini URL fallback).
  • Add unit tests covering OpenAI model extraction, Gemini URL model extraction, and localhost-as-local provider detection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tui/model.go Renders a model tag next to HTTP endpoints and adds tag styling per provider.
tui/format.go Extracts (provider, model) from HTTP events (URL + body) and populates displayRecord.
tui/format_test.go Adds tests validating provider/model extraction behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui/format.go Outdated
Comment thread tui/format.go
Comment thread tui/format.go Outdated
Signed-off-by: Keming <kemingyang@tensorchord.ai>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds provider/model “model tags” to the TUI for HTTP request/response events by extracting model metadata from the HTTP payload/URL and rendering it inline in the event list.

Changes:

  • Extend displayRecord with Provider/Model fields and render a colored model tag next to the endpoint label in the list view.
  • Parse HTTP events to infer provider from request URL and model from the request body (with a Gemini URL fallback).
  • Add unit tests to validate provider/model extraction for several providers and an unknown provider case.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tui/model.go Adds model-tag styles and renders the model tag in each list row.
tui/format.go Extracts Provider/Model during JSONL parsing for HTTP events (URL + body parsing).
tui/format_test.go Adds tests covering provider/model extraction behaviors.
Comments suppressed due to low confidence (1)

tui/model.go:406

  • renderRecordLine only truncates record.Summary; with the new model tag, label/prefix can easily exceed contentWidth (e.g., narrow terminal or long model name), causing lines to wrap or overflow the viewport. Consider truncating the model tag (or the full label) based on remaining width before building prefix, so lipgloss.Width(prefix) never exceeds contentWidth.
	labelParts := []string{style.Render(record.Endpoint)}
	if record.Model != "" {
		labelParts = append(labelParts, modelTagStyle(record.Provider).Render(record.Model))
	}
	label := lipgloss.JoinHorizontal(lipgloss.Left, labelParts...)
	cursor := "  "
	if selected {
		cursor = cursorStyle.Render("> ")
	}
	link := renderPairLink(annotation)
	prefix := lipgloss.JoinHorizontal(lipgloss.Left, cursor, ts+" ", link, label, " ")
	summaryWidth := max(0, contentWidth-lipgloss.Width(prefix))
	return lipgloss.JoinHorizontal(lipgloss.Left, prefix, truncateText(record.Summary, summaryWidth))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui/format.go
Signed-off-by: Keming <kemingyang@tensorchord.ai>
@kemingy kemingy merged commit d4eb8ae into main Apr 29, 2026
3 checks passed
@kemingy kemingy deleted the tui_model branch April 29, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants