mirror of
https://github.com/SilasMarvin/lsp-ai.git
synced 2024-09-11 12:25:48 +03:00
seperate api endpoints configuration
This commit is contained in:
parent
f354834e9f
commit
3a351ff4a0
@ -94,8 +94,10 @@ const fn n_ctx_default() -> u32 {
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Ollama {
|
||||
// api endpoint
|
||||
pub api_endpoint: Option<String>,
|
||||
// The completions endpoint, default: 'http://localhost:11434'
|
||||
pub completions_endpoint: Option<String>,
|
||||
// The chat endpoint, default: 'http://localhost:11434'
|
||||
pub chat_endpoint: Option<String>,
|
||||
// The model name
|
||||
pub model: String,
|
||||
// The maximum requests per second
|
||||
|
@ -66,7 +66,7 @@ impl Ollama {
|
||||
params: OllamaRunParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let client = reqwest::Client::new();
|
||||
let api: &String = self.configuration.api_endpoint.as_ref().expect("http://localhost:11434");
|
||||
let api: &String = self.configuration.completions_endpoint.as_ref().expect("http://localhost:11434");
|
||||
let res: OllamaCompletionsResponse = client
|
||||
.post(format!("{}/api/generate",api))
|
||||
.header("Content-Type", "application/json")
|
||||
@ -101,7 +101,7 @@ impl Ollama {
|
||||
params: OllamaRunParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let client = reqwest::Client::new();
|
||||
let api: &String = self.configuration.api_endpoint.as_ref().expect("http://localhost:11434");
|
||||
let api: &String = self.configuration.chat_endpoint.as_ref().expect("http://localhost:11434");
|
||||
let res: OllamaChatResponse = client
|
||||
.post(format!("{}/api/chat",api))
|
||||
.header("Content-Type", "application/json")
|
||||
|
Loading…
Reference in New Issue
Block a user