DeepSeek轻量级本地化部署工具AIMatrices更新——新增OllamaApi接口调用,Python及Html运行等功能

AIMatrices DeepSeek 是一款基于 AI 应用快速构建平台 AIMatrices 开发的开源 DeepSeek 轻量级本地化部署工具,支持本地模型、远程 API 灵活切换,旨在为用户提供高效、灵活且低成本的 DeepSeek 大模型部署解决方案。

AIMatrices DeepSeek 最新版本新增 Ollama Api 接口调用功能,实现与本地模型交互; 新增 Python 代码直接运行及编辑功能;新增 Html 代码直接浏览及编辑功能。

AIMatrices DeepSeek 安装及使用见:DeepSeek轻量级本地化部署工具------AIMatrices DeepSeek

新增 Ollama Api 接口调用功能,实现与本地模型交互

Ollama Api 接口配置

打开 app_data/codes/deepseek-api 目录下 config.js,修改Ollama Api 配置信息

bash 复制代码
const models = {
    "local/deepseek-r1": {
        name: "DeepSeek-R1(本地)",
        model: "local/DeepSeek-R1",
        local: true,
        url: "/service/deepseek-local",
        api_key: ""
    },
    "ollama-qwen": {
        name: "Ollama qwen2.5",
        model: "qwen2.5",
        local: false,
        url: "/service/ollama-api",
        api_key: ""
    },
    "deepseek-chat": {
        name: "DeepSeek Chat",
        model: "deepseek-chat",
        local: false,
        url: "https://api.deepseek.com",
        api_key: "sk-********************************"
    },
    "deepseek-reasoner": {
        name: "DeepSeek Reasoner",
        model: "deepseek-reasoner",
        local: false,
        url: "https://api.deepseek.com",
        api_key: "sk-********************************"
    },
    "siliconflow/deepseek-v3": {
        name: "DeepSeek-V3(硅基流动)",
        model: "deepseek-ai/DeepSeek-V3",
        local: false,
        url: "https://api.siliconflow.cn/v1",
        api_key: "sk-********************************"
    },
    "siliconflow/deepseek-r1": {
        name: "DeepSeek-R1(硅基流动)",
        model: "deepseek-ai/DeepSeek-R1",
        local: false,
        url: "https://api.siliconflow.cn/v1",
        api_key: "sk-********************************"
    },
}
const default_model = "local/deepseek-r1"
const default_system_message = "You are DeepSeek, a large language model. Follow the user's instructions carefully."
const chat_db_name = "chatdb"

新增 Python 代码直接运行及编辑功能

AIMatrices DeepSeek 使用 WebAssembly 技术内嵌 Python 运行环境,无需额安装 Python,即可运行 DeepSeek 生成的 Python 代码。Python 代码仅使用标准库,可以正常运行。

在 AIMatrices DeepSeek 输入框输入提示词,以下为示例

复制代码
下面是一个计算阶乘的 Python 代码示例:

AIMatrices DeepSeek 调用本地模型或远程 API 输出内容

python 复制代码
def factorial(n):
    if n < 0:
        return "阶乘未定义负数"
    elif n == 0 or n == 1:
        return 1
    else:
        result = 1
        for i in range(2, n + 1):
            result *= i
        return result
# 示例:计算 5 的阶乘
n = 5
print(f"{n} 的阶乘是: {factorial(n)}")

点击输出文本框顶部右侧【python 】,打开Python 运行窗口

可以左侧修改代码后,直接运行

新增 Html 代码直接浏览及编辑功能

在AIMatrices DeepSeek 输入框输入提示词,以下为示例

css 复制代码
做一款俄罗斯方块的小游戏,游戏代码生成后可以在网页端直接运行。使用CSS、JS、HTML,所有代码放在一个html文件中

AIMatrices DeepSeek 调用本地模型或远程 API 输出内容

ini 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>俄罗斯方块</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #333;
            font-family: Arial, sans-serif;
        }
        #game-board {
            display: grid;
            grid-template-columns: repeat(10, 20px);
            grid-template-rows: repeat(20, 20px);
            gap: 1px;
            background-color: #222;
            border: 2px solid #444;
        }
        .cell {
            width: 20px;
            height: 20px;
            background-color: #444;
        }
        .tetromino {
            background-color: #f39c12;
        }
        #score {
            color: white;
            font-size: 24px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div>
        <div id="game-board"></div>
        <div id="score">Score: 0</div>
    </div>
    <script>
        const boardWidth = 10;
        const boardHeight = 20;
        const board = Array.from({ length: boardHeight }, () => Array(boardWidth).fill(0));
        let currentPiece;
        let score = 0;
        let gameInterval;
        const tetrominoes = [
            [[1, 1, 1, 1]], // I
            [[1, 1], [1, 1]], // O
            [[1, 1, 1], [0, 1, 0]], // T
            [[1, 1, 0], [0, 1, 1]], // S
            [[0, 1, 1], [1, 1, 0]], // Z
            [[1, 1, 1], [1, 0, 0]], // L
            [[1, 1, 1], [0, 0, 1]] // J
        ];
        function createPiece() {
            const randomIndex = Math.floor(Math.random() * tetrominoes.length);
            const piece = tetrominoes[randomIndex];
            const pieceWidth = piece[0].length;
            const x = Math.floor((boardWidth - pieceWidth) / 2);
            return { piece, x, y: 0 };
        }
        function drawBoard() {
            const gameBoard = document.getElementById('game-board');
            gameBoard.innerHTML = '';
            for (let y = 0; y < boardHeight; y++) {
                for (let x = 0; x < boardWidth; x++) {
                    const cell = document.createElement('div');
                    cell.classList.add('cell');
                    if (board[y][x] || (currentPiece && currentPiece.piece[y - currentPiece.y]?.[x - currentPiece.x])) {
                        cell.classList.add('tetromino');
                    }
                    gameBoard.appendChild(cell);
                }
            }
        }
        function movePiece(dx, dy) {
            const newX = currentPiece.x + dx;
            const newY = currentPiece.y + dy;
            if (isCollision(newX, newY, currentPiece.piece)) {
                if (dy === 1) {
                    placePiece();
                    return;
                }
                return;
            }
            currentPiece.x = newX;
            currentPiece.y = newY;
            drawBoard();
        }
        function isCollision(x, y, piece) {
            for (let py = 0; py < piece.length; py++) {
                for (let px = 0; px < piece[py].length; px++) {
                    if (piece[py][px] && (board[y + py]?.[x + px] || x + px < 0 || x + px >= boardWidth || y + py >= boardHeight)) {
                        return true;
                    }
                }
            }
            return false;
        }
        function placePiece() {
            const { x, y, piece } = currentPiece;
            for (let py = 0; py < piece.length; py++) {
                for (let px = 0; px < piece[py].length; px++) {
                    if (piece[py][px]) {
                        board[y + py][x + px] = 1;
                    }
                }
            }
            clearLines();
            currentPiece = createPiece();
            if (isCollision(currentPiece.x, currentPiece.y, currentPiece.piece)) {
                clearInterval(gameInterval);
                alert('Game Over!');
            }
            drawBoard();
        }
        function clearLines() {
            for (let y = boardHeight - 1; y >= 0; y--) {
                if (board[y].every(cell => cell === 1)) {
                    board.splice(y, 1);
                    board.unshift(Array(boardWidth).fill(0));
                    score += 10;
                    document.getElementById('score').innerText = `Score: ${score}`;
                }
            }
        }
        function rotatePiece() {
            const rotatedPiece = currentPiece.piece[0].map((_, i) => currentPiece.piece.map(row => row[i])).reverse();
            if (!isCollision(currentPiece.x, currentPiece.y, rotatedPiece)) {
                currentPiece.piece = rotatedPiece;
                drawBoard();
            }
        }
        document.addEventListener('keydown', (e) => {
            if (e.key === 'ArrowLeft') movePiece(-1, 0);
            if (e.key === 'ArrowRight') movePiece(1, 0);
            if (e.key === 'ArrowDown') movePiece(0, 1);
            if (e.key === 'ArrowUp') rotatePiece();
        });
        function startGame() {
            currentPiece = createPiece();
            drawBoard();
            gameInterval = setInterval(() => movePiece(0, 1), 500);
        }
        startGame();
    </script>
</body>
</html>

点击输出文本框顶部右侧【html 】,打开 Html 预览窗口

其它

下载网址:github.com/guyoung/AIM...

项目网址:github.com/guyoung/AIM...

AIMatrices DeepSeek 安装及使用:DeepSeek轻量级本地化部署工具------AIMatrices DeepSeek

原文链接:mp.weixin.qq.com/s/_ICrephmr...

相关推荐
Source.Liu1 小时前
【学写LibreCAD】C++ vs Rust 颜色模块对比分析
rust·cad
懷淰メ11 小时前
【AI加持】基于PyQt5+YOLOv8+DeepSeek的输电隐患检测系统(详细介绍)
yolo·目标检测·计算机视觉·pyqt·deepseek·监测系统·输电隐患
Source.Liu13 小时前
【LibreCAD】 RS_Units 类完整解析
c++·qt·rust
土豆125019 小时前
Rust入门系列(三):生命周期 - 编译器的"算命先生"
rust
Yeliang Wu19 小时前
使用Docker安装Ollama及Open-WebUI完整教程
ollama·openwebui
tiger11920 小时前
DeepSeek V3.1 的推理解析
人工智能·llm·推理·moe·decode·deepseek·prefill
skywalk816321 小时前
GLM-edge-1.5B-chat 一个特别的cpu可以推理的小型llm模型
人工智能·ollama·llama.cpp
ULTRA??1 天前
C++类型和容器在MoonBit中的对应关系整理
开发语言·c++·rust
Source.Liu1 天前
【学写LibreCAD】Rust Vector2D 实现与 C++ RS_Vector 的对应关系及优势分析
c++·rust·cad
Hello.Reader1 天前
Rocket 0.5 快速上手3 分钟跑起第一个 Rust Web 服务
开发语言·前端·rust