Browse Source

Separate log and GUI output. New formatting

master
The Dod 1 year ago
parent
commit
6d147cbd30

+ 4
- 3
doctor.py View File

60
 Hit <Enter> to exit
60
 Hit <Enter> to exit
61
 =====================================================================""", logfile)
61
 =====================================================================""", logfile)
62
 slowprint("Doctor Kernel: {}\n".format(
62
 slowprint("Doctor Kernel: {}\n".format(
63
-    conversation.predict(input="Hello again, doctor. Please remind me what we were talking about last time."), logfile))
63
+    conversation.predict(input="Hello again, doctor. Please remind me what we were talking about last time.")), logfile)
64
 while True:
64
 while True:
65
     try:
65
     try:
66
         prompt = input("JJ: > ").strip()
66
         prompt = input("JJ: > ").strip()
73
 =====================================================================""")
73
 =====================================================================""")
74
             sys.exit(0)
74
             sys.exit(0)
75
     if logfile:
75
     if logfile:
76
-        logfile.write("JJ: {}\n".format(prompt))
77
-    slowprint("Doctor Kernel: {}".format(conversation.predict(input=prompt)), logfile)
76
+        logfile.write("JJ: {}\n\n".format(prompt))
77
+    print('') # Skip a line
78
+    slowprint("Doctor Kernel: {}\n".format(conversation.predict(input=prompt)), logfile)

+ 5
- 2
logs/index.html View File

24
             <div class="col-12">
24
             <div class="col-12">
25
                 <ul class="list-group text-center">
25
                 <ul class="list-group text-center">
26
                     <li class="list-group-item">
26
                     <li class="list-group-item">
27
-                        <a target="_blank" class="btn btn-success" href="log-20230719-100651.txt">[log-20230719-100651.txt]</a>
27
+                        <a target="_blank" class="btn btn-success" href="log-20230722-171740.txt">[log-20230722-171740.txt]</a>
28
                     </li>
28
                     </li>
29
                     <li class="list-group-item">
29
                     <li class="list-group-item">
30
-                        <a target="_blank" class="btn btn-success" href="log-20230718-212029.txt">[log-20230718-212029.txt]</a>
30
+                        <a target="_blank" class="btn btn-success" href="log-20230722-170652.txt">[log-20230722-170652.txt]</a>
31
+                    </li>
32
+                    <li class="list-group-item">
33
+                        <a target="_blank" class="btn btn-success" href="log-20230722-170005.txt">[log-20230722-170005.txt]</a>
31
                     </li>
34
                     </li>
32
                 </ul>
35
                 </ul>
33
              </div>
36
              </div>

+ 0
- 19
logs/log-20230718-212029.txt View File

1
-=====================================================================
2
-Interactive Talk-Program loaded and started.
3
-Users:
4
-* [Doctor Kernel]
5
-* [JJ] <- you
6
-=====================================================================
7
-Doctor Kernel: Hello JJ, last time we were discussing your dreams and the symbolism within them. We talked about the hat and the dress representing different aspects of your personality, and how the dream may be reflecting your longing for mastery and balance in your relationships. We also touched on the significance of Judd, your friend who provides support and helps you navigate through challenging emotions and situations. Is there anything specific you would like to explore further?
8
-> 
9
-JJ: What do you think about tetris?
10
-Doctor Kernel: Ah, Tetris. We've discussed it before, haven't we? It seems to hold a significant place in your life. From what you've shared, it appears that Tetris provides you with a sense of fascination, challenge, and even terror at times. It's almost as if the game has become a metaphor for the complexities and uncertainties you face in your life. Do you find that it helps you escape from or cope with those challenges?
11
-> 
12
-JJ: It's hard to tell. I think that tetris has a well defined set of options for the player (unlike marbles). This gives me a sense of security.
13
-Doctor Kernel: Yes, I can understand how the clear rules and structure of Tetris can provide a sense of security and control. In a way, it creates a predictable and ordered world within the game. It's natural to seek out that kind of stability, especially when facing uncertainties and challenges in other areas of life. However, it's important to also explore other ways to cope with and navigate those challenges. Remember, life itself is full of uncertainties and complexities that can't always be neatly arranged like Tetris blocks.
14
-> 
15
-=====================================================================
16
-End of Talk
17
-=====================================================================
18
-
19
-

+ 0
- 20
logs/log-20230719-100651.txt View File

1
-=====================================================================
2
-Interactive Talk-Program loaded and started.
3
-Users:
4
-* [Doctor Kernel]
5
-* [JJ] <- you
6
-=====================================================================
7
-Doctor Kernel: Hello JJ, last time we were discussing your obsession with the game Tetris and how it has become a significant part of your life. We also talked about the significance of dreams and how they can provide insights into our subconscious thoughts and desires. Is there anything specific you would like to continue discussing?
8
-> 
9
-JJ: do you think my dreams can explain my tetris addiction?
10
-Doctor Kernel: It's possible, JJ. Dreams often reflect our subconscious desires and fears. Exploring the symbols and themes in your dreams may help shed light on the underlying reasons for your Tetris addiction. It could be worth exploring further.
11
-> 
12
-JJ: Do you have any insights from what you know so far?
13
-Doctor Kernel: Based on what you've shared about your dreams, it seems that there are elements of longing for mastery, a desire for escape, and a sense of being lost or disconnected. These themes may be connected to your Tetris addiction in some way. Perhaps the game provides a sense of control and order that you may feel is lacking in other areas of your life. It could be worth exploring these connections further to gain a deeper understanding.
14
-> 
15
-JJ: Do you think marbles represent loss of control?
16
-Doctor Kernel: It's possible, JJ. Marbles in dreams can symbolize various things, including playfulness, childhood, and the loss of control. Given your description of gathering the marbles and holding them close to you, it could suggest a desire to regain a sense of control or to hold onto something precious. However, dreams are highly personal, so it's important to explore your own thoughts and feelings surrounding the marbles to gain a clearer understanding of their significance in your dreams.
17
-> 
18
-=====================================================================
19
-End of Talk
20
-=====================================================================

+ 13
- 0
logs/log-20230722-170005.txt View File

1
+=====================================================================
2
+Interactive Talk-Program loaded and started.
3
+Users:
4
+* [Doctor Kernel]
5
+* [JJ] <- you
6
+Hit <Enter> to exit
7
+=====================================================================
8
+Doctor Kernel: Hello, JJ. Last time, we were discussing your obsession with Tetris and how it may be related to your need for control and order in your life. We also explored the idea that your dreams and the game serve as a form of escape or a way to fill empty spaces. Additionally, we touched on the possibility that your profession in computer systems security may be a reflection of your own need for protection and fortification. How are you feeling about these ideas?
9
+
10
+JJ: Judd's bike is not exactly protection and fortification, how does it fiit in?
11
+
12
+Doctor Kernel: Ah, yes, Judd's motorbike. It seems that the motorbike represents a sense of freedom and escape for you. While your profession may be associated with protection and fortification, Judd and his motorbike provide a different kind of release from the challenges and pressures you face. It's important to have these outlets in your life that offer a break from routine and allow you to explore different aspects of yourself.
13
+

+ 13
- 0
logs/log-20230722-170652.txt View File

1
+=====================================================================
2
+Interactive Talk-Program loaded and started.
3
+Users:
4
+* [Doctor Kernel]
5
+* [JJ] <- you
6
+Hit <Enter> to exit
7
+=====================================================================
8
+Doctor Kernel: Hello JJ! Last time, we were discussing your obsession with Tetris and how it relates to your life and psyche. We also touched on your dreams and their significance. Is there something specific you would like to continue discussing?
9
+
10
+JJ: Some people say that because many software systems store the year as 2 digits, we can expect many of them to crash or corrupt data when the year 2000 comes. How dangerous do you think this might be?
11
+
12
+Doctor Kernel: Ah, the infamous Y2K problem. It's true that many software systems were designed with only two-digit year storage, which could cause issues when the year 2000 arrives. The potential consequences of this problem are still uncertain, but it's definitely something that needs to be taken seriously. Many organizations are working hard to address the issue and update their systems to avoid any major disruptions. It's always a good idea to be prepared and have backup plans in place, just in case.
13
+

+ 13
- 0
logs/log-20230722-171740.txt View File

1
+=====================================================================
2
+Interactive Talk-Program loaded and started.
3
+Users:
4
+* [Doctor Kernel]
5
+* [JJ] <- you
6
+Hit <Enter> to exit
7
+=====================================================================
8
+Doctor Kernel: Hello, JJ. Last time, we were discussing your obsession with Tetris and how it both fascinates and terrifies you. We also explored the idea of seriousness and how games can contain gravity. We touched upon the idea of your life being like an ongoing game or riddle that you feel compelled to solve. Additionally, we delved into the symbolism in your dream, particularly the hat and the marbles. Finally, we talked about the role of Judd in your life as a supportive friend. Is there something specific you'd like to continue discussing?
9
+
10
+JJ: What does the dress symbolize?
11
+
12
+Doctor Kernel: The dress in your dream could symbolize various things, depending on your personal associations and experiences. It could represent femininity, self-expression, or even a desire to escape from your current circumstances. It's important to explore your own feelings and thoughts about the dress to gain a deeper understanding of its significance for you.
13
+

+ 9
- 11
run.sh View File

6
 while [ 1 ] ; do
6
 while [ 1 ] ; do
7
     LOGFILE=log-$(date +%Y%m%d-%H%M%S).txt
7
     LOGFILE=log-$(date +%Y%m%d-%H%M%S).txt
8
     python doctor.py logs/$LOGFILE
8
     python doctor.py logs/$LOGFILE
9
-    # We expect at least
10
-    # * '<Enter>' in the header
11
-    # * first '>' prompt
12
-    # A third '>' means at least a single prompt from the user
13
-    if [ $(grep -c '>' logs/$LOGFILE) -lt 3 ] ; then
14
-        rm logs/$LOGFILE
15
-        dialog --title "Session aborted" --msgbox "Hit <Enter> to continue..." 5 60
16
-    else
17
-	# clear aborted logs that somehow weren't caught
18
-        grep -c ">" logs/*.txt | grep ':[12]$'| sed 's/:.*//' | xargs rm
9
+    if [ $(grep -c "JJ:" logs/$LOGFILE) -eq 0 ]; then
10
+	rm logs/$LOGFILE
11
+    elif dialog --title "Save session log?" --clear --defaultno --yesno "Save $LOGFILE?"  5 40 ; then
12
+	# clear uncaught aborted logs
13
+        grep -c "JJ:" logs/*.txt | grep ':0$'| sed 's/:.*//' | xargs rm
19
         python genlogs.py
14
         python genlogs.py
20
-        dialog --title "Session saved" --msgbox "Session saved to file $LOGFILE" 5 60
15
+        dialog --title "Session saved" --msgbox "Session saved to file $LOGFILE
16
+You may access it via WWW over LAN" 6 60
17
+    else
18
+        rm logs/$LOGFILE
21
     fi
19
     fi
22
 done
20
 done

Loading…
Cancel
Save