Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Update layout.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dabumana committed Jan 3, 2023
1 parent 7c11754 commit 829c550
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion service/layout.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package service

import (
"fmt"
"os"
"sync"

"github.com/gdamore/tcell/v2"
Expand Down Expand Up @@ -32,6 +34,14 @@ func OnNewTopic() {
Node.Layout.promptInput.SetText("")
}

func OnExport() {
out, err := os.Create("export/conversation.txt")
if err != nil {
fmt.Printf("err: %v\n", err)
}
out.WriteString(fmt.Sprintln(Node.Layout.promptOutput))
}

// Dropdown from input to change mode
func OnChangeMode(option string, optionIndex int) {
switch option {
Expand Down Expand Up @@ -144,6 +154,8 @@ func OnChangeWords(option string, optionIndex int) {
maxtokens = 1
case "50":
maxtokens = 37
case "85":
maxtokens = 64
case "100":
maxtokens = 75
case "500":
Expand Down Expand Up @@ -286,9 +298,10 @@ func InitializeLayout() {
AddDropDown("Engine", []string{"davinci", "curie", "babbage", "ada", "cushman"}, 0, OnChangeEngine).
AddDropDown("Results", []string{"r1", "r2", "r4", "r8"}, 0, OnChangeResultsAndProbs).
AddDropDown("Probabilities", []string{"p1", "p2", "p4", "p8"}, 0, OnChangeResultsAndProbs).
AddDropDown("Words", []string{"1", "50", "100", "500", "1000", "1500"}, 2, OnChangeWords).
AddDropDown("Words", []string{"1", "50", "85", "100", "500", "1000", "1500"}, 2, OnChangeWords).
AddCheckbox("Affinity", false, OnCheck).
AddButton("New conversation", OnNewTopic).
AddButton("Export conversation", OnExport).
SetHorizontal(true).
SetLabelColor(tcell.ColorDarkCyan.TrueColor()).
SetFieldBackgroundColor(tcell.ColorDarkGrey.TrueColor()).
Expand Down

0 comments on commit 829c550

Please sign in to comment.