Project

General

Profile

Update TreeView » History » Version 12

Tomislav Pleše, 10/11/2025 02:12 PM

1 1 Tomislav Pleše
# Update TreeView
2 2 Tomislav Pleše
3
4 3 Tomislav Pleše
CASES
5 2 Tomislav Pleše
1. Root Creation
6
2. Root Parent - Directly Under Root
7
3. Root Parent - Under Regular Point
8
4. Root-Shard Parent - Under Regular Point
9
5. Child-Shard Parent - Under Regular Point
10 1 Tomislav Pleše
6. Root Parent - Root Initial Sharding
11
7. Root-Shard Parent - Root 2nd Sharding
12
8. Regular Child - Regular Point Initial Sharding
13
9. Child-Shard Parent - Regular Point 2nd Sharding   
14 3 Tomislav Pleše
15
16
FLOW
17
18 9 Tomislav Pleše
SCREEN FLOW: HomeScreen <-> TreeSliverThread <-> TreeSliverItem
19 1 Tomislav Pleše
20 11 Tomislav Pleše
21 12 Tomislav Pleše
## 1st VERSION - PROMPT TO CLUDE: 
22 11 Tomislav Pleše
23 9 Tomislav Pleše
USER STORIES: 
24 4 Tomislav Pleše
25 6 Tomislav Pleše
  1. First Prompt - Root Creation
26 1 Tomislav Pleše
27 6 Tomislav Pleše
    1. 1. There is a text input field and a submit button on the screen.
28
    1. 2. User writes a prompt and presses submit button.
29
    1. 3. App creates new Point, sends it to backend to be saved - BackendService class.
30
    1. 4. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
31
    1. 5. App creates a card and puts the node (with only prompt) in the card. 
32
    1. 6. App shows the card on the screen - TreeSliverItem class.
33
    1. 7. App sends user's prompt to OpenAI API (via java backend app) - OpenAIService class.
34
    1. 8. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
35
    1. 9. App shows on screen AI's response in the same card where the user's prompt is - TreeSliverItem class.
36
37
38
  2. New Prompt - when there were previous Prompt/Response combination nodes
39
40
    2. 1. On the screen are shown one after another previous cards with nodes (Prompt/Response combinations), or only one previous (root) card.
41
    2. 2. User writes a prompt and presses submit button.
42
    2. 3. App takes the pointId from the previous node (most bottom one) and sets it as a currentPointId in PromptArgs - TreeSliverItem. Also, other existing and needed properties are taken from the node into the PromptArgs.
43
    2. 4. App propagates PromptArgs to the HomeScreen, to be taken as argument in the onPrompt method. 
44
    2. 5. App creates new Point, sends it to backend to be saved - BackendService class.
45
    2. 6. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
46
    2. 7. App creates a card and puts the node (with only prompt) in the card. 
47
    2. 8. App shows the card on the screen - TreeSliverItem class.
48
    2. 9. App sends user's prompt to OpenAI API (via java backend) - OpenAIService class
49
    2. 10. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
50
    2. 11. App shows on screen AI's response in the same card where the user's prompt is - TreeSliverItem class.
51 5 Tomislav Pleše
  
52 7 Tomislav Pleše
  3. New Sub Prompt - when there were previous Prompt/Response combination nodes
53 5 Tomislav Pleše
54 7 Tomislav Pleše
    3. 1. On the screen are shown one after another previous cards with nodes (Prompt/Response combinations), or only one previous (root) card.
55 8 Tomislav Pleše
    3. 2. User selects a portion of the previous response (from the node.response that is shown on the card).
56
    3. 3. Default popup on the screen is shown, with Copy, Paste, Share... buttons. Added is the App's Sub-prompt button.
57
    3. 4. User taps the Sub-prompt button. 
58
    3. 5. App copies the text portion user selected and pastes it into the text input field.
59
    3. 6. App takes the selected text, start and end positions and propagates it to the TreeNodeModel class. 
60
    3. 7. User writes additional text into the text input field (if they choose this) and presses submit button.
61
    3. 8. App takes the pointId from the previous node (most bottom one) and sets it as a currentPointId in PromptArgs - TreeSliverItem. Also, other existing and needed properties (like the selected text, start and end positions) are taken from the node into the PromptArgs.
62 2 Tomislav Pleše
    3. 4. App propagates PromptArgs to the HomeScreen, to be taken as argument in the onPrompt method. 
63
    3. 5. App creates new Point, sends it to backend to be saved - BackendService class.
64
    3. 6. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
65
    3. 7. App creates a card and puts the node (with only prompt) in the card. 
66 8 Tomislav Pleše
    3. 8. App takes the previous node/card and devides it into two parts: 1st part = card with the prompt and response that is from the beginning of the response till the end position (of the seleceted text), and 2nd part = card with only the part of response from the first character after the end position, till the end of the response. So the App divides one card into two cards at the end of the user selected text.
67
    3. 9. App inserts (indented) the new card with the new prompt.    
68
    3. 10. App shows the card on the screen - TreeSliverItem class.
69
    3. 11. App sends user's prompt to OpenAI API (via java backend) - OpenAIService class
70
    3. 12. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
71
    3. 13. App shows on screen AI's response in the same card where the new user's prompt is - TreeSliverItem class.
72 10 Tomislav Pleše
73
74
75 12 Tomislav Pleše
## 2nd VERSION - PROMPT TO CLUDE:
76 10 Tomislav Pleše
77
Actually, this should be the behavior
78
 
79
1. Submitting 1st Prompt (normal prompt) node structure:
80
81
├─ 💬 (1st Prompt) User: What's Earth?
82
├─ 💬 (1st Response) Assistant: Third planet from the Sun, home to diverse life forms, and the only kn…
83
84
(Response) Assistant: Third planet from the Sun, home to diverse life forms, and the only kn…
85
86
2. Submitting 2nd Prompt (sub prompt, with selected text "Sun") node structure:
87
88
  ├─ 💬 (1st Prompt) User: What's Earth?
89
  ├─ 💬 (1st Response - 1st part) Assistant: Third planet from the Sun
90
  │   └─ 💬 (2nd Prompt) User: Sun - what's this?
91
  │   └─ 💬 (2nd Response) Assistant: Star at the center of our solar system that provides light and heat to…
92
  └─ 💬 (1st Response 2nd part) Assistant: Third planet from the Sun, home to diverse life forms, and the only kn…
93
94
95 1 Tomislav Pleše
Can you implement this?
96 11 Tomislav Pleše
97
98 12 Tomislav Pleše
## 3rd VERSION - PROMPT TO CLUDE:
99 11 Tomislav Pleše
100
101
Following is the representation of Node (Prompt/Response) on the screen after Steps 1 and 2. For Step 2, I am showing the current behavior, and desired behavior.
102
103
Step 1 - how the screen looks after the first (normal) prompt:
104
______________________________________________________________________________________
105
| You                                                                                |
106
| What's Earth?                                                                      | -> (1st Prompt)
107
├------------------------------------------------------------------------------------- 
108
| AI Assistant                                                                       | 
109
| Third planet from the Sun, home to diverse life forms, and the only kn…            | 
110
|____________________________________________________________________________________| -> (1st Response)
111
112
113
Step 2  - when User creates a sub-prompt. 
114
 a) Current look:
115
______________________________________________________________________________________
116
| You                                                                                |
117
| What's Earth?                                                                      | -> (1st Prompt)
118
|____________________________________________________________________________________| 
119
|   |____________________________________________________________________________________
120
|   | Response Segment                                                                   |
121
|   | Third planet from the                                                              | -> (should be: Response and Shard Segment in one card - as part of the same Shard 1, of the 1st Response)
122
|   |____________________________________________________________________________________| 
123
|   |____________________________________________________________________________________
124
|   | Shard Segment                                                                      |
125
|   | Sun                                                                                | -> (should be: Response and Shard Segment in one card - as part of the same Shard 1, of the 1st Response)
126
|   |____________________________________________________________________________________|   
127
|   |  |_____________________________________________________________________________________
128
|   |  | Shard                                                                              |
129
|   |  | Sun - what's this?                                                                 | -> (2nd Prompt)
130
|   |  ├-------------------------------------------------------------------------------------
131
|   |  | AI Assistant                                                                       |
132
|   |  | Star at the center of our solar system, providing heat and light to Earth.         | -> (2nd Response)
133
|   |  |____________________________________________________________________________________|
134
|   |_____________________________________________________________________________________
135
|   | Assistant (Shard-2):                                                               |
136
|   | , home to diverse ecosystems, resources, and life forms, including humans.         | -> (Shard 2, of the 1st Response - correct)
137
|   |____________________________________________________________________________________|
138
|_____________________________________________________________________________________
139
| You                                                                                |
140
| Sun - what's this?                                                                 | -> (2nd Prompt - should not be shown here - already shown above)
141
├-------------------------------------------------------------------------------------
142
| AI Assistant                                                                       |
143
| Star at the center of our solar system, providing heat and light to Earth.         | -> (2nd Response - should not be shown here - already shown above)
144
|____________________________________________________________________________________|
145
146
147
  b) Desired look:
148
______________________________________________________________________________________
149
| User:                                                                              |
150
| What's Earth?                                                                      | -> (1st Prompt)
151
├------------------------------------------------------------------------------------- 
152
| Assistant (Shard-1):                                                               |
153
| Third planet from the Sun                                                          | -> (1st Response - Shard 1)
154
|____________________________________________________________________________________| 
155
|   |
156
|   |_____________________________________________________________________________________
157
|   | User:                                                                              |
158
|   | Sun - what's this?                                                                 | -> (2nd Prompt)
159
|   ├-------------------------------------------------------------------------------------
160
|   | Assistant:                                                                         |
161
|   | Star at the center of our solar system that provides light and heat to…            | -> (2nd Response)
162
|   |____________________________________________________________________________________|
163
|_____________________________________________________________________________________
164
| Assistant (Shard-2):                                                               |
165
| , home to diverse life forms, and the only kn…                                     | -> (1st Response - Shard 2)
166
|____________________________________________________________________________________|
167
168
Before doing any changes, please first let me know what you see is the difference between the current and desired Step 2.
169
170
Look at the fe_kommentall project at the classes TreeSliverThread, TreeSliverItem, TreSliverManager and any other you find involved in this feature's behvior.
171
172
Change the code minimally so it creates the desired look instead of the current one.