| 432 | } |
| 433 | |
| 434 | func (o *Flags) BuildChatOptions() (ret *domain.ChatOptions, err error) { |
| 435 | // Validate image file if specified |
| 436 | if err = validateImageFile(o.ImageFile); err != nil { |
| 437 | return nil, err |
| 438 | } |
| 439 | |
| 440 | // Validate image parameters |
| 441 | if err = validateImageParameters(o.ImageFile, o.ImageSize, o.ImageQuality, o.ImageBackground, o.ImageCompression); err != nil { |
| 442 | return nil, err |
| 443 | } |
| 444 | |
| 445 | startTag := o.ThinkStartTag |
| 446 | if startTag == "" { |
| 447 | startTag = "<think>" |
| 448 | } |
| 449 | endTag := o.ThinkEndTag |
| 450 | if endTag == "" { |
| 451 | endTag = "</think>" |
| 452 | } |
| 453 | |
| 454 | ret = &domain.ChatOptions{ |
| 455 | Model: o.Model, |
| 456 | Temperature: o.Temperature, |
| 457 | TopP: o.TopP, |
| 458 | PresencePenalty: o.PresencePenalty, |
| 459 | FrequencyPenalty: o.FrequencyPenalty, |
| 460 | Raw: o.Raw, |
| 461 | Seed: o.Seed, |
| 462 | Thinking: o.Thinking, |
| 463 | ModelContextLength: o.ModelContextLength, |
| 464 | Search: o.Search, |
| 465 | SearchLocation: o.SearchLocation, |
| 466 | ImageFile: o.ImageFile, |
| 467 | ImageSize: o.ImageSize, |
| 468 | ImageQuality: o.ImageQuality, |
| 469 | ImageCompression: o.ImageCompression, |
| 470 | ImageBackground: o.ImageBackground, |
| 471 | SuppressThink: o.SuppressThink, |
| 472 | ThinkStartTag: startTag, |
| 473 | ThinkEndTag: endTag, |
| 474 | Voice: o.Voice, |
| 475 | Notification: o.Notification || o.NotificationCommand != "", |
| 476 | NotificationCommand: o.NotificationCommand, |
| 477 | ShowMetadata: o.ShowMetadata, |
| 478 | } |
| 479 | return |
| 480 | } |
| 481 | |
| 482 | func (o *Flags) BuildChatRequest(Meta string) (ret *domain.ChatRequest, err error) { |
| 483 | ret = &domain.ChatRequest{ |