-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathInputContainers.go
More file actions
77 lines (67 loc) · 1.98 KB
/
Copy pathInputContainers.go
File metadata and controls
77 lines (67 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"aigen/aigenRest"
"aigen/aigenUi"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"log"
)
func bottomInputBox(chat *fyne.Container, tabs *container.AppTabs, aiGen *container.TabItem) *container.Split {
inputBox := widget.NewMultiLineEntry()
inputBox.Wrapping = fyne.TextWrapWord
//TODO: Edit InputBox OnChanged
inputBox.OnChanged = func(s string) {
log.Printf("Input changed to: %s", s)
kitchenLog(s)
}
//TODO: Edit InputBox Container
inputBox.PlaceHolder = "Enter your message here..."
// Model selector dropdown
selectedModel, err := aigenUi.GetSelectedModel()
if err != nil {
log.Printf("Error getting selected model: %v", err)
}
modelSelector := widget.NewSelect([]string{"OpenAI", "Claude", "Gemini", "Ollama"}, func(value string) {
log.Printf("Model selected: %s", value)
err := aigenUi.UpdateSelectedModel(value)
if err != nil {
log.Printf("Error updating model: %v", err)
}
aigenRest.SendNotificationNow("Switched to " + value)
})
// Set the initial selected model
if selectedModel != "" {
modelSelector.SetSelected(selectedModel)
} else {
modelSelector.SetSelected("OpenAI")
}
sendButton := sendButton(inputBox, chat)
voiceNoteButton := voiceChatButton(inputBox, chat)
mediaUploadButton := imageUploadInput(inputBox, chat)
voiceNoteButton.Resize(fyne.NewSize(50, 100))
// Top row with model selector and buttons
buttonRow := container.NewHBox(sendButton)
// Left side: Model selector and input box
leftSide := container.NewVBox(
modelSelector,
inputBox,
)
// Right side: Buttons
rightSide := container.NewVBox(
buttonRow,
voiceNoteButton,
mediaUploadButton,
)
// Main container with left (input + model) and right (buttons)
inputBoxContainer := container.NewHSplit(leftSide, rightSide)
tabs.OnSelected = func(tab *container.TabItem) {
if tab == aiGen {
//Show if tab is home
inputBoxContainer.Show()
} else {
inputBoxContainer.Hide()
}
}
return inputBoxContainer
}