Skip to content

Commit 182c62c

Browse files
author
aandrew-me
committed
Add log feature for multiline
1 parent 4c33574 commit 182c62c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: main.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func main() {
253253
os.Exit(0)
254254
}
255255
if len(*logFile) > 0 {
256-
utils.LogToFile(input, "User", "log.txt")
256+
utils.LogToFile(input, "USER_QUERY", "log.txt")
257257
}
258258
// Use preprompt for first message
259259
if previousMessages == "" {
@@ -265,7 +265,7 @@ func main() {
265265
Provider: *provider,
266266
})
267267
if len(*logFile) > 0 {
268-
utils.LogToFile(responseTxt, "Assistant", "log.txt")
268+
utils.LogToFile(responseTxt, "ASSISTANT_RESPONSE", "log.txt")
269269
}
270270
previousMessages += responseJson
271271
history = append(history, input)
@@ -294,13 +294,22 @@ func main() {
294294
os.Exit(1)
295295
}
296296
if len(userInput) > 0 {
297+
if len(*logFile) > 0 {
298+
utils.LogToFile(userInput, "USER_QUERY", "log.txt")
299+
}
300+
297301
responseJson, responseTxt := getData(userInput, true, structs.ExtraOptions{
298302
PrevMessages: previousMessages,
299303
Provider: *provider,
300304
ThreadID: threadID,
301305
})
306+
302307
previousMessages += responseJson
303308
lastResponse = responseTxt
309+
310+
if len(*logFile) > 0 {
311+
utils.LogToFile(responseTxt, "ASSISTANT_RESPONSE", "log.txt")
312+
}
304313
}
305314

306315
}
@@ -482,7 +491,7 @@ func showHelpMessage() {
482491
fmt.Printf("%-50v Set temperature\n", "--temperature")
483492
fmt.Printf("%-50v Set top_p\n", "--top_p")
484493
fmt.Printf("%-50v Set max response length\n", "--max_length")
485-
fmt.Printf("%-50v Set filepath to log conversation to\n", "--log")
494+
fmt.Printf("%-50v Set filepath to log conversation to (For interactive modes)\n", "--log")
486495
fmt.Printf("%-50v Execute shell command without confirmation\n", "-y")
487496

488497
boldBlue.Println("\nOptions:")

0 commit comments

Comments
 (0)