alexkueck commited on
Commit
abc13a1
1 Parent(s): 023c894

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -204,19 +204,21 @@ def clear_all(history, uploaded_file_paths, chats):
204
  # Erzeuge einen Bytestream
205
  memoryFile = io.BytesIO()
206
  # Erstelle eine Canvas-Instanz im Bytestream
207
- c = canvas.Canvas(memoryFile, pagesize=letter) #oder A4
208
  # Zeitstempel
209
  c.setFillColorRGB(0, 0, 0)
210
  c.setFont("Times-Bold", 14)
211
  c.drawCentredString(TIMESTAMP_X + COLUMN_WIDTH / 2, MARGIN, "Datum hier..." ) #chat_history["timestamp"])
212
  # User und Assistant
 
213
  for key, value in dic_history.items():
214
  c.setFont("Courier", 12)
215
- c.drawString(USER_X, MARGIN + LINE_SPACING, "Nutzer: " + key)
216
- c.setFont("Courier", 12)
217
- c.drawString(USER_X + COLUMN_WIDTH, MARGIN + LINE_SPACING, "Assistent: " + value)
218
  # Linie trennen
219
- c.line(TIMESTAMP_X, MARGIN + LINE_SPACING + ROW_HEIGHT, ASSISTANT_X + COLUMN_WIDTH, MARGIN + LINE_SPACING + ROW_HEIGHT)
 
220
 
221
  # Setze die Schriftart und -grösse
222
  #c.setFont("Helvetica", 12)
 
204
  # Erzeuge einen Bytestream
205
  memoryFile = io.BytesIO()
206
  # Erstelle eine Canvas-Instanz im Bytestream
207
+ c = canvas.Canvas(memoryFile, pagesize=A4) #oder letter
208
  # Zeitstempel
209
  c.setFillColorRGB(0, 0, 0)
210
  c.setFont("Times-Bold", 14)
211
  c.drawCentredString(TIMESTAMP_X + COLUMN_WIDTH / 2, MARGIN, "Datum hier..." ) #chat_history["timestamp"])
212
  # User und Assistant
213
+ i=1
214
  for key, value in dic_history.items():
215
  c.setFont("Courier", 12)
216
+ c.drawString(USER_X, MARGIN + i*LINE_SPACING, "Nutzer: " + key)
217
+ c.setFont("Helvetica", 12)
218
+ c.drawString(USER_X + COLUMN_WIDTH, MARGIN + (i+1)*LINE_SPACING, "Assistent: " + value)
219
  # Linie trennen
220
+ #c.line(TIMESTAMP_X, MARGIN + LINE_SPACING + ROW_HEIGHT, ASSISTANT_X + COLUMN_WIDTH, MARGIN + LINE_SPACING + ROW_HEIGHT)
221
+ i=i+2
222
 
223
  # Setze die Schriftart und -grösse
224
  #c.setFont("Helvetica", 12)