θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
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
7 changes: 5 additions & 2 deletions server/utils/AiProviders/lmStudio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {

// hybrid of openAi LLM chat completion for LMStudio
class LMStudioLLM {
constructor(embedder = null, _modelPreference = null) {
constructor(embedder = null, modelPreference = null) {
if (!process.env.LMSTUDIO_BASE_PATH)
throw new Error("No LMStudio API Base Path was set.");

Expand All @@ -21,7 +21,10 @@ class LMStudioLLM {
// and any other value will crash inferencing. So until this is patched we will
// try to fetch the `/models` and have the user set it, or just fallback to "Loaded from Chat UI"
// which will not impact users with <v0.2.17 and should work as well once the bug is fixed.
this.model = process.env.LMSTUDIO_MODEL_PREF || "Loaded from Chat UI";
this.model =
modelPreference ||
process.env.LMSTUDIO_MODEL_PREF ||
"Loaded from Chat UI";
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
Expand Down
2 changes: 1 addition & 1 deletion server/utils/agents/aibitat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ ${this.getHistory({ to: route.to })
case "anthropic":
return new Providers.AnthropicProvider({ model: config.model });
case "lmstudio":
return new Providers.LMStudioProvider({});
return new Providers.LMStudioProvider({ model: config.model });
case "ollama":
return new Providers.OllamaProvider({ model: config.model });
case "groq":
Expand Down
9 changes: 7 additions & 2 deletions server/utils/agents/aibitat/providers/lmstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ const UnTooled = require("./helpers/untooled.js");
class LMStudioProvider extends InheritMultiple([Provider, UnTooled]) {
model;

constructor(_config = {}) {
/**
*
* @param {{model?: string}} config
*/
constructor(config = {}) {
super();
const model = process.env.LMSTUDIO_MODEL_PREF || "Loaded from Chat UI";
const model =
config?.model || process.env.LMSTUDIO_MODEL_PREF || "Loaded from Chat UI";
const client = new OpenAI({
baseURL: process.env.LMSTUDIO_BASE_PATH?.replace(/\/+$/, ""), // here is the URL to your LMStudio instance
apiKey: null,
Expand Down