feat: cohere + more models
This commit is contained in:
@@ -88,6 +88,7 @@ impl Display for ShortcutAndMaybeReasoning {
|
||||
#[derive(Debug, Clone)]
|
||||
enum Provider {
|
||||
CloudflareWorkersAi,
|
||||
Cohere,
|
||||
GoogleAiStudio,
|
||||
Groq,
|
||||
HuggingFace,
|
||||
@@ -123,6 +124,7 @@ impl Shortcut {
|
||||
(P::OpenRouter, "poolside/laguna-xs-2.1:free".into()),
|
||||
(P::ZAi, "glm-4.7-flash".into()),
|
||||
(P::NvidiaNim, "google/diffusiongemma-26b-a4b-it".into()),
|
||||
(P::Cohere, "north-mini-code-1-0".into()),
|
||||
(P::OpenRouter, "cohere/north-mini-code:free".into()),
|
||||
(P::NvidiaNim, "nvidia/nemotron-3.5-lightning-30b-a3b".into()),
|
||||
(
|
||||
@@ -207,6 +209,7 @@ impl Shortcut {
|
||||
),
|
||||
(P::VercelAiGateway, "mistral/mistral-large-3".into()),
|
||||
(P::Ollama, "nemotron-3-super".into()),
|
||||
(P::Cohere, "command-a-plus-05-2026".into()),
|
||||
(P::NvidiaNim, "nvidia/nemotron-3-super-120b-a12b".into()),
|
||||
(P::Kilo, "nvidia-nemotron-3-super-120b-a12b-free".into()),
|
||||
(
|
||||
@@ -233,6 +236,7 @@ impl Shortcut {
|
||||
(P::NvidiaNim, "deepseek-ai/deepseek-v4.1-flash".into()),
|
||||
(P::HuggingFace, "deepseek-ai/DeepSeek-V4.1-Flash".into()),
|
||||
(P::OpenCode, "deepseek-v4.1-flash-free".into()),
|
||||
(P::OpenRouter, "minimax/minimax-m3.1-flash:free".into()),
|
||||
(P::VercelAiGateway, "inclusionai/ling-3.1-flash".into()),
|
||||
(P::HuggingFace, "inclusionAI/Ling-3.1-flash".into()),
|
||||
(P::Ollama, "beam".into()),
|
||||
@@ -395,6 +399,22 @@ pub async fn create_chat_completion(
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::Cohere => state
|
||||
.app_args
|
||||
.cohere_api_key
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|api_key| {
|
||||
Upstream::builder()
|
||||
.url(
|
||||
"https://api.cohere.com/compatibility/v1/chat/completions"
|
||||
.parse()
|
||||
.expect("TODO"),
|
||||
)
|
||||
.api_key(api_key)
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::Groq => state
|
||||
.app_args
|
||||
.groq_api_key
|
||||
|
||||
@@ -34,6 +34,18 @@ pub enum Shortcut {
|
||||
#[strum(serialize = "codestral-embed-2505")]
|
||||
CodestralEmbed2505,
|
||||
|
||||
#[strum(serialize = "cohere-embed-v4.0")]
|
||||
CohereEmbedV4_0,
|
||||
|
||||
#[strum(serialize = "cohere-embed-v5.0-fast")]
|
||||
CohereEmbedV5_0Fast,
|
||||
|
||||
#[strum(serialize = "cohere-embed-v5.0-pro")]
|
||||
CohereEmbedV5_0Pro,
|
||||
|
||||
#[strum(serialize = "gemini-embedding-2")]
|
||||
GeminiEmbedding2,
|
||||
|
||||
#[strum(serialize = "lfm2.5-embedding-350m")]
|
||||
Lfm2_5Embedding350M,
|
||||
|
||||
@@ -46,6 +58,8 @@ pub enum Shortcut {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
enum Provider {
|
||||
Cohere,
|
||||
GoogleAiStudio,
|
||||
Mistral,
|
||||
NvidiaNim,
|
||||
OpenRouter,
|
||||
@@ -58,6 +72,10 @@ impl Shortcut {
|
||||
|
||||
match self {
|
||||
S::CodestralEmbed2505 => vec![(P::Mistral, "codestral-embed-2505".into())],
|
||||
S::CohereEmbedV4_0 => vec![(P::Cohere, "embed-v4.0".into())],
|
||||
S::CohereEmbedV5_0Fast => vec![(P::Cohere, "embed-v5.0-fast".into())],
|
||||
S::CohereEmbedV5_0Pro => vec![(P::Cohere, "embed-v5.0-pro".into())],
|
||||
S::GeminiEmbedding2 => vec![(P::GoogleAiStudio, "gemini-embedding-2".into())],
|
||||
S::Lfm2_5Embedding350M => {
|
||||
vec![(P::OpenRouter, "liquid/lfm-2.5-embedding-350m:free".into())]
|
||||
}
|
||||
@@ -103,6 +121,22 @@ pub async fn create_embeddings(
|
||||
|
||||
for (provider, model) in shortcut.suggestions() {
|
||||
let upstreams: Vec<Upstream> = match provider {
|
||||
Provider::Cohere => state
|
||||
.app_args
|
||||
.cohere_api_key
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|api_key| {
|
||||
Upstream::builder()
|
||||
.url(
|
||||
"https://api.cohere.com/compatibility/v1/embeddings"
|
||||
.parse()
|
||||
.expect("TODO"),
|
||||
)
|
||||
.api_key(api_key)
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::Mistral => state
|
||||
.app_args
|
||||
.mistral_api_key
|
||||
@@ -119,6 +153,22 @@ pub async fn create_embeddings(
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::GoogleAiStudio => state
|
||||
.app_args
|
||||
.google_ai_studio_api_key
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|api_key| {
|
||||
Upstream::builder()
|
||||
.url(
|
||||
"https://generativelanguage.googleapis.com/v1beta/openai/embeddings"
|
||||
.parse()
|
||||
.expect("TODO"),
|
||||
)
|
||||
.api_key(api_key)
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::NvidiaNim => state
|
||||
.app_args
|
||||
.nvidia_nim_api_key
|
||||
|
||||
12
src/server/frontend/index.html
Normal file
12
src/server/frontend/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Basic Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello, world!</h1>
|
||||
<p>This is a basic HTML page.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user