构建 Electron 应用的挑战

I’ve been building an Electron app called “Delta. Delta is a tool for knowledge exploration and ideation through the branching of conversations with language models. I have lots of ideas for how I want to make this idea useful and valuable, but today it looks like this.

我正在构建一个名为 “Delta” 的 Electron 应用。Delta 是一个通过与语言模型的对话分支进行知识探索和创意生成的工具。我有很多想法想要让这个想法变得有用和有价值,但今天它看起来是这样的。

This article is about my struggles building Delta using Electron and how I eventually found workable, though likely suboptimal, solutions to these challenges.

这篇文章讲述了我在使用 Electron 构建 Delta 时的挣扎,以及我最终找到的可行但可能不是最佳的解决方案。

A screenshot of a conversation branching application

Origins

起源

The app started out as a Next.js app using Vercel’s ai SDK for interacting with and streaming responses from language models. I had a version of this working pretty well, but as I began thinking about wanting to share the app with friends, I realized I needed to make it a local-first app. I don’t want to store others’ conversations or media on servers I manage. I also wanted to support local models through tools like ollama, to allow for a fully offline experience for those who want that.

该应用最初是一个 Next.js 应用,使用 Vercel 的 ai SDK 与语言模型进行交互和流式响应。我有一个版本运行得相当不错,但当我开始考虑想与朋友分享这个应用时,我意识到我需要将其变成一个本地优先的应用。我不想在我管理的服务器上存储他人的对话或媒体。我还希望通过像 ollama 这样的工具支持本地模型,以便为那些想要完全离线体验的人提供服务。

With these requirements, I looked to Electron. Having already built the app in React, my hope was it would be straightforward to construct a similar app using Electron, reusing much of the same React code, so that I could distribute it as a Desktop application.

考虑到这些要求,我转向了 Electron。由于我已经在 React 中构建了该应用,我希望使用 Electron 构建一个类似的应用会很简单,重用许多相同的 React 代码,以便我可以将其作为桌面应用程序分发。

This understanding was not entirely wrong, but it has been far from easy.

这种理解并非完全错误,但远非容易。

I decided to build my project with vite and electron-forge.

我决定使用 viteelectron-forge 来构建我的项目。

npm init electron-app@latest delta -- --template=vite-typescript

There have been challenges but it’s not clear if I would have run into fewer challenges with different tools.

虽然遇到了一些挑战,但不清楚如果使用不同的工具我是否会遇到更少的挑战。

Chall...

开通本站会员,查看完整译文。

Accueil - Wiki
Copyright © 2011-2025 iteam. Current version is 2.148.1. UTC+08:00, 2025-11-23 19:22
浙ICP备14020137号-1 $Carte des visiteurs$