xinli/Archive/检查Ollama状态.bat
2026-01-30 16:23:31 +08:00

56 lines
1.5 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
echo ========================================
echo 检查Ollama服务状态
echo ========================================
echo.
echo [1] 检查Ollama服务是否运行...
curl -s http://localhost:11434/api/tags >nul 2>&1
if %errorlevel% equ 0 (
echo ✓ Ollama服务正在运行
echo.
echo [2] 已安装的模型:
curl -s http://localhost:11434/api/tags
echo.
) else (
echo ✗ Ollama服务未运行
echo.
echo 请按以下步骤操作:
echo 1. 下载Ollama: https://ollama.ai/download
echo 2. 安装后启动Ollama
echo 3. 运行: ollama pull nomic-embed-text
echo.
goto :end
)
echo.
echo [3] 测试嵌入模型...
echo 正在测试 nomic-embed-text 模型...
curl -s -X POST http://localhost:11434/api/embeddings ^
-H "Content-Type: application/json" ^
-d "{\"model\":\"nomic-embed-text\",\"prompt\":\"测试\"}" ^
--max-time 30 > temp_embed_result.txt 2>&1
findstr /C:"embedding" temp_embed_result.txt >nul 2>&1
if %errorlevel% equ 0 (
echo ✓ 嵌入模型工作正常!
del temp_embed_result.txt 2>nul
) else (
echo ✗ 嵌入模型测试失败
echo.
echo 可能原因:
echo 1. nomic-embed-text 模型未下载
echo 运行: ollama pull nomic-embed-text
echo.
echo 2. 模型正在加载中,请等待几秒后重试
echo.
type temp_embed_result.txt
del temp_embed_result.txt 2>nul
)
:end
echo.
echo ========================================
pause