V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
huiyanpohundh123
V2EX  ›  程序员

MacOS 沉浸式翻译使用本地大模型(Ollama)临时解决方案

  •  
  •   huiyanpohundh123 ·
    tinuv · 55 天前 · 2471 次点击
    这是一个创建于 55 天前的主题,其中的信息可能已经有所发展或是发生改变。

    TranslationService

    沉浸式翻译本地大模型临时解决方案

    github: https://github.com/tinuv/TranslationService

    如果有用麻烦点个🌟

    0. 打开沉浸式翻译的实验功能,使用自定义 API,使用自定义地址:http://localhost:8080/translate

    1. 直接使用命令行

    从源码编译后直接在命令行使用/path/to/TranslationService,或者从仓库的 release 下载编译后的二进制文件

    2. 使用launchctl长期使用

    1. 新建TranslationService.plist,并写入

         <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
      ">
      <plist version="1.0">
          <dict>
              <key>KeepAlive</key>
              <dict>
                  <key>SuccessfulExit</key>
                  <false/>
              </dict>
              <key>Label</key>
              <string>TranslationService</string>
              <key>ProgramArguments</key>
              <array>
                  <string>/Users/tinuv/Developer/Apple/TranslationService/TranslationService/TranslationService</string>
              </array>
              <key>RunAtLoad</key>
              <true/>
          </dict>
      </plist>
      

      其中/Users/tinuv/Developer/Apple/TranslationService/TranslationService/TranslationService替换为自己的 TranslationService 路径

    2. 将文件移动到/Library/LaunchDaemons/,sudo mv /path/to/TranslationService.plist /Library/LaunchDaemons/TranslationService.plist

    3. 开机自启sudo launchctl load -w /Library/LaunchDaemons/TranslationService.plist

    4. 卸载自启动sudo launchctl unload -w /Library/LaunchDaemons/TranslationService.plist 或直接删除此文件

    4 条回复    2024-04-01 21:35:41 +08:00
    mortal
        1
    mortal  
       55 天前
    好奇为啥还要套一层?沉浸式翻译不是可以直接用 openAI 方式接入 Ollama 吗
    huiyanpohundh123
        2
    huiyanpohundh123  
    OP
       55 天前
    @mortal 就是不支持啊 但是 github 已经有人提 issue 现在作为临时解决方案
    Yzh361
        3
    Yzh361  
       54 天前 via Android
    这么麻烦… 多亏用的是 chromeOS
    goodryb
        4
    goodryb  
       26 天前
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   915 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:30 · PVG 06:30 · LAX 15:30 · JFK 18:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.