summaryrefslogtreecommitdiff
path: root/make_chat.go
blob: b5f62cfad2eb3fee97109a622d33aa1dc5e1d195 (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
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.AppendNew(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.AppendNew(chat)

	return t
}