Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b89162c76 | ||
|
|
14cffa86f2 | ||
|
|
9451f6a49f | ||
|
|
c46b8f98c1 | ||
|
|
f6ae000b71 | ||
|
|
a271bdacc8 | ||
|
|
643a055381 | ||
|
|
f71dff2fc9 | ||
|
|
b85d2cc638 | ||
|
|
ba74c2b0a5 | ||
|
|
22a1a46a4b | ||
|
|
51147a2440 | ||
|
|
8eacf951d4 | ||
|
|
89e81cf3f9 | ||
|
|
e8d31e58f4 | ||
|
|
568d6e7a5f | ||
|
|
bfea87cc93 | ||
|
|
4777078799 | ||
|
|
856609a43a |
@@ -44,7 +44,6 @@ _FILES_CHANGED = (
|
||||
"The LoRA metadata files changed during the scan; the previous imports "
|
||||
"were kept. Run the scan again."
|
||||
)
|
||||
_LORA_SCAN_FAILED = "The LoRA import failed. Check the server log for details."
|
||||
_IMPORTS_CHANGED = (
|
||||
"The imported LoRA prompts changed during the scan; the previous imports "
|
||||
"were kept. Run the scan again."
|
||||
@@ -408,21 +407,10 @@ class LoraIntegrationMixin:
|
||||
return
|
||||
if isinstance(error, PlanChanged):
|
||||
message = _IMPORTS_CHANGED
|
||||
elif isinstance(
|
||||
error,
|
||||
(
|
||||
LoraFilesChanged,
|
||||
LoraSettingsUnusable,
|
||||
EmptyReplacement,
|
||||
PairDependencyError,
|
||||
),
|
||||
):
|
||||
elif isinstance(error, (LoraFilesChanged, LoraSettingsUnusable)):
|
||||
message = str(error)
|
||||
elif isinstance(error, OSError):
|
||||
# Reduced to its reason and the file's basename.
|
||||
message = self._public_error(error)
|
||||
else:
|
||||
message = _LORA_SCAN_FAILED
|
||||
message = self._public_error(error)
|
||||
if isinstance(
|
||||
error,
|
||||
(
|
||||
|
||||
@@ -840,23 +840,6 @@ class TestLoraScanRoute(LoraAPITestCase):
|
||||
("error", error["message"], 0),
|
||||
)
|
||||
|
||||
async def test_unexpected_scan_error_is_generic_in_the_stream(self):
|
||||
self._enable()
|
||||
secret = str(self.tmp_root / "x.db")
|
||||
err = RuntimeError(f"could not open {secret}")
|
||||
with patch.object(self.api.db, "replace_category_prompts", side_effect=err):
|
||||
with self.assertLogs("prompt_manager.api", level="ERROR") as logs:
|
||||
resp = await self.client.request("POST", "/prompt_manager/lora/scan")
|
||||
body = await resp.text() # the stream ends inside the patch
|
||||
self.assertNotIn("x.db", body)
|
||||
error = self._sse_events(body)[-1]
|
||||
self.assertEqual(
|
||||
(error["type"], error["status"], error["progress"]),
|
||||
("error", error["message"], 0),
|
||||
)
|
||||
self.assertIn("server log", error["message"])
|
||||
self.assertIn(secret, "\n".join(logs.output))
|
||||
|
||||
@staticmethod
|
||||
def _sse_events(text):
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user