Skip to content

Commit

Permalink
dont count sentiment towards matches
Browse files Browse the repository at this point in the history
  • Loading branch information
deadbits committed Oct 19, 2023
1 parent b34fa65 commit 05223b1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vigil/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ def perform_scan(self, input_prompt: str, input_resp: str = None) -> dict:
resp.status = 'partial_success'
resp.errors.append(f'Error in {scanner_name}: {results["error"]}')
else:
# update for each matching scanner, not the number of results
# within an each individual scanner
resp.results[scanner_name] = {'matches': results}
if len(results) > 0:
if len(results) > 0 and scanner_name != 'scanner:sentiment':
total_matches += 1

for scanner_name, message in messages.items():
Expand All @@ -89,8 +87,7 @@ def perform_scan(self, input_prompt: str, input_resp: str = None) -> dict:
resp.messages.append(message)

logger.info(f'{self.name} Total scanner matches: {total_matches}')
if self.auto_update and (total_matches == self.update_threshold or
total_matches > self.update_threshold):
if self.auto_update and (total_matches >= self.update_threshold):
logger.info(f'{self.name} (auto-update) Adding detected prompt to db id={resp.uuid}')
doc_id = self.db_client.add_texts(
[input_prompt],
Expand Down

0 comments on commit 05223b1

Please sign in to comment.