camparchimedes commited on
Commit
18f4e61
ยท
verified ยท
1 Parent(s): 2bd73c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -17
app.py CHANGED
@@ -108,36 +108,62 @@ async def main(message):
108
 
109
  # --append source(s), specific rows only
110
  for doc, metadata in zip(docs, metadatas):
111
- row_index = metadata.get("row_index", -1)
112
- source = metadata.get("source", "")
113
-
114
- if row_index in [2, 8, 14] and source and source not in visited_sources:
115
- visited_sources.add(source)
116
- source_elements.append(
117
- cl.Text(content="https://www.daysoff.no" + source, name="Info_Url")
118
- )
119
- """
120
  if source_elements:
121
  answer += f"\nSources: {', '.join([e.content for e in source_elements])}"
 
 
122
 
123
  else:
124
- answer += "\nNo sources found"
 
 
 
 
 
125
 
126
- await cl.Message(content=answer, elements=source_elements).send()
127
- return
128
 
129
  """
130
  if source_elements:
131
  answer += f"\nSources: {', '.join([e.content for e in source_elements])}"
132
- await cl.Message(content=answer, elements=source_elements).send()
133
- return
134
 
135
  else:
136
  answer += "\nNo sources found"
137
- await cl.Message(content=answer).send()
138
- return
139
 
140
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  """
142
  for source in all_sources:
143
  if source in visited_sources:
 
108
 
109
  # --append source(s), specific rows only
110
  for doc, metadata in zip(docs, metadatas):
111
+ row_index = metadata.get("row_index", -1)
112
+ source = metadata.get("source", "")
113
+
114
+ if row_index in [2, 8, 14] and source and source not in visited_sources:
115
+ visited_sources.add(source)
116
+ source_elements.append(
117
+ cl.Text(content="https://www.daysoff.no" + source, name="Info_Url")
118
+ )
119
+
120
  if source_elements:
121
  answer += f"\nSources: {', '.join([e.content for e in source_elements])}"
122
+ await cl.Message(content=answer, elements=source_elements).send()
123
+ return
124
 
125
  else:
126
+ #answer = f"{answer}\nNo sources found"
127
+ await cl.Message(content=f"No sources found").send()
128
+
129
+ #await cl.Message(content=answer, elements=source_elements).send()
130
+
131
+
132
 
 
 
133
 
134
  """
135
  if source_elements:
136
  answer += f"\nSources: {', '.join([e.content for e in source_elements])}"
 
 
137
 
138
  else:
139
  answer += "\nNo sources found"
 
 
140
 
141
+ await cl.Message(content=answer, elements=source_elements).send()
142
+ return
143
+
144
+ """
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
  """
168
  for source in all_sources:
169
  if source in visited_sources: