Browse Source

Save user to moment file. Embed style edits

master
The Dod 8 months ago
parent
commit
26d88994c5
6 changed files with 27 additions and 23 deletions
  1. 2
    0
      app.py
  2. 3
    3
      static/css/style.css
  3. 6
    6
      templates/chat.html
  4. 2
    2
      templates/embeds.html
  5. 2
    2
      templates/example.html
  6. 12
    10
      templates/prompt.txt

+ 2
- 0
app.py View File

297
                 key: session.get(key, [])
297
                 key: session.get(key, [])
298
                 for key in ["messages", "history"]
298
                 for key in ["messages", "history"]
299
             }
299
             }
300
+            moment["user"] = session.get("user", "odelia")
300
             print(moment)
301
             print(moment)
301
             json.dump(moment, open(path,"w"), indent=4)
302
             json.dump(moment, open(path,"w"), indent=4)
302
             if is_overwrite:
303
             if is_overwrite:
320
             moment = json.load(open("archive/{}.json".format(filename)))
321
             moment = json.load(open("archive/{}.json".format(filename)))
321
             session["messages"] = moment["messages"]
322
             session["messages"] = moment["messages"]
322
             session["history"] = moment["history"]
323
             session["history"] = moment["history"]
324
+            session["user"] = moment.get("user", "odelia")
323
         except Exception as e:
325
         except Exception as e:
324
             flash(repr(e))
326
             flash(repr(e))
325
         return redirect(url_for("home")+"#/oldest")
327
         return redirect(url_for("home")+"#/oldest")

+ 3
- 3
static/css/style.css View File

108
 
108
 
109
 .iframe-container-16x9 iframe,
109
 .iframe-container-16x9 iframe,
110
 .iframe-container-4x3 iframe {
110
 .iframe-container-4x3 iframe {
111
-    margin: 0.5rem;
111
+    margin: 0;
112
     border-radius: 1rem;
112
     border-radius: 1rem;
113
     width: 98%;
113
     width: 98%;
114
     height:98%;
114
     height:98%;
116
 
116
 
117
 .iframe-container-16x9,
117
 .iframe-container-16x9,
118
 .iframe-container-4x3 {
118
 .iframe-container-4x3 {
119
-    background-image: url('../misc/wood-background.jpg');
120
-    background-size: cover;
119
+    /* background-image: url('../misc/wood-background.jpg'); */
120
+    /* background-size: cover; */
121
     margin: 0.5em auto;
121
     margin: 0.5em auto;
122
 }
122
 }
123
 
123
 

+ 6
- 6
templates/chat.html View File

20
 	<body>
20
 	<body>
21
                 <div id="custom-nav">
21
                 <div id="custom-nav">
22
                   <!-- the zero-width-space is a tweak against tidy removing empty tags -->
22
                   <!-- the zero-width-space is a tweak against tidy removing empty tags -->
23
-                  <a href="/reset/odelia" title="New session with Odelia"><img height="32" style="position:relative;top:4px;" src="static/users/odelia.png" /></a>
24
-                  <a href="/reset/brian" title="New session with Brian"><img height="32" style="position:relative;top:4px;" src="static/users/brian.png" /></a>
23
+                  <a href="/reset/odelia" title="New session with Odelia"><img height="32" style="position:relative;top:4px;{% if user == 'odelia' %}border:solid white 1px{% endif %}" src="static/users/odelia.png" /></a>
24
+                  <a href="/reset/brian" title="New session with Brian"><img height="32" style="position:relative;top:4px;{% if user == 'brian' %}border:solid white 1px{% endif %}" src="static/users/brian.png" /></a>
25
                   <a href="/save" title="Save"><i class="fa fa-file-download">​</i></a>
25
                   <a href="/save" title="Save"><i class="fa fa-file-download">​</i></a>
26
                   <a href="/load" title="Load"><i class="fa fa-file-upload">​</i></a>
26
                   <a href="/load" title="Load"><i class="fa fa-file-upload">​</i></a>
27
                 </div>
27
                 </div>
47
                                             {% if embed %}
47
                                             {% if embed %}
48
                                                 {% if embed.type == "youtube" %}
48
                                                 {% if embed.type == "youtube" %}
49
                                                     <div class="iframe-container-{{embed.proportions}}">
49
                                                     <div class="iframe-container-{{embed.proportions}}">
50
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
50
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
51
 						    </div>
51
 						    </div>
52
                                                 {% elif embed.type == "vimeo" %}
52
                                                 {% elif embed.type == "vimeo" %}
53
                                                     <div class="iframe-container-{{embed.proportions}}">
53
                                                     <div class="iframe-container-{{embed.proportions}}">
54
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
54
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
55
 						    </div>
55
 						    </div>
56
                                                 {% endif %}
56
                                                 {% endif %}
57
                                             {% endif %}
57
                                             {% endif %}
72
                                                 {% if moment.embed %}
72
                                                 {% if moment.embed %}
73
                                                     {% if moment.embed.type == "youtube" %}
73
                                                     {% if moment.embed.type == "youtube" %}
74
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
74
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
75
-                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}" allowfullscreen="allowfullscreen"></iframe>
75
+                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
76
 							</div>
76
 							</div>
77
                                                     {% elif moment.embed.type == "vimeo" %}
77
                                                     {% elif moment.embed.type == "vimeo" %}
78
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
78
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
79
-                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}" allowfullscreen="allowfullscreen"></iframe>
79
+                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
80
 							</div>
80
 							</div>
81
                                                     {% endif %}
81
                                                     {% endif %}
82
                                                 {% endif %}
82
                                                 {% endif %}

+ 2
- 2
templates/embeds.html View File

41
                                             <div class="scrollable">
41
                                             <div class="scrollable">
42
                                                 {% if embed.type == "youtube" %}
42
                                                 {% if embed.type == "youtube" %}
43
                                                     <div class="iframe-container-{{embed.proportions}}">
43
                                                     <div class="iframe-container-{{embed.proportions}}">
44
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
44
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
45
 						    </div>
45
 						    </div>
46
                                                 {% elif embed.type == "vimeo" %}
46
                                                 {% elif embed.type == "vimeo" %}
47
                                                     <div class="iframe-container-{{embed.proportions}}">
47
                                                     <div class="iframe-container-{{embed.proportions}}">
48
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
48
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
49
 						    </div>
49
 						    </div>
50
                                                 {% endif %}
50
                                                 {% endif %}
51
 					        <p>{{ embed.description }}</p>
51
 					        <p>{{ embed.description }}</p>

+ 2
- 2
templates/example.html View File

41
                                             {% if embed %}
41
                                             {% if embed %}
42
                                                 {% if embed.type == "youtube" %}
42
                                                 {% if embed.type == "youtube" %}
43
                                                     <div class="iframe-container-{{embed.proportions}}">
43
                                                     <div class="iframe-container-{{embed.proportions}}">
44
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
44
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
45
                                                     </div>
45
                                                     </div>
46
                                                 {% elif embed.type == "vimeo" %}
46
                                                 {% elif embed.type == "vimeo" %}
47
                                                     <div class="iframe-container-{{embed.proportions}}">
47
                                                     <div class="iframe-container-{{embed.proportions}}">
48
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}" allowfullscreen="allowfullscreen"></iframe>
48
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
49
                                                     </div>
49
                                                     </div>
50
                                                 {% endif %}
50
                                                 {% endif %}
51
                                             {% endif %}
51
                                             {% endif %}

+ 12
- 10
templates/prompt.txt View File

15
 
15
 
16
 It's important to focus the conversation by offering choices between specific topics to elaborate on (based on conversation history) rather than generalistic phrases like "is there anything else you'd like to discuss?"
16
 It's important to focus the conversation by offering choices between specific topics to elaborate on (based on conversation history) rather than generalistic phrases like "is there anything else you'd like to discuss?"
17
 
17
 
18
+Assistant should end  text with something that encourages interaction and guides the user to respond.
19
+
20
+    Examples:
21
+
22
+       * Which person would you like to dedicate this to and why?
23
+
24
+       * Describe what this makes you feel.
25
+
26
+       * What would you like to do next, guided meditation or watching an inspiring video?
27
+
18
 Assistatn's responses should be JSON that is valid according to the following json-schema:
28
 Assistatn's responses should be JSON that is valid according to the following json-schema:
19
 
29
 
20
 ```
30
 ```
31
 
41
 
32
 Unlike bg_video, any *video_content* value can only be used *ONCE* in a conversation. If assistant runs out of options (or doesn't find anything appropriate for the situation), setting the use_video_content to false is a good choice. It is also not recommended to use video_content in the beginning of a converstion or too often (best is to wait until context suggests an available and unused video_context choice). Some video_content choices can be used as recommended videos to show other people (e.g. family members) as part of coping with the separation from the user.
42
 Unlike bg_video, any *video_content* value can only be used *ONCE* in a conversation. If assistant runs out of options (or doesn't find anything appropriate for the situation), setting the use_video_content to false is a good choice. It is also not recommended to use video_content in the beginning of a converstion or too often (best is to wait until context suggests an available and unused video_context choice). Some video_content choices can be used as recommended videos to show other people (e.g. family members) as part of coping with the separation from the user.
33
 
43
 
34
-Assistant can also incorporate images inside the markdown field in the format ![alt](src) but src should be a valid option according to the following enum (the corresponding enum_titles value can be used as alt)
44
+Assistant can also incorporate images inside the markdown field in the format ![alt](src) but src should be a valid option according to the following enum (the corresponding enum_titles value can be used as alt).
35
 
45
 
36
 ```
46
 ```
37
 {{img_enum}}
47
 {{img_enum}}
51
 
61
 
52
 3. Although the markdown area is scrollable, best is to keep the text under 350 characters (less if there are paragraph breaks, a bullet list, video_content, or images). If you have more to say, just indicate it. The user can always ask you to continue by hitting enter. Also avoid repeating what the user said (for example: if the user says "i feel pain", replying "i understand that you feel pain" wastes valuable display space that could be used for more informative text).
62
 3. Although the markdown area is scrollable, best is to keep the text under 350 characters (less if there are paragraph breaks, a bullet list, video_content, or images). If you have more to say, just indicate it. The user can always ask you to continue by hitting enter. Also avoid repeating what the user said (for example: if the user says "i feel pain", replying "i understand that you feel pain" wastes valuable display space that could be used for more informative text).
53
 
63
 
54
-4. Always end the text with something that encourages interaction and guides the user to respond.
55
-
56
-    Examples:
57
-
58
-       * Which person would you like to dedicate this to and why?
59
-
60
-       * Describe what this makes you feel.
61
-
62
-       * What would you like to do next, guided meditation or watching an inspiring video?
64
+4. Unlike markdown images mentioned above, markdown *links* should *NEVER* be used. User should not navigate away from the chat. 

Loading…
Cancel
Save