MCPcopy Index your code
hub / github.com/docker/docker-agent / sendFirstMessage

Method sendFirstMessage

pkg/leantui/update.go:264–289  ·  view source on GitHub ↗
(ctx context.Context, msg, attachPath string)

Source from the content-addressed store, hash-verified

262}
263
264func (m *model) sendFirstMessage(ctx context.Context, msg, attachPath string) {
265 var atts []messages.Attachment
266 if attachPath != "" {
267 if abs, err := filepath.Abs(attachPath); err == nil {
268 atts = append(atts, messages.Attachment{Name: filepath.Base(abs), FilePath: abs})
269 }
270 }
271
272 trimmed := strings.TrimSpace(msg)
273 switch {
274 case trimmed != "":
275 m.addUserEcho(trimmed)
276 case len(atts) > 0:
277 m.addNotice("", "(attached "+atts[0].Name+")", stMuted())
278 default:
279 return
280 }
281
282 content := msg
283 if strings.HasPrefix(trimmed, "/") {
284 if resolved := m.app.ResolveInput(ctx, trimmed); resolved != "" {
285 content = resolved
286 }
287 }
288 m.startRun(ctx, content, atts)
289}
290
291func (m *model) startRun(ctx context.Context, message string, attachments []messages.Attachment) {
292 runCtx, cancel := context.WithCancel(ctx)

Callers 1

RunFunction · 0.80

Calls 5

addUserEchoMethod · 0.95
addNoticeMethod · 0.95
startRunMethod · 0.95
stMutedFunction · 0.85
ResolveInputMethod · 0.80

Tested by

no test coverage detected