feat: add Atomic Chat as declarative OpenAI-compatible provider (#9210)
Co-authored-by: Yana Lyalyuk <yanalyalyuk@MacBook-Pro-Yana.local> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -879,6 +879,44 @@ mod tests {
|
||||
assert_eq!(result, "https://from-env.com/path");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_atomic_chat_json_deserializes() {
|
||||
let json = include_str!("../providers/declarative/atomic_chat.json");
|
||||
let config: DeclarativeProviderConfig =
|
||||
serde_json::from_str(json).expect("atomic_chat.json should parse");
|
||||
assert_eq!(config.name, "atomic_chat");
|
||||
assert_eq!(config.display_name, "Atomic Chat");
|
||||
assert_eq!(
|
||||
config.description.as_deref(),
|
||||
Some("Local models through Atomic Chat\u{2019}s OpenAI-compatible server")
|
||||
);
|
||||
assert!(matches!(config.engine, ProviderEngine::OpenAI));
|
||||
assert_eq!(config.api_key_env, "");
|
||||
assert!(!config.requires_auth);
|
||||
assert!(config.skip_canonical_filtering);
|
||||
assert_eq!(config.dynamic_models, Some(true));
|
||||
assert_eq!(config.supports_streaming, Some(true));
|
||||
assert_eq!(config.base_url, "${ATOMIC_CHAT_HOST}/v1/chat/completions");
|
||||
assert!(config.models.is_empty());
|
||||
assert!(config.model_doc_link.is_none());
|
||||
assert!(config.setup_steps.is_empty());
|
||||
|
||||
let env_vars = config.env_vars.as_ref().expect("env_vars should be set");
|
||||
assert_eq!(env_vars.len(), 1);
|
||||
assert_eq!(env_vars[0].name, "ATOMIC_CHAT_HOST");
|
||||
assert!(!env_vars[0].required);
|
||||
assert!(!env_vars[0].secret);
|
||||
assert_eq!(env_vars[0].primary, Some(true));
|
||||
assert_eq!(
|
||||
env_vars[0].default,
|
||||
Some("http://localhost:1337".to_string())
|
||||
);
|
||||
assert_eq!(
|
||||
env_vars[0].description.as_deref(),
|
||||
Some("Base URL of the Atomic Chat server (default: http://localhost:1337)")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_routstr_json_deserializes() {
|
||||
let json = include_str!("../providers/declarative/routstr.json");
|
||||
|
||||
@@ -703,6 +703,28 @@ const SETUP_METADATA: &[CuratedSetupMetadata] = &[
|
||||
default_value: None,
|
||||
}],
|
||||
},
|
||||
CuratedSetupMetadata {
|
||||
provider_id: "atomic_chat",
|
||||
category: ProviderSetupCategory::Model,
|
||||
setup_method: ProviderSetupMethod::ConfigFields,
|
||||
group: ProviderSetupGroup::Additional,
|
||||
display_name: None,
|
||||
description: None,
|
||||
docs_url: Some("https://github.com/AtomicBot-ai/Atomic-Chat?tab=readme-ov-file#readme"),
|
||||
aliases: &[],
|
||||
native_connect_query: None,
|
||||
binary_name: None,
|
||||
setup_capabilities: setup_capabilities(false, false, false),
|
||||
show_only_when_installed: false,
|
||||
synthetic: false,
|
||||
secret_field_default: None,
|
||||
field_overrides: &[CuratedFieldMetadata {
|
||||
key: "ATOMIC_CHAT_HOST",
|
||||
label: "Host URL",
|
||||
placeholder: Some("http://localhost:1337"),
|
||||
default_value: Some("http://localhost:1337"),
|
||||
}],
|
||||
},
|
||||
CuratedSetupMetadata {
|
||||
provider_id: "nvidia",
|
||||
category: ProviderSetupCategory::Model,
|
||||
@@ -1093,6 +1115,22 @@ mod tests {
|
||||
.collect::<Vec<_>>(),
|
||||
["DATABRICKS_HOST", "DATABRICKS_TOKEN"]
|
||||
);
|
||||
|
||||
let atomic_chat = entries
|
||||
.iter()
|
||||
.find(|entry| entry.provider_id == "atomic_chat")
|
||||
.expect("setup catalog should include atomic_chat declarative provider");
|
||||
assert_eq!(atomic_chat.setup_method, ProviderSetupMethod::ConfigFields);
|
||||
let host_field = atomic_chat
|
||||
.fields
|
||||
.iter()
|
||||
.find(|field| field.key == "ATOMIC_CHAT_HOST")
|
||||
.expect("atomic_chat should expose ATOMIC_CHAT_HOST");
|
||||
assert_eq!(host_field.label, "Host URL");
|
||||
assert_eq!(
|
||||
host_field.default_value.as_deref(),
|
||||
Some("http://localhost:1337")
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -1105,6 +1143,7 @@ mod tests {
|
||||
|
||||
assert!(provider_ids.contains("claude-acp"));
|
||||
assert!(provider_ids.contains("codex-acp"));
|
||||
assert!(provider_ids.contains("atomic_chat"));
|
||||
assert!(!provider_ids.contains("claude_code"));
|
||||
assert!(!provider_ids.contains("codex"));
|
||||
assert!(!provider_ids.contains("gemini_cli"));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "atomic_chat",
|
||||
"engine": "openai",
|
||||
"display_name": "Atomic Chat",
|
||||
"description": "Local models through Atomic Chat\u2019s OpenAI-compatible server",
|
||||
"api_key_env": "",
|
||||
"base_url": "${ATOMIC_CHAT_HOST}/v1/chat/completions",
|
||||
"env_vars": [
|
||||
{
|
||||
"name": "ATOMIC_CHAT_HOST",
|
||||
"required": false,
|
||||
"secret": false,
|
||||
"primary": true,
|
||||
"default": "http://localhost:1337",
|
||||
"description": "Base URL of the Atomic Chat server (default: http://localhost:1337)"
|
||||
}
|
||||
],
|
||||
"dynamic_models": true,
|
||||
"models": [],
|
||||
"supports_streaming": true,
|
||||
"requires_auth": false,
|
||||
"skip_canonical_filtering": true
|
||||
}
|
||||
Reference in New Issue
Block a user