Spaces:
Running
Running
Germano Cavalcante
commited on
Commit
•
27611ef
1
Parent(s):
da57b9b
Fix error in _data_ensure_size for Find Related
Browse files- routers/tool_find_related.py +12 -14
routers/tool_find_related.py
CHANGED
@@ -85,6 +85,7 @@ class _Data(dict):
|
|
85 |
titles_old = []
|
86 |
try:
|
87 |
arrays_size_old = self[repo]['arrays_size']
|
|
|
88 |
if size_new <= arrays_size_old:
|
89 |
return
|
90 |
except:
|
@@ -149,13 +150,10 @@ class _Data(dict):
|
|
149 |
|
150 |
def _embeddings_updated_get(self, repo):
|
151 |
with EMBEDDING_CTX.lock:
|
152 |
-
|
153 |
-
data_repo = self[repo]
|
154 |
-
except:
|
155 |
self._embeddings_generate(repo)
|
156 |
-
data_repo = self[repo]
|
157 |
|
158 |
-
date_old =
|
159 |
|
160 |
issues = gitea_fetch_issues(
|
161 |
'blender', repo, since=date_old, issue_attr_filter=issue_attr_filter)
|
@@ -165,9 +163,9 @@ class _Data(dict):
|
|
165 |
|
166 |
if date_new == date_old:
|
167 |
# Nothing changed
|
168 |
-
return
|
169 |
|
170 |
-
|
171 |
|
172 |
# autopep8: off
|
173 |
# Consider that if the time hasn't changed, it's the same issue.
|
@@ -181,15 +179,15 @@ class _Data(dict):
|
|
181 |
for i, issue in enumerate(issues):
|
182 |
number = int(issue['number'])
|
183 |
if issue['state'] == 'open':
|
184 |
-
|
185 |
if issue['state'] == 'closed':
|
186 |
-
|
187 |
|
188 |
-
title_old =
|
189 |
if title_old != issue['title']:
|
190 |
-
|
191 |
issues_to_embed.append(issue)
|
192 |
-
elif updated_at[i] >= date_old:
|
193 |
issues_to_embed.append(issue)
|
194 |
|
195 |
if issues_to_embed:
|
@@ -199,10 +197,10 @@ class _Data(dict):
|
|
199 |
|
200 |
for i, issue in enumerate(issues_to_embed):
|
201 |
number = int(issue['number'])
|
202 |
-
|
203 |
|
204 |
# autopep8: on
|
205 |
-
return
|
206 |
|
207 |
def _sort_similarity(self,
|
208 |
repo: str,
|
|
|
85 |
titles_old = []
|
86 |
try:
|
87 |
arrays_size_old = self[repo]['arrays_size']
|
88 |
+
titles_old = self[repo]['titles']
|
89 |
if size_new <= arrays_size_old:
|
90 |
return
|
91 |
except:
|
|
|
150 |
|
151 |
def _embeddings_updated_get(self, repo):
|
152 |
with EMBEDDING_CTX.lock:
|
153 |
+
if not repo in self:
|
|
|
|
|
154 |
self._embeddings_generate(repo)
|
|
|
155 |
|
156 |
+
date_old = self[repo]['updated_at']
|
157 |
|
158 |
issues = gitea_fetch_issues(
|
159 |
'blender', repo, since=date_old, issue_attr_filter=issue_attr_filter)
|
|
|
163 |
|
164 |
if date_new == date_old:
|
165 |
# Nothing changed
|
166 |
+
return self[repo]
|
167 |
|
168 |
+
self[repo]['updated_at'] = date_new
|
169 |
|
170 |
# autopep8: off
|
171 |
# Consider that if the time hasn't changed, it's the same issue.
|
|
|
179 |
for i, issue in enumerate(issues):
|
180 |
number = int(issue['number'])
|
181 |
if issue['state'] == 'open':
|
182 |
+
self[repo]['opened'][number] = True
|
183 |
if issue['state'] == 'closed':
|
184 |
+
self[repo]['closed'][number] = True
|
185 |
|
186 |
+
title_old = self[repo]['titles'][number]
|
187 |
if title_old != issue['title']:
|
188 |
+
self[repo]['titles'][number] = issue['title']
|
189 |
issues_to_embed.append(issue)
|
190 |
+
elif not updated_at[i] or updated_at[i] >= date_old:
|
191 |
issues_to_embed.append(issue)
|
192 |
|
193 |
if issues_to_embed:
|
|
|
197 |
|
198 |
for i, issue in enumerate(issues_to_embed):
|
199 |
number = int(issue['number'])
|
200 |
+
self[repo]['embeddings'][number] = embeddings[i]
|
201 |
|
202 |
# autopep8: on
|
203 |
+
return self[repo]
|
204 |
|
205 |
def _sort_similarity(self,
|
206 |
repo: str,
|