Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions enhanced/vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _extract_openai_compatible_text(response):
return ""
message = choices[0].get("message") if isinstance(choices[0], dict) else {}
content = message.get("content") if isinstance(message, dict) else ""
if isinstance(content, str):
if isinstance(content, str) and content.strip():
return content
if isinstance(content, list):
parts = []
Expand All @@ -262,7 +262,15 @@ def _extract_openai_compatible_text(response):
parts.append(str(item.get("text") or ""))
elif isinstance(item.get("content"), str):
parts.append(item.get("content"))
return "\n".join([part for part in parts if part])
text = "\n".join([part for part in parts if part])
if text.strip():
return text
reasoning = message.get("reasoning_content") if isinstance(message, dict) else ""
if isinstance(reasoning, str) and reasoning.strip() and reasoning.strip() != "None":
return reasoning
reasoning = message.get("reasoning") if isinstance(message, dict) else ""
if isinstance(reasoning, str) and reasoning.strip() and reasoning.strip() != "None":
return reasoning
return str(content or "")


Expand Down Expand Up @@ -756,6 +764,7 @@ def inference_custom(self, image, prompt, max_tokens=2048, temperature=0.7, top_
"top_p": float(top_p),
"max_tokens": int(max_tokens),
"stream": False,
"chat_template_kwargs": {"enable_thinking": False},
}
try:
seed_value = int(seed)
Expand Down
2 changes: 2 additions & 0 deletions javascript/describe_vlm_chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,8 @@
const version = cleanVlmVersion(raw);
const customPanel = componentHost('describe_vlm_custom_panel');
if (version === 'Custom' || isVisible(customPanel)) return 'Custom';
const customModel = String(readComponentValue('describe_vlm_custom_model') || '').trim();
if (customModel && version === customModel) return 'Custom';
return version;
}

Expand Down
2 changes: 1 addition & 1 deletion webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _main_vlm_save_admin_version(version, state, request=None):
def _main_vlm_save_selected_version(version, state, persist_admin=False, request=None):
version = _vlm_resolve_version(version)
_main_vlm_write_local_settings({"version": version})
if persist_admin and version != VLM.CUSTOM_VERSION:
if persist_admin:
_main_vlm_save_admin_version(version, state, request=request)
return version

Expand Down