FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
v4 update
tilakpatel22a3b9c601795b
diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.ymlindex 42c75d0ad..618aa1adb 100644--- a/.github/workflows/build-cpp.yml+++ b/.github/workflows/build-cpp.yml@@ -78,6 +78,7 @@ jobs:with:key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ env.QT_VERSION }}max-size: 500M+ update-package-index: true# ---- System dependencies (Linux) ----- name: Install system dependencies (Linux)@@ -152,10 +153,17 @@ jobs:run: |# jurplel/install-qt-action with dir set installs into <dir>/Qt/<version>/<arch>HOST_QT="${{ runner.temp }}/qt-host/Qt/${{ env.QT_VERSION }}/msvc2022_64"+ # clang-cl ships with VS 2022 and is required by whisper.cpp's GGML CPU backend+ # for ARM64 — pure MSVC cl.exe is rejected by ggml-cpu/CMakeLists.txt.+ # Using clang-cl gives full ARM NEON acceleration while keeping the MSVC ABI+ # so Qt ARM64 libs link correctly.+ CLANG_CL=$(find "/c/Program Files/Microsoft Visual Studio/2022" -name "clang-cl.exe" 2>/dev/null | head -1)cmake -B build \-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \-DCMAKE_PREFIX_PATH="${QT_ROOT_DIR}" \-DQT_HOST_PATH="${HOST_QT}" \+ -DCMAKE_C_COMPILER="${CLANG_CL}" \+ -DCMAKE_CXX_COMPILER="${CLANG_CL}" \${{ matrix.cmake_extra }}# ---- Build ----diff --git a/fincept-qt/src/screens/setup/SetupScreen.cpp b/fincept-qt/src/screens/setup/SetupScreen.cppindex 3db047b05..3945a655c 100644--- a/fincept-qt/src/screens/setup/SetupScreen.cpp+++ b/fincept-qt/src/screens/setup/SetupScreen.cpp@@ -3,6 +3,7 @@#include "core/logging/Logger.h"#include "python/PythonSetupManager.h"+#include "services/stt/WhisperService.h"#include "ui/theme/Theme.h"#include <QHBoxLayout>@@ -27,11 +28,18 @@ SetupScreen::SetupScreen(QWidget* parent) : QWidget(parent) {build_ui();prefill_completed_steps();- connect(&python::PythonSetupManager::instance(), &python::PythonSetupManager::progress_changed, this,- &SetupScreen::on_progress);-- connect(&python::PythonSetupManager::instance(), &python::PythonSetupManager::setup_complete, this,- &SetupScreen::on_setup_done);+ connect(&python::PythonSetupManager::instance(), &python::PythonSetupManager::progress_changed,+ this, &SetupScreen::on_progress);+ connect(&python::PythonSetupManager::instance(), &python::PythonSetupManager::setup_complete,+ this, &SetupScreen::on_setup_done);++ auto& ws = services::WhisperService::instance();+ connect(&ws, &services::WhisperService::model_download_progress,+ this, &SetupScreen::on_whisper_progress);+ connect(&ws, &services::WhisperService::model_ready,+ this, &SetupScreen::on_whisper_ready);+ connect(&ws, &services::WhisperService::error_occurred,+ this, &SetupScreen::on_whisper_error);}// ─────────────────────────────────────────────────────────────────────────────@@ -75,6 +83,7 @@ void SetupScreen::build_ui() {cl->addWidget(build_step_row("Virtual Environments", "venv"));cl->addWidget(build_step_row("NumPy 1.x Packages", "packages-numpy1"));cl->addWidget(build_step_row("NumPy 2.x Packages", "packages-numpy2"));+ cl->addWidget(build_step_row("Whisper Voice Model", "whisper"));cl->addSpacing(20);@@ -209,15 +218,14 @@ void SetupScreen::on_progress(const python::SetupProgress& progress) {void SetupScreen::on_setup_done(bool success, const QString& error) {if (success) {- status_label_->setText("Setup complete! Starting Fincept Terminal...");- status_label_->setStyleSheet(QString("color:%1; font-family:%2; font-size:10px; margin-top:8px;")- .arg(colors::GREEN, fonts::DATA_FAMILY));- begin_btn_->setText("SETUP COMPLETE");-- LOG_INFO("SetupScreen", "Setup completed successfully");+ LOG_INFO("SetupScreen", "Python setup completed — starting Whisper model download");+ status_label_->setText("Downloading Whisper voice model...");+ status_label_->setStyleSheet(+ QString("color:%1; font-family:%2; font-size:10px; margin-top:8px;").arg(kAccent, fonts::DATA_FAMILY));- // Emit signal after a short delay so user sees the success message- QTimer::singleShot(1500, this, [this]() { emit setup_complete(); });+ // Kick off whisper model download as the final setup step.+ // on_whisper_ready() will emit setup_complete() when done.+ services::WhisperService::instance().download_for_setup();} else {begin_btn_->setEnabled(true);begin_btn_->setText("RETRY SETUP");@@ -229,6 +237,45 @@ void SetupScreen::on_setup_done(bool success, const QString& error) {}}+void SetupScreen::on_whisper_progress(int percent) {+ if (!steps_.contains("whisper")) return;+ auto& ui = steps_["whisper"];+ ui.bar->setValue(percent);+ if (percent < 100) {+ ui.status->setText(QString("%1%").arg(percent));+ ui.status->setStyleSheet(+ QString("color:%1; font-family:%2; font-size:9px;").arg(kAccent, fonts::DATA_FAMILY));+ }+ status_label_->setText(QString("Downloading Whisper voice model... %1%").arg(percent));+}++void SetupScreen::on_whisper_ready() {+ mark_step_done("whisper");+ status_label_->setText("All components installed! Starting Fincept Terminal...");+ status_label_->setStyleSheet(QString("color:%1; font-family:%2; font-size:10px; margin-top:8px;")+ .arg(colors::GREEN, fonts::DATA_FAMILY));+ begin_btn_->setText("SETUP COMPLETE");++ LOG_INFO("SetupScreen", "Whisper model ready — setup fully complete");+ QTimer::singleShot(1500, this, [this]() { emit setup_complete(); });+}++void SetupScreen::on_whisper_error(const QString& message) {+ if (steps_.contains("whisper")) {+ auto& ui = steps_["whisper"];+ ui.status->setText("FAILED");+ ui.status->setStyleSheet(+ QString("color:%1; font-family:%2; font-size:9px;").arg(colors::RED, fonts::DATA_FAMILY));+ }+ // Non-fatal — voice commands won't work but app can still launch.+ LOG_WARN("SetupScreen", "Whisper model download failed: " + message);+ status_label_->setText("Voice model download failed — voice commands unavailable. Continuing...");+ status_label_->setStyleSheet(+ QString("color:%1; font-family:%2; font-size:10px; margin-top:8px;").arg(colors::TEXT_TERTIARY, fonts::DATA_FAMILY));+ begin_btn_->setText("SETUP COMPLETE");+ QTimer::singleShot(2500, this, [this]() { emit setup_complete(); });+}+void SetupScreen::mark_step_done(const QString& key) {if (!steps_.contains(key)) return;auto& ui = steps_[key];@@ -239,7 +286,8 @@ void SetupScreen::mark_step_done(const QString& key) {}void SetupScreen::prefill_completed_steps() {- const auto status = python::PythonSetupManager::instance().check_status();+ const auto status = python::PythonSetupManager::instance().check_status();+ const bool whisper = services::WhisperService::is_model_downloaded();// Pre-fill completed steps as green DONEif (status.uv_installed) mark_step_done("uv");@@ -247,11 +295,14 @@ void SetupScreen::prefill_completed_steps() {if (status.venv_numpy1_ready && status.venv_numpy2_ready) mark_step_done("venv");if (status.venv_numpy1_ready) mark_step_done("packages-numpy1");if (status.venv_numpy2_ready) mark_step_done("packages-numpy2");+ if (whisper) mark_step_done("whisper");const bool any_done = status.uv_installed || status.python_installed- || status.venv_numpy1_ready || status.venv_numpy2_ready;+ || status.venv_numpy1_ready || status.venv_numpy2_ready+ || whisper;const bool all_done = status.uv_installed && status.python_installed- && status.venv_numpy1_ready && status.venv_numpy2_ready;+ && status.venv_numpy1_ready && status.venv_numpy2_ready+ && whisper;summary_lbl_->setText({});diff --git a/fincept-qt/src/screens/setup/SetupScreen.h b/fincept-qt/src/screens/setup/SetupScreen.hindex eaa71dfb4..6d4d4d9f5 100644--- a/fincept-qt/src/screens/setup/SetupScreen.h+++ b/fincept-qt/src/screens/setup/SetupScreen.h@@ -27,6 +27,9 @@ class SetupScreen : public QWidget {void on_begin_setup();void on_progress(const fincept::python::SetupProgress& progress);void on_setup_done(bool success, const QString& error);+ void on_whisper_progress(int percent);+ void on_whisper_ready();+ void on_whisper_error(const QString& message);private:void build_ui();diff --git a/fincept-qt/src/services/stt/WhisperService.cpp b/fincept-qt/src/services/stt/WhisperService.cppindex 10b11c6cf..97b74f382 100644--- a/fincept-qt/src/services/stt/WhisperService.cpp+++ b/fincept-qt/src/services/stt/WhisperService.cpp@@ -10,6 +10,7 @@#include "services/stt/WhisperService.h"#include "core/logging/Logger.h"+#include "python/PythonSetupManager.h"// whisper.cpp public C API#include "whisper.h"@@ -24,7 +25,6 @@#include <QNetworkRequest>#include <QPointer>#include <QSaveFile>-#include <QStandardPaths>#include <QtConcurrent/QtConcurrent>#include <algorithm>@@ -90,11 +90,28 @@ bool WhisperService::is_model_ready() const noexcept {}QString WhisperService::model_path() const {- const QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)+ // Co-locate with all other Fincept data under com.fincept.terminal/models/+ // to keep the install footprint in one place.+ const QString dir = python::PythonSetupManager::instance().install_dir()+ QStringLiteral("/models");return dir + u'/' + kModelFilename;}+// static+bool WhisperService::is_model_downloaded() {+ return QFile::exists(instance().model_path());+}++void WhisperService::download_for_setup() {+ if (is_model_downloaded()) {+ // Already present — just report 100% so the setup step goes green.+ emit model_download_progress(100);+ emit model_ready();+ return;+ }+ download_model();+}+// ── Model management ──────────────────────────────────────────────────────────void WhisperService::ensure_model() {@@ -116,7 +133,7 @@ void WhisperService::ensure_model() {}void WhisperService::download_model() {- const QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)+ const QString dir = python::PythonSetupManager::instance().install_dir()+ QStringLiteral("/models");QDir().mkpath(dir);diff --git a/fincept-qt/src/services/stt/WhisperService.h b/fincept-qt/src/services/stt/WhisperService.hindex bffa24777..b16627667 100644--- a/fincept-qt/src/services/stt/WhisperService.h+++ b/fincept-qt/src/services/stt/WhisperService.h@@ -9,10 +9,11 @@// Complies with P1 (never block UI thread), P6 (service layer), P8 (QPointer guards).//// Model lifecycle:-// 1. On first start_listening(), check AppDataLocation for ggml-base.en-q5_0.bin-// 2. If missing, download from HuggingFace — emit model_download_progress(int %)-// 3. On download complete, emit model_ready() and begin capture-// 4. On all subsequent calls the model is already loaded — zero overhead+// 1. SetupScreen calls download_for_setup() during first-run setup.+// Progress is reported via model_download_progress(int %).+// Model is stored at: com.fincept.terminal/models/ggml-base.en-q5_0.bin+// 2. On first start_listening(), model is already present — loads immediately.+// 3. If model is somehow absent (manual delete), it auto-downloads on mic press.#include <QAudioFormat>#include <QAudioSource>@@ -67,10 +68,19 @@ class WhisperService : public QObject {/// discarded — its result will not be emitted.void stop_listening();- [[nodiscard]] bool is_listening() const noexcept;- [[nodiscard]] bool is_model_ready() const noexcept;+ [[nodiscard]] bool is_listening() const noexcept;+ [[nodiscard]] bool is_model_ready() const noexcept;++ /// True if the model file exists on disk (downloaded during setup or previously).+ [[nodiscard]] static bool is_model_downloaded();++ /// Called by SetupScreen during first-run setup to pre-download the model.+ /// Emits model_download_progress(0-100) and model_ready() on completion,+ /// or error_occurred() on failure. No-op if model is already present.+ void download_for_setup();/// Absolute path to the model file (may not exist yet).+ /// Located at: com.fincept.terminal/models/ggml-base.en-q5_0.bin[[nodiscard]] QString model_path() const;signals:diff --git a/fincept-qt/tests/test_minimax_integration.py b/fincept-qt/tests/test_minimax_integration.pydeleted file mode 100644index 74053439e..000000000--- a/fincept-qt/tests/test_minimax_integration.py+++ /dev/null@@ -1,113 +0,0 @@-#!/usr/bin/env python3-"""-Integration tests for MiniMax LLM provider in Fincept Terminal.--These tests verify the MiniMax API endpoint connectivity and response format-using the real MiniMax API. Requires MINIMAX_API_KEY environment variable.-"""--import json-import os-import sys-import unittest--import urllib.request-import urllib.error---MINIMAX_API_KEY = os.environ.get("MINIMAX_API_KEY", "")-MINIMAX_BASE_URL = "https://api.minimax.io/v1"---def skip_without_api_key(func):- """Skip test if MINIMAX_API_KEY is not set."""- return unittest.skipIf(- not MINIMAX_API_KEY,- "MINIMAX_API_KEY not set — skipping integration test"- )(func)---class TestMiniMaxApiConnectivity(unittest.TestCase):- """Verify MiniMax API endpoints are reachable and respond correctly."""-- @skip_without_api_key- def test_models_endpoint_returns_404(self):- """MiniMax does not have a public /v1/models endpoint.- The Fincept Terminal uses fallback_models() instead."""- req = urllib.request.Request(- f"{MINIMAX_BASE_URL}/models",- headers={- "Authorization": f"Bearer {MINIMAX_API_KEY}",- "Content-Type": "application/json",- },- )- with self.assertRaises(urllib.error.HTTPError) as ctx:- urllib.request.urlopen(req, timeout=15)- self.assertEqual(ctx.exception.code, 404,- "MiniMax /v1/models should return 404 — no public endpoint")-- @skip_without_api_key- def test_chat_completions_basic(self):- """POST /v1/chat/completions with MiniMax-M2.7 should return valid response."""- payload = json.dumps({- "model": "MiniMax-M2.7",- "messages": [- {"role": "user", "content": "Say 'hello' and nothing else."}- ],- "temperature": 0.5,- "max_tokens": 32,- }).encode()-- req = urllib.request.Request(- f"{MINIMAX_BASE_URL}/chat/completions",- data=payload,- headers={- "Authorization": f"Bearer {MINIMAX_API_KEY}",- "Content-Type": "application/json",- },- method="POST",- )- try:- with urllib.request.urlopen(req, timeout=30) as resp:- self.assertEqual(resp.status, 200)- data = json.loads(resp.read().decode())- self.assertIn("choices", data,- "Response must contain 'choices' (OpenAI format)")- self.assertGreater(len(data["choices"]), 0)- content = data["choices"][0]["message"]["content"]- self.assertIsInstance(content, str)- self.assertGreater(len(content), 0,- "Response content should not be empty")- except urllib.error.HTTPError as e:- self.fail(f"Chat completions returned HTTP {e.code}: {e.read().decode()[:200]}")-- @skip_without_api_key- def test_temperature_clamping_boundary(self):- """MiniMax API should accept temperature at the boundary value 1.0."""- payload = json.dumps({- "model": "MiniMax-M2.7",- "messages": [- {"role": "user", "content": "Hi"}- ],- "temperature": 1.0,- "max_tokens": 8,- }).encode()-- req = urllib.request.Request(- f"{MINIMAX_BASE_URL}/chat/completions",- data=payload,- headers={- "Authorization": f"Bearer {MINIMAX_API_KEY}",- "Content-Type": "application/json",- },- method="POST",- )- try:- with urllib.request.urlopen(req, timeout=30) as resp:- self.assertEqual(resp.status, 200)- except urllib.error.HTTPError as e:- self.fail(f"Temperature 1.0 should be accepted, got HTTP {e.code}")---if __name__ == "__main__":- unittest.main(verbosity=2)diff --git a/fincept-qt/tests/test_minimax_provider.py b/fincept-qt/tests/test_minimax_provider.pydeleted file mode 100644index 51de402f5..000000000--- a/fincept-qt/tests/test_minimax_provider.py+++ /dev/null@@ -1,305 +0,0 @@-#!/usr/bin/env python3-"""-Unit tests for MiniMax LLM provider integration in Fincept Terminal.--Validates that all MiniMax provider integration points are correctly wired-in the C++ source code by parsing and inspecting the source files.-"""--import os-import re-import sys-import unittest--# Paths relative to repository root-REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))-SRC_DIR = os.path.join(REPO_ROOT, "src")-LLM_CONFIG_SECTION = os.path.join(SRC_DIR, "screens", "settings", "LlmConfigSection.cpp")-LLM_SERVICE_H = os.path.join(SRC_DIR, "ai_chat", "LlmService.h")-LLM_SERVICE_CPP = os.path.join(SRC_DIR, "ai_chat", "LlmService.cpp")-README_PATH = os.path.join(os.path.dirname(REPO_ROOT), "README.md")---def read_file(path: str) -> str:- with open(path, "r", encoding="utf-8") as f:- return f.read()---class TestMiniMaxKnownProviders(unittest.TestCase):- """Verify MiniMax appears in the KNOWN_PROVIDERS list."""-- def setUp(self):- self.source = read_file(LLM_CONFIG_SECTION)-- def test_minimax_in_known_providers(self):- match = re.search(- r'KNOWN_PROVIDERS\s*=\s*\{([^}]+)\}', self.source- )- self.assertIsNotNone(match, "KNOWN_PROVIDERS definition not found")- providers_str = match.group(1)- self.assertIn('"minimax"', providers_str,- "minimax must be in KNOWN_PROVIDERS list")-- def test_known_providers_order(self):- """MiniMax should appear between openrouter and ollama."""- match = re.search(- r'KNOWN_PROVIDERS\s*=\s*\{([^}]+)\}', self.source- )- self.assertIsNotNone(match)- providers = re.findall(r'"(\w+)"', match.group(1))- self.assertIn("minimax", providers)- minimax_idx = providers.index("minimax")- self.assertIn("openrouter", providers)- openrouter_idx = providers.index("openrouter")- self.assertGreater(minimax_idx, openrouter_idx,- "minimax should come after openrouter")-- def test_provider_count(self):- """Should have 9 known providers after adding minimax."""- match = re.search(- r'KNOWN_PROVIDERS\s*=\s*\{([^}]+)\}', self.source- )- self.assertIsNotNone(match)- providers = re.findall(r'"(\w+)"', match.group(1))- self.assertEqual(len(providers), 9,- f"Expected 9 providers, got {len(providers)}: {providers}")---class TestMiniMaxBaseUrl(unittest.TestCase):- """Verify default_base_url returns the correct MiniMax URL."""-- def setUp(self):- self.source = read_file(LLM_CONFIG_SECTION)-- def test_minimax_base_url_entry(self):- self.assertIn('p == "minimax"', self.source,- "default_base_url() must handle minimax provider")-- def test_minimax_base_url_value(self):- # Find the minimax base URL assignment- pattern = r'if\s*\(p\s*==\s*"minimax"\)\s*\n\s*return\s*"([^"]+)"'- match = re.search(pattern, self.source)- self.assertIsNotNone(match, "MiniMax base URL return not found")- self.assertEqual(match.group(1), "https://api.minimax.io/v1",- "MiniMax base URL must be https://api.minimax.io/v1")---class TestMiniMaxFallbackModels(unittest.TestCase):- """Verify fallback_models returns correct MiniMax models."""-- def setUp(self):- self.source = read_file(LLM_CONFIG_SECTION)-- def test_minimax_fallback_models_exist(self):- # Find the minimax models section- pattern = r'if\s*\(p\s*==\s*"minimax"\)\s*\n\s*return\s*\{([^}]+)\}'- match = re.search(pattern, self.source)- self.assertIsNotNone(match, "MiniMax fallback models not found")- models_str = match.group(1)-- expected_models = [- "MiniMax-M2.7",- "MiniMax-M2.7-highspeed",- "MiniMax-M2.5",- "MiniMax-M2.5-highspeed",- ]- for model in expected_models:- self.assertIn(f'"{model}"', models_str,- f"Model {model} must be in MiniMax fallback models")-- def test_minimax_model_count(self):- pattern = r'if\s*\(p\s*==\s*"minimax"\)\s*\n\s*return\s*\{([^}]+)\}'- match = re.search(pattern, self.source)- self.assertIsNotNone(match)- models = re.findall(r'"([^"]+)"', match.group(1))- self.assertEqual(len(models), 4,- f"Expected 4 MiniMax models, got {len(models)}: {models}")---class TestMiniMaxStreamingSupport(unittest.TestCase):- """Verify MiniMax is listed as supporting streaming."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_H)-- def test_minimax_in_streaming_providers(self):- match = re.search(- r'provider_supports_streaming\([^)]+\)\s*\{[^}]+\}',- self.source, re.DOTALL- )- self.assertIsNotNone(match,- "provider_supports_streaming() not found")- self.assertIn('"minimax"', match.group(0),- "minimax must be in provider_supports_streaming()")---class TestMiniMaxEndpointUrl(unittest.TestCase):- """Verify get_endpoint_url handles MiniMax correctly."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_minimax_endpoint_url(self):- pattern = r'if\s*\(p\s*==\s*"minimax"\)\s*\n\s*return\s*"([^"]+)"'- # Look in the get_endpoint_url section- endpoint_section = self.source[- self.source.index("get_endpoint_url"):- self.source.index("get_headers")- ]- match = re.search(pattern, endpoint_section)- self.assertIsNotNone(match, "MiniMax endpoint URL not found in get_endpoint_url()")- self.assertEqual(match.group(1),- "https://api.minimax.io/v1/chat/completions",- "MiniMax endpoint must be https://api.minimax.io/v1/chat/completions")---class TestMiniMaxModelsUrl(unittest.TestCase):- """Verify get_models_url does NOT return a URL for MiniMax- (no public /v1/models endpoint — fallback models are used)."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_minimax_no_models_url(self):- """MiniMax should not have a models URL in get_models_url()- because the API has no public /v1/models endpoint."""- models_section = self.source[- self.source.index("get_models_url"):- self.source.index("get_models_headers")- ]- # Should NOT have a minimax-specific models URL- self.assertNotIn('p == "minimax"', models_section,- "MiniMax should not have a models URL entry — "- "no public /v1/models endpoint")-- def test_minimax_comment_in_get_models_url(self):- """A comment should explain why minimax has no models URL."""- models_section = self.source[- self.source.index("get_models_url"):- self.source.index("get_models_headers")- ]- self.assertIn("minimax", models_section.lower(),- "Comment about minimax should exist in get_models_url()")---class TestMiniMaxTemperatureClamping(unittest.TestCase):- """Verify MiniMax temperature is clamped to (0.0, 1.0]."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_temperature_clamping_exists(self):- # Check that there's a minimax-specific temperature clamp in build_openai_request- self.assertIn('provider_ == "minimax"', self.source,- "Temperature clamping for minimax must exist")-- def test_temperature_clamp_range(self):- # Verify the clamp range: std::max(0.01, std::min(temperature_, 1.0))- clamp_section = self.source[- self.source.index("build_openai_request"):- self.source.index("build_anthropic_request")- ]- self.assertIn("0.01", clamp_section,- "Lower bound of temperature clamp should be 0.01")- self.assertIn("1.0", clamp_section,- "Upper bound of temperature clamp should be 1.0")---class TestMiniMaxAuthHeaders(unittest.TestCase):- """Verify MiniMax uses OpenAI-compatible Bearer auth headers."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_minimax_uses_bearer_auth(self):- """MiniMax should fall through to OpenAI-compatible Bearer auth- (no special handling needed — it uses the else branch)."""- headers_section = self.source[- self.source.index("get_headers"):- self.source.index("Request builders")- ]- # MiniMax should NOT have its own special header handling- self.assertNotIn('p == "minimax"', headers_section,- "MiniMax should use default OpenAI-compatible Bearer auth, "- "not have its own header block")---class TestMiniMaxApiKeyRequired(unittest.TestCase):- """Verify MiniMax requires an API key."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_H)-- def test_minimax_requires_api_key(self):- """provider_requires_api_key should return true for minimax- (it only excludes ollama and fincept)."""- match = re.search(- r'provider_requires_api_key\([^)]+\)\s*\{[^}]+\}',- self.source, re.DOTALL- )- self.assertIsNotNone(match)- func_body = match.group(0)- # minimax should NOT be excluded- self.assertNotIn('"minimax"', func_body,- "MiniMax should require API key (not excluded)")---class TestMiniMaxOpenAICompatible(unittest.TestCase):- """Verify MiniMax uses the OpenAI-compatible request path in do_request."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_minimax_not_special_cased_in_do_request(self):- """MiniMax should fall through to the OpenAI-compatible else branch- in do_request() — no special provider_ == 'minimax' check needed."""- do_request_section = self.source[- self.source.index("LlmResponse LlmService::do_request"):- self.source.index("Tool-call follow-up loop")- ]- # MiniMax should NOT have its own special response parsing- self.assertNotIn('provider_ == "minimax"', do_request_section,- "MiniMax should use OpenAI-compatible response parsing, "- "not have its own block in do_request()")---class TestMiniMaxReadme(unittest.TestCase):- """Verify MiniMax is mentioned in the README."""-- def setUp(self):- self.source = read_file(README_PATH)-- def test_minimax_in_readme(self):- self.assertIn("MiniMax", self.source,- "MiniMax must be mentioned in README.md")-- def test_minimax_in_provider_list(self):- """MiniMax should appear in the AI Agents feature row."""- # Find the line that contains AI Agents- lines = self.source.split("\n")- ai_agents_line = None- for line in lines:- if "AI Agents" in line and "multi-provider" in line:- ai_agents_line = line- break- self.assertIsNotNone(ai_agents_line,- "AI Agents row with multi-provider must exist")- self.assertIn("MiniMax", ai_agents_line,- "MiniMax must be listed in AI Agents feature row")---class TestMiniMaxTextToolCallSupport(unittest.TestCase):- """Verify MiniMax is acknowledged in text-based tool call detection."""-- def setUp(self):- self.source = read_file(LLM_SERVICE_CPP)-- def test_minimax_mentioned_in_text_tool_calls(self):- """The try_extract_and_execute_text_tool_calls comment mentions minimax- as a model that uses text-based tool calls."""- self.assertIn("minimax", self.source.lower(),- "minimax should be mentioned in text tool call comments")---if __name__ == "__main__":- unittest.main(verbosity=2)