Skip to content

Commit e7a6fb5

Browse files
authored
Merge pull request #6 from Creator-SN/vue3_llm
Vue3 llm
2 parents d4ff511 + d357030 commit e7a6fb5

61 files changed

Lines changed: 19077 additions & 10910 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 72 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,97 @@
1-
# This is a basic workflow to help you get started with Actions
1+
name: Release
22

3-
name: Release ✈
4-
5-
# Controls when the action will run.
63
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
84
push:
95
tags:
106
- "v*"
11-
12-
# Allows you to run this workflow manually from the Actions tab
137
workflow_dispatch:
148

15-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16-
jobs:
17-
# This workflow contains a single job called "build"
18-
window:
19-
# The type of runner that the job will run on
20-
runs-on: windows-latest
9+
permissions:
10+
contents: write
2111

22-
# Steps represent a sequence of tasks that will be executed as part of the job
12+
jobs:
13+
windows:
14+
runs-on: windows-2022
2315
steps:
24-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25-
- uses: actions/checkout@v3
26-
27-
# Uses NodeJs Environment
28-
- uses: actions/setup-node@v3
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
2920
with:
30-
node-version: 14
31-
registry-url: https://registry.npmjs.org/
32-
cache: "yarn"
33-
34-
- name: install dependencies
21+
node-version: 20
22+
cache: yarn
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.11"
27+
- name: Install dependencies
28+
env:
29+
npm_config_python: ${{ env.pythonLocation }}\python.exe
3530
run: yarn install --frozen-lockfile
36-
37-
- name: build win x64
38-
run: yarn electron:build
39-
40-
- name: Get tag
41-
id: tag
42-
uses: dawidd6/action-get-tag@v1
43-
44-
- name: Rename
31+
- name: Build Windows package
32+
run: yarn build:win
33+
- name: Collect Windows artifacts
34+
shell: pwsh
4535
run: |
46-
$v="${{steps.tag.outputs.tag}}".Substring(1)
47-
mv "./dist_electron/MathFX Setup $v.exe" "MathFX-Setup-$v.exe"
48-
mv "./dist_electron/MathFX Setup $v.exe.blockmap" "MathFX-Setup-$v.exe.blockmap"
49-
mv "./dist_electron/latest.yml" "latest.yml"
50-
- name: Upload Prerelease
51-
uses: ncipollo/release-action@v1
52-
if: ${{ contains(steps.tag.outputs.tag,'beta') }}
53-
with:
54-
allowUpdates: true
55-
artifacts: "*.exe,*.blockmap,*.yml"
56-
token: ${{ secrets.GITHUB_TOKEN }}
57-
prerelease: true
58-
59-
- name: Upload Release
60-
uses: ncipollo/release-action@v1
61-
if: ${{ !contains(steps.tag.outputs.tag,'beta') }}
36+
New-Item -ItemType Directory -Force -Path release | Out-Null
37+
Get-ChildItem "dist" -File | Where-Object {
38+
$_.Extension -in @('.exe', '.blockmap', '.yml')
39+
} | Copy-Item -Destination release
40+
- name: Upload Windows artifacts
41+
uses: actions/upload-artifact@v4
6242
with:
63-
allowUpdates: true
64-
artifacts: "*.exe,*.blockmap,*.yml"
65-
token: ${{ secrets.GITHUB_TOKEN }}
43+
name: windows-release
44+
path: release/*
6645

6746
macos:
68-
runs-on: macos-latest
47+
runs-on: macos-14
6948
steps:
70-
- uses: actions/checkout@v2
71-
72-
# Uses NodeJs Environment
73-
- uses: actions/setup-node@v1
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
- name: Setup Node
52+
uses: actions/setup-node@v4
7453
with:
75-
node-version: 14
76-
registry-url: https://registry.npmjs.org/
77-
cache: "yarn"
78-
79-
- name: install dependencies
54+
node-version: 20
55+
cache: yarn
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: "3.11"
60+
- name: Install dependencies
61+
env:
62+
npm_config_python: ${{ env.pythonLocation }}/bin/python
8063
run: yarn install --frozen-lockfile
81-
82-
- name: build macos x64
83-
run: yarn electron:build
84-
85-
- name: Get tag
86-
id: tag
87-
uses: dawidd6/action-get-tag@v1
88-
89-
- name: Rename
64+
- name: Build macOS package
65+
run: yarn build:mac
66+
- name: Collect macOS artifacts
9067
run: |
91-
v=${{steps.tag.outputs.tag}}
92-
v=${v:1}
93-
mv ./dist_electron/MathFX-$v.dmg ./MathFX-$v.dmg
94-
mv ./dist_electron/MathFX-$v.dmg.blockmap ./MathFX-$v.dmg.blockmap
95-
mv ./dist_electron/MathFX-$v-mac.zip ./MathFX-$v-mac.zip
96-
mv ./dist_electron/latest-mac.yml ./latest-mac.yml
97-
- name: Upload Prerelease
98-
uses: ncipollo/release-action@v1
99-
if: ${{ contains(steps.tag.outputs.tag,'beta') }}
68+
mkdir -p release
69+
find dist -maxdepth 1 -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.blockmap" -o -name "latest-mac.yml" \) -exec cp {} release/ \;
70+
- name: Upload macOS artifacts
71+
uses: actions/upload-artifact@v4
10072
with:
101-
allowUpdates: true
102-
artifacts: "*.dmg,*.blockmap,*.yml"
103-
token: ${{ secrets.GITHUB_TOKEN }}
104-
prerelease: true
73+
name: macos-release
74+
path: release/*
10575

106-
- name: Upload Release
76+
publish:
77+
needs: [windows, macos]
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Download Windows artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: windows-release
84+
path: release
85+
- name: Download macOS artifacts
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: macos-release
89+
path: release
90+
- name: Publish GitHub release
10791
uses: ncipollo/release-action@v1
108-
if: ${{ !contains(steps.tag.outputs.tag,'beta') }}
10992
with:
11093
allowUpdates: true
111-
artifacts: "*.dmg,*.blockmap,*.yml"
94+
artifacts: "release/*"
95+
generateReleaseNotes: true
96+
prerelease: ${{ contains(github.ref_name, 'beta') }}
11297
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
/dist
44
/dist_electron
5+
/out
56

67

78
# local env files

README.md

Lines changed: 80 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,113 @@
11
<div align="center">
2-
<img src="./src/assets/logo.svg" width="60" style="width: 60px;"/>
3-
<p>MathFX</p>
4-
<p><img src="https://img.shields.io/github/v/release/Creator-SN/MathFX" /></p>
2+
<img src="./src/renderer/src/assets/logo.svg" width="72" alt="MathFX logo" />
3+
<h1>MathFX</h1>
4+
<p>A beautiful, friendly, and minimal formula OCR workspace powered by VLM APIs.</p>
5+
<p>
6+
<a href="https://github.com/Creator-SN/MathFX/releases"><img src="https://img.shields.io/github/v/release/Creator-SN/MathFX?label=release" alt="Latest release" /></a>
7+
<a href="https://github.com/Creator-SN/MathFX/actions/workflows/release.yml"><img src="https://github.com/Creator-SN/MathFX/actions/workflows/release.yml/badge.svg" alt="Release workflow" /></a>
8+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="MIT license" /></a>
9+
</p>
10+
<p><a href="./docs/README.zh-CN.md">中文文档</a></p>
511
</div>
612

7-
<p align="center">
8-
<a href="LICENSE">
9-
<img src="https://img.shields.io/badge/License-MIT-yellow.svg">
10-
</a>
11-
</p>
13+
## What is MathFX?
1214

13-
## 💡 MathFX(Preview)
15+
MathFX is a small cross-platform desktop tool for turning mathematical expressions into clean, editable LaTeX. Its core workflow is deliberately simple: capture a formula, let a vision-language model understand it, and copy the result wherever you need it.
1416

15-
A pure open source and cross platforms Math Formulates OCR tool based on the Electron.
17+
It is designed for papers, lecture notes, research workflows, and anyone who wants formula recognition without a crowded interface.
1618

17-
<div align="center" style="display: flex; justify-content: space-around;">
18-
<img src="./src/assets/docs/scan.png" width="320" style="width: 48%; box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.1);"/>
19-
<img src="./src/assets/docs/scan_dark.png" width="320" style="width: 48%; box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.1);"/>
19+
<div align="center">
20+
<img src="./src/renderer/src/assets/docs/scan.png" width="48%" alt="MathFX light interface" />
21+
<img src="./src/renderer/src/assets/docs/scan_dark.png" width="48%" alt="MathFX dark interface" />
2022
</div>
2123

22-
## 🎈 Platform
23-
24-
- ✔ Windows 11 [Supported]
25-
- ✔ Windows 10 [Supported]
26-
- ✔ Mac(AMD64) [Supported]
24+
## Highlights
2725

26+
- **Minimal formula OCR** — capture a formula from any screen with a global shortcut and receive editable LaTeX.
27+
- **VLM API based** — use a vision-capable, OpenAI-compatible Chat API instead of being locked to a single OCR vendor.
28+
- **Your provider, your model** — configure a custom display name, base URL, API key, model, and `reasoning_effort` (defaults to `medium`).
29+
- **LangGraph orchestration** — the recognition request is represented as a small LangGraph workflow, making the model call and result parsing explicit and extensible.
30+
- **Manual LaTeX workspace** — edit or enter LaTeX by hand, render it immediately, and keep the corrected result in history.
31+
- **Copy in useful formats** — quickly copy bare LaTeX, inline math, display math, equation-environment LaTeX, rendered SVG, or a raster image for documents and desktop applications.
32+
- **History and navigation** — keep recognized formulas locally, browse previous results, edit them, and remove entries when they are no longer needed.
33+
- **Light and dark themes** — a compact interface that stays out of the way while you work.
34+
- **Windows and macOS releases** — packaged installers are built automatically through GitHub Actions.
2835

29-
## ✨ Installation
36+
## How recognition works
3037

31-
See the [Release Page](https://github.com/Creator-SN/MathFX/releases).
38+
MathFX sends the captured image to the VLM endpoint configured in the selected subscription. The model is instructed to return one JSON object containing KaTeX-compatible LaTeX. MathFX then parses the response and performs rendering, SVG generation, format conversion, and clipboard operations locally.
3239

33-
## 🔨 Tutorial
40+
The default prompt asks the model to preserve fractions, roots, matrices, Greek letters, limits, superscripts, subscripts, aligned equations, operators, and visible text while returning no Markdown or explanation.
3441

35-
First, you need to set up the subscriptions, MathFX currently supports three formulate OCR APIs. Including:
42+
Because MathFX uses a VLM API, the selected model must support image input. The endpoint should be compatible with the OpenAI Chat Completions interface, including hosted OpenAI-compatible services and local vision models.
3643

37-
1. **SLatex OCR** **(Recommend)**: To build your own backend server, you can deploy the OCR server in this repo [SLatexOCR](https://github.com/aleversn/sLatexOCR).
38-
2. **Mathpix**: You can register the OCR API services with `$1` started, and the current pricing is much cheaper than directly using the Mathpix desktop application, each month you can have a `1,000` free requests. (`Although it costs $1 to sign up and a Credit Card is necessary, but the performance of this API is currently the best`). [See Details](https://mathpix.com/ocr)
39-
3. **Xunfei** Formula Recognition API: You can register the OCR API for free and obtain a `500` requests per day. [See Details](https://www.xfyun.cn/service/formula-discern)
40-
4. **Baidu** Formula Recognition API: You can register the OCR API for free and obtain a `1,000` requests per month. [See Details](https://ai.baidu.com/tech/ocr/formula)
44+
> Images are sent to the API provider configured by you. Review that provider's privacy and retention policy before using sensitive material.
4145
42-
> Note that the performance of `Xunfei` and `Baidu` OCR API is not good in complex science formulates scenes.
46+
## Quick start
4347

44-
Once you have an OCR API subscription, all you need to do is fill in the necessary information about the current subscription. Then click this subscription's item block until the block's border is `blue`.
48+
1. Download the latest installer from the [Releases page](https://github.com/Creator-SN/MathFX/releases).
49+
2. Open **Subscriptions** and add a Chat API subscription.
50+
3. Fill in the name, base URL, API key, vision-capable model, and optional `reasoning_effort` (`medium` by default).
51+
4. Select the subscription so its active state is highlighted.
52+
5. Press the scan button or use `Alt + Shift + X` on Windows, or `Alt + Cmd + X` on macOS.
4553

4654
<div align="center">
47-
<img src="./src/assets/docs/subscription.png" style="width: 80%; box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.1);"/>
55+
<img src="./src/renderer/src/assets/docs/subscription.png" width="80%" alt="MathFX subscription settings" />
4856
</div>
4957

50-
Now you can scan for a new formulate scene on the `Scan` page or press `Alt + Shift/Cmd + X` to quick scan.
58+
## Editing and copying formulas
5159

52-
## ⌨ Shortcuts
60+
After recognition, the formula can be corrected manually. MathFX renders the edited LaTeX with KaTeX and lets you copy the result in the format that fits the destination:
5361

54-
- `Alt` + `Shift/Cmd` + `M`: Show the main program.
55-
- `Alt` + `Shift/Cmd` + `X`: Start a new quick scan.
62+
- plain LaTeX source for editors such as VS Code;
63+
- inline or display LaTeX for Markdown and documentation;
64+
- an equation environment for LaTeX documents;
65+
- rendered SVG for Word and other rich document applications;
66+
- an image for applications that accept bitmap content.
5667

57-
## 🌏 Language
68+
The formula and its source image are kept in the local history store so you can revisit, edit, copy, or delete them later.
5869

59-
Currently supports two languages.
70+
## Keyboard shortcuts
6071

61-
- English
62-
- 简体中文(Chinese)
72+
- `Alt + Shift + X` on Windows / `Alt + Cmd + X` on macOS — capture a new formula.
6373

64-
## Acknowledgements
74+
## Development
6575

66-
This Project is Develop Based on [VFluentForElectron](https://github.com/Creator-SN/VFluentForElectron).
76+
Requirements: Node.js 20+, Yarn 1.x, and a VLM API key for end-to-end recognition.
6777

68-
## License
78+
```bash
79+
yarn install
80+
yarn dev
81+
```
82+
83+
Build the renderer and Electron bundles:
84+
85+
```bash
86+
yarn build
87+
```
6988

70-
MIT License
89+
Build platform packages locally:
7190

72-
Copyright (c) 2024 Creator SN®
91+
```bash
92+
yarn build:win
93+
yarn build:mac
94+
```
7395

74-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
96+
Tagged pushes matching `v*` trigger the GitHub Actions release workflow. Windows produces an NSIS installer; macOS produces DMG and ZIP packages using `Icon.icns`.
7597

76-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
98+
## Architecture
99+
100+
- **Electron + Vue 3** — desktop shell and renderer UI.
101+
- **Vite / electron-vite** — development and production bundling.
102+
- **LangChain OpenAI + LangGraph** — VLM model integration and recognition graph.
103+
- **KaTeX** — local LaTeX rendering.
104+
- **Pinia + lowdb** — application state and local history/subscription persistence.
105+
- **VFluent 3** — compact Fluent-inspired UI components.
106+
107+
## Acknowledgements
108+
109+
MathFX is built with [VFluent 3](https://github.com/Creator-SN/VFluentForElectron) and the Electron ecosystem.
110+
111+
## License
77112

78-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
113+
MathFX is released under the [MIT License](LICENSE).

babel.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)