Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ class ResponseWrapper:
|
|
91 |
self._text = self._extract_text()
|
92 |
self._finish_reason = self._extract_finish_reason()
|
93 |
if self.finish_reason != "STOP":
|
94 |
-
raise BlockedPromptException(f"
|
95 |
self._prompt_token_count = self._extract_prompt_token_count()
|
96 |
self._candidates_token_count = self._extract_candidates_token_count()
|
97 |
self._total_token_count = self._extract_total_token_count()
|
@@ -105,7 +105,7 @@ class ResponseWrapper:
|
|
105 |
return part['text']
|
106 |
return None
|
107 |
except (KeyError, IndexError):
|
108 |
-
return None
|
109 |
|
110 |
def _extract_text(self) -> str:
|
111 |
try:
|
|
|
91 |
self._text = self._extract_text()
|
92 |
self._finish_reason = self._extract_finish_reason()
|
93 |
if self.finish_reason != "STOP":
|
94 |
+
raise BlockedPromptException(f"大概率是用户输入被安全系统阻止: {self.finish_reason}")
|
95 |
self._prompt_token_count = self._extract_prompt_token_count()
|
96 |
self._candidates_token_count = self._extract_candidates_token_count()
|
97 |
self._total_token_count = self._extract_total_token_count()
|
|
|
105 |
return part['text']
|
106 |
return None
|
107 |
except (KeyError, IndexError):
|
108 |
+
return None
|
109 |
|
110 |
def _extract_text(self) -> str:
|
111 |
try:
|