summaryrefslogtreecommitdiff
path: root/make_chat.go
blob: b6736c4cb97cdc367d02e9263640835ff00cf3f7 (plain)
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
78
79
80
81
82
83
84
85
package chatpb

import "go.wit.com/log"

func TestChat() {
	conversation := NewChats()

	/*
		chat := new(Chat)
		chat.Content = "this was fun"

		t := new(Table)
		t.Columns = 4
		// t.Rows = append(t.Rows, []string{"a", "b"})
		chat.Table = t

		r := new(Row)
		r.Fields = []string{"a", "b"}
		t.Rows = append(t.Rows, r)

		r = new(Row)
		r.Fields = []string{"1", "", "2", "3"}
		t.Rows = append(t.Rows, r)

		conversation.Append(chat)
	*/

	t := conversation.AddTable()
	t.AddRow([]string{"apple", "pear"})

	conversation.AddGeminiComment("funny")
	conversation.AddUserComment("yes")

	conversation.AddGeminiComment("I like astronomy")

	dump := conversation.FormatTEXT()

	log.Println(dump)
}

func (t *Table) AddRow(f []string) {
	r := new(Row)
	r.Fields = f
	t.Rows = append(t.Rows, r)
}

func (c *Chats) AddTable() *Table {
	chat := new(Chat)

	t := new(Table)
	t.Columns = 4
	// t.Rows = append(t.Rows, []string{"a", "b"})

	r := new(Row)
	r.Fields = []string{"j", "r", "a", "b"}
	t.Rows = append(t.Rows, r)

	r = new(Row)
	r.Fields = []string{"1", "", "2", "3"}
	t.Rows = append(t.Rows, r)

	chat.Table = t

	c.Append(chat)

	return t
}

func (c *Chats) AddGeminiComment(s string) {
	chat := new(Chat)

	chat.From = Who_GEMINI
	chat.Content = s

	c.Append(chat)
}

func (c *Chats) AddUserComment(s string) {
	chat := new(Chat)

	chat.From = Who_USER
	chat.Content = s

	c.Append(chat)
}