texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.85k stars 346 forks source link

AI Chat assistant config "Retrieve list of models" does not support custom OpenAI-compatible API URL #3807

Closed xxie-xd closed 2 months ago

xxie-xd commented 2 months ago

When setting In "Options"->"Configure TeXstudio"->"Language Checking" -> "AI chat assistant" -> "API URL" to a custom URL other than default value, press button "Retrieve list of model" can not get model lists from custom URL. By hacking the source code, https://github.com/texstudio-org/texstudio/blob/b16af3e676fc3677700db946f195060e2dcc61ce/src/configdialog.cpp#L738 The implementation of ConfigDialog::retrieveModels seems not handles request URL based on user defined API URL, but uses hard-coded address. This will cause inconsistency when API URL is set to an custom value like "http://192.168.1.2:11434/v1/chat/completions".

Environment

Expected behavior

The request URL should be build base on user configured API URL. "http://192.168.1.2:11434/v1/models"

Actual behavior

The request URL is hard-coded to "http://localhost:8080/v1/models"

How to reproduce

Any available API URL other than default will cause this error.