Bläddra i källkod

Save user to moment file. Embed style edits

master
The Dod 8 månader sedan
förälder
incheckning
26d88994c5
6 ändrade filer med 27 tillägg och 23 borttagningar
  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 Visa fil

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

+ 3
- 3
static/css/style.css Visa fil

@@ -108,7 +108,7 @@
108 108
 
109 109
 .iframe-container-16x9 iframe,
110 110
 .iframe-container-4x3 iframe {
111
-    margin: 0.5rem;
111
+    margin: 0;
112 112
     border-radius: 1rem;
113 113
     width: 98%;
114 114
     height:98%;
@@ -116,8 +116,8 @@
116 116
 
117 117
 .iframe-container-16x9,
118 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 121
     margin: 0.5em auto;
122 122
 }
123 123
 

+ 6
- 6
templates/chat.html Visa fil

@@ -20,8 +20,8 @@
20 20
 	<body>
21 21
                 <div id="custom-nav">
22 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 25
                   <a href="/save" title="Save"><i class="fa fa-file-download">​</i></a>
26 26
                   <a href="/load" title="Load"><i class="fa fa-file-upload">​</i></a>
27 27
                 </div>
@@ -47,11 +47,11 @@
47 47
                                             {% if embed %}
48 48
                                                 {% if embed.type == "youtube" %}
49 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 51
 						    </div>
52 52
                                                 {% elif embed.type == "vimeo" %}
53 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 55
 						    </div>
56 56
                                                 {% endif %}
57 57
                                             {% endif %}
@@ -72,11 +72,11 @@
72 72
                                                 {% if moment.embed %}
73 73
                                                     {% if moment.embed.type == "youtube" %}
74 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 76
 							</div>
77 77
                                                     {% elif moment.embed.type == "vimeo" %}
78 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 80
 							</div>
81 81
                                                     {% endif %}
82 82
                                                 {% endif %}

+ 2
- 2
templates/embeds.html Visa fil

@@ -41,11 +41,11 @@
41 41
                                             <div class="scrollable">
42 42
                                                 {% if embed.type == "youtube" %}
43 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 45
 						    </div>
46 46
                                                 {% elif embed.type == "vimeo" %}
47 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 49
 						    </div>
50 50
                                                 {% endif %}
51 51
 					        <p>{{ embed.description }}</p>

+ 2
- 2
templates/example.html Visa fil

@@ -41,11 +41,11 @@
41 41
                                             {% if embed %}
42 42
                                                 {% if embed.type == "youtube" %}
43 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 45
                                                     </div>
46 46
                                                 {% elif embed.type == "vimeo" %}
47 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 49
                                                     </div>
50 50
                                                 {% endif %}
51 51
                                             {% endif %}

+ 12
- 10
templates/prompt.txt Visa fil

@@ -15,6 +15,16 @@ The goal of the chat is to conduct meaningful discussions on forgiveness, love,
15 15
 
16 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 28
 Assistatn's responses should be JSON that is valid according to the following json-schema:
19 29
 
20 30
 ```
@@ -31,7 +41,7 @@ Assistant should try to pick bg_video and [optionally] soundtrack or video_conte
31 41
 
32 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 47
 {{img_enum}}
@@ -51,12 +61,4 @@ IMPORTANT!
51 61
 
52 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. 

Laddar…
Avbryt
Spara