From 7f8f5e3b9b37fccbb357b70e6490823a8b22ae7e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 30 Aug 2025 14:42:57 -0500 Subject: basic JSON parsing into genai struc --- doNewChat.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'doNewChat.go') diff --git a/doNewChat.go b/doNewChat.go index bd71f45..f9793d1 100644 --- a/doNewChat.go +++ b/doNewChat.go @@ -1,28 +1,19 @@ package main import ( - "fmt" - "go.wit.com/lib/protobuf/chatpb" "go.wit.com/log" "google.golang.org/protobuf/types/known/timestamppb" ) func doNewChat() { - if len(argv.NewChat) != 2 { - log.Error(fmt.Errorf("expected 2 arguments for --new-chat")) - return - } - uuid := argv.NewChat[0] - topic := argv.NewChat[1] - chat := &chatpb.Chat{ - Uuid: uuid, - ChatName: topic, + Uuid: argv.Uuid, + ChatName: argv.Topic, Ctime: timestamppb.Now(), } me.chats.Chats = append(me.chats.Chats, chat) me.chats.ConfigSave() - log.Info("created new chat for", uuid) + log.Info("created new chat for", argv.Uuid) } -- cgit v1.2.3