Project

General

Profile

Update TreeView » History » Version 7

Tomislav Pleše, 10/02/2025 01:35 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 4 Tomislav Pleše
SCREEN: HomeScreen <-> TreeSliverThread <-> TreeSliverItem
19
20
21 6 Tomislav Pleše
  1. First Prompt - Root Creation
22 1 Tomislav Pleše
23 6 Tomislav Pleše
    1. 1. There is a text input field and a submit button on the screen.
24
    1. 2. User writes a prompt and presses submit button.
25
    1. 3. App creates new Point, sends it to backend to be saved - BackendService class.
26
    1. 4. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
27
    1. 5. App creates a card and puts the node (with only prompt) in the card. 
28
    1. 6. App shows the card on the screen - TreeSliverItem class.
29
    1. 7. App sends user's prompt to OpenAI API (via java backend app) - OpenAIService class.
30
    1. 8. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
31
    1. 9. App shows on screen AI's response in the same card where the user's prompt is - TreeSliverItem class.
32
33
34
  2. New Prompt - when there were previous Prompt/Response combination nodes
35
36
    2. 1. On the screen are shown one after another previous cards with nodes (Prompt/Response combinations), or only one previous (root) card.
37
    2. 2. User writes a prompt and presses submit button.
38
    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.
39
    2. 4. App propagates PromptArgs to the HomeScreen, to be taken as argument in the onPrompt method. 
40
    2. 5. App creates new Point, sends it to backend to be saved - BackendService class.
41
    2. 6. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
42
    2. 7. App creates a card and puts the node (with only prompt) in the card. 
43
    2. 8. App shows the card on the screen - TreeSliverItem class.
44
    2. 9. App sends user's prompt to OpenAI API (via java backend) - OpenAIService class
45
    2. 10. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
46
    2. 11. App shows on screen AI's response in the same card where the user's prompt is - TreeSliverItem class.
47 5 Tomislav Pleše
  
48 7 Tomislav Pleše
  3. New Sub Prompt - when there were previous Prompt/Response combination nodes
49 5 Tomislav Pleše
50 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.
51
    3. 2. User writes a prompt and presses submit button.
52
    3. 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.
53
    3. 4. App propagates PromptArgs to the HomeScreen, to be taken as argument in the onPrompt method. 
54
    3. 5. App creates new Point, sends it to backend to be saved - BackendService class.
55
    3. 6. App creates a node. Node's main purpose is to hold Prompt message and Response message. 
56
    3. 7. App creates a card and puts the node (with only prompt) in the card. 
57
    3. 8. App shows the card on the screen - TreeSliverItem class.
58
    3. 9. App sends user's prompt to OpenAI API (via java backend) - OpenAIService class
59
    3. 10. App receives OpenAI's response and saves it in the ThreadMap - ThreadManager class.
60
    3. 11. App shows on screen AI's response in the same card where the user's prompt is - TreeSliverItem class.
61 4 Tomislav Pleše
62 2 Tomislav Pleše
63
64
65
In my flutter app I have Point model (from which a node in tree view is created). There is a regular Point, and there is a Shard Point. Shard Point is the one that has one or more ShardDTOs in it's shardList list. Shards are created by sharding: user enters sub-prompt, and from that new Shard is created and added to shardsList.
66
67
I have already implemented a flow for handling Prompts for regular Points. It goes:
68
PromptInputField -> HomeScreen -> HomeScreenManager -> ThreadManager -> PointManager (when there is no Sharding).
69
70
I now want to implement a flow that will handle sub-Prompts (which creates Shard Points), where the flow would go:
71
PromptInputField -> HomeScreen -> HomeScreenManager -> ThreadManager -> ShardManager (when there is Sharding (creation of new Shards)). There can be use of existing methods in PointManager where applicable, but main logic should reside in the ShardManager.
72
73
The branching between Sharding and No Sharding flows is currently in the HomeScreenManger in the method: handlePrompt(). Try to see if it should stay there, or should be moved to the ThreadManager.
74
75
Look at my code and suggest minimal changes that will make this work.