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...

相关推荐
Porien19 分钟前
Rust 开发 tauri 桌面项目
rust
耿玉1 小时前
大模型应用中我们为什么需要MCP
前端·deepseek·mcp
Jsaon_Huang1 小时前
DeepSeek技术解析:MoE架构实现与代码实战
deepseek
GIS思维2 小时前
ArcGIS10.X影像智能下载!迁移ArcGIS Pro批量智能高清影像下载工具至ArcGIS!
python·arcgis·arcgis pro·deepseek·高清影像下载·谷歌影像·天地图影像
AI Echoes3 小时前
DeepSeek:从入门到精通
深度学习·deepseek
乡间小路4 小时前
关于能否用DeepSeek做危险的事情,DeepSeek本身给出了答案
deepseek·人工智能伦理
用户7737619852284 小时前
开发效率提升 40%!DeepSeek 两大低成本部署方案,哪种更适合你?
deepseek
helloworld_工程师5 小时前
20分钟上手DeepSeek开发:SpringBoot + Vue2快速构建AI对话系统
java·后端·deepseek
Demi_*5 小时前
MacOS本地部署Deepseek,不联网也可以使用AI,保护隐私
macos·deepseek·本地部署ai大模型
前端梭哈攻城狮5 小时前
ollama+dify本地化部署【菜鸟教程】
aigc·ollama·deepseek