Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff4a63aa7b |
@@ -233,10 +233,9 @@ def extract_responses_text(response: Any) -> str:
|
||||
text = getattr(entry, "text", None)
|
||||
if isinstance(text, str):
|
||||
parts.append(text)
|
||||
else:
|
||||
text = getattr(item, "text", None)
|
||||
if isinstance(text, str):
|
||||
parts.append(text)
|
||||
text = getattr(item, "text", None)
|
||||
if isinstance(text, str):
|
||||
parts.append(text)
|
||||
|
||||
if parts:
|
||||
return "\n".join(parts)
|
||||
|
||||
@@ -183,19 +183,6 @@ def test_extract_responses_text_variants() -> None:
|
||||
assert client.extract_responses_text(ns(output_text="", output=[])) == ""
|
||||
|
||||
|
||||
def test_extract_responses_text_no_duplicate_when_item_has_content_and_text() -> None:
|
||||
# An output item that has BOTH a content list and a top-level text attribute
|
||||
# should only yield text from the content list; the item-level text field
|
||||
# must NOT be appended a second time (regression guard for the duplicate-text bug).
|
||||
item_with_both = ns(content=[ns(text="the-answer")], text="the-answer")
|
||||
response = ns(output=[item_with_both])
|
||||
result = client.extract_responses_text(response)
|
||||
assert result == "the-answer", (
|
||||
f"Expected 'the-answer' but got {result!r} — "
|
||||
"item.text was appended even though content was already processed"
|
||||
)
|
||||
|
||||
|
||||
def test_dump_openai_response_branches() -> None:
|
||||
class WithModelDump:
|
||||
def model_dump(self):
|
||||
|
||||
+15
-2
@@ -190,6 +190,19 @@ function notifySuccess(message) {
|
||||
}
|
||||
}
|
||||
|
||||
function notifyError(message) {
|
||||
if (typeof app.extensionManager?.toast?.add === "function") {
|
||||
app.extensionManager.toast.add({
|
||||
severity: "error",
|
||||
summary: "LMStudio",
|
||||
detail: message,
|
||||
life: 5000,
|
||||
});
|
||||
} else {
|
||||
console.error(`[LMStudio] ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function fitNodeToWidgets(node) {
|
||||
if (typeof node.computeSize !== "function" || typeof node.setSize !== "function") {
|
||||
return;
|
||||
@@ -292,7 +305,7 @@ function attachButtons(node) {
|
||||
} catch (error) {
|
||||
const message = error?.message || String(error);
|
||||
console.error("[LMStudio] Model refresh failed", error);
|
||||
window.alert(`Model refresh failed: ${message}`);
|
||||
notifyError(`Model refresh failed: ${message}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -302,7 +315,7 @@ function attachButtons(node) {
|
||||
} catch (error) {
|
||||
const message = error?.message || String(error);
|
||||
console.error("[LMStudio] Connectivity test failed", error);
|
||||
window.alert(`Connectivity test failed: ${message}`);
|
||||
notifyError(`Connectivity test failed: ${message}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user