code-ollama 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -113,10 +113,100 @@ var CodeBlock = memo(function CodeBlock({ code, language, role }) {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
//#endregion
|
|
116
|
+
//#region src/components/Markdown/extensions.ts
|
|
117
|
+
var LATEX_COMMANDS = {
|
|
118
|
+
"\\rightarrow": "→",
|
|
119
|
+
"\\leftarrow": "←",
|
|
120
|
+
"\\Rightarrow": "⇒",
|
|
121
|
+
"\\Leftarrow": "⇐",
|
|
122
|
+
"\\leftrightarrow": "↔",
|
|
123
|
+
"\\Leftrightarrow": "⟺",
|
|
124
|
+
"\\uparrow": "↑",
|
|
125
|
+
"\\downarrow": "↓",
|
|
126
|
+
"\\to": "→",
|
|
127
|
+
"\\gets": "←",
|
|
128
|
+
"\\times": "×",
|
|
129
|
+
"\\div": "÷",
|
|
130
|
+
"\\pm": "±",
|
|
131
|
+
"\\leq": "≤",
|
|
132
|
+
"\\geq": "≥",
|
|
133
|
+
"\\neq": "≠",
|
|
134
|
+
"\\approx": "≈",
|
|
135
|
+
"\\equiv": "≡",
|
|
136
|
+
"\\infty": "∞",
|
|
137
|
+
"\\sum": "∑",
|
|
138
|
+
"\\prod": "∏",
|
|
139
|
+
"\\sqrt": "√",
|
|
140
|
+
"\\partial": "∂",
|
|
141
|
+
"\\nabla": "∇",
|
|
142
|
+
"\\in": "∈",
|
|
143
|
+
"\\notin": "∉",
|
|
144
|
+
"\\subset": "⊂",
|
|
145
|
+
"\\supset": "⊃",
|
|
146
|
+
"\\cup": "∪",
|
|
147
|
+
"\\cap": "∩",
|
|
148
|
+
"\\emptyset": "∅",
|
|
149
|
+
"\\alpha": "α",
|
|
150
|
+
"\\beta": "β",
|
|
151
|
+
"\\gamma": "γ",
|
|
152
|
+
"\\delta": "δ",
|
|
153
|
+
"\\epsilon": "ε",
|
|
154
|
+
"\\theta": "θ",
|
|
155
|
+
"\\lambda": "λ",
|
|
156
|
+
"\\mu": "μ",
|
|
157
|
+
"\\pi": "π",
|
|
158
|
+
"\\sigma": "σ",
|
|
159
|
+
"\\tau": "τ",
|
|
160
|
+
"\\phi": "φ",
|
|
161
|
+
"\\omega": "ω",
|
|
162
|
+
"\\$": "$",
|
|
163
|
+
"\\%": "%",
|
|
164
|
+
"\\&": "&",
|
|
165
|
+
"\\#": "#",
|
|
166
|
+
"\\{": "{",
|
|
167
|
+
"\\}": "}",
|
|
168
|
+
"\\^": "^",
|
|
169
|
+
"\\_": "_",
|
|
170
|
+
"\\cdot": "·",
|
|
171
|
+
"\\ldots": "…",
|
|
172
|
+
"\\cdots": "⋯"
|
|
173
|
+
};
|
|
174
|
+
function convertLatex(math) {
|
|
175
|
+
let result = math.trim();
|
|
176
|
+
for (const [cmd, unicode] of Object.entries(LATEX_COMMANDS)) result = result.replaceAll(cmd, unicode);
|
|
177
|
+
result = result.replace(/\\frac\{([^}]*)\}\{([^}]*)\}/g, "$1/$2");
|
|
178
|
+
result = result.replace(/\^\{([^}]*)\}/g, "^$1");
|
|
179
|
+
result = result.replace(/_\{([^}]*)\}/g, "_$1");
|
|
180
|
+
result = result.replace(/\\[,;!: ]/g, " ");
|
|
181
|
+
result = result.replace(/\\[a-zA-Z]+\{([^}]*)\}/g, "$1");
|
|
182
|
+
result = result.replace(/\\[a-zA-Z]+/g, "");
|
|
183
|
+
return result.trim();
|
|
184
|
+
}
|
|
185
|
+
var inlineMathExtension = {
|
|
186
|
+
name: "inlineMath",
|
|
187
|
+
level: "inline",
|
|
188
|
+
start: (src) => src.indexOf("$"),
|
|
189
|
+
tokenizer(src) {
|
|
190
|
+
const match = /^\$([^$\n]+?)\$/.exec(src);
|
|
191
|
+
if (match) return {
|
|
192
|
+
type: "inlineMath",
|
|
193
|
+
raw: match[0],
|
|
194
|
+
math: match[1]
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
renderer(token) {
|
|
198
|
+
// v8 ignore next
|
|
199
|
+
return convertLatex(token.math ?? "");
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
116
203
|
//#region src/components/Markdown/Markdown.tsx
|
|
117
204
|
var HR_PLACEHOLDER = "__CODE_OLLAMA_HR_PLACEHOLDER__";
|
|
118
205
|
marked.use(markedTerminal({ theme: "gitHub" }));
|
|
119
|
-
marked.use({
|
|
206
|
+
marked.use({
|
|
207
|
+
extensions: [inlineMathExtension],
|
|
208
|
+
renderer: { hr: () => `${HR_PLACEHOLDER}\n` }
|
|
209
|
+
});
|
|
120
210
|
function renderMarkdown(content, hrWidth) {
|
|
121
211
|
const hr = "─".repeat(Math.max(1, hrWidth));
|
|
122
212
|
try {
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { homedir } from "node:os";
|
|
|
7
7
|
import { Ollama } from "ollama";
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "code-ollama";
|
|
10
|
-
var version = "0.13.
|
|
10
|
+
var version = "0.13.1";
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/constants/package.ts
|
|
13
13
|
var NAME = name;
|
|
@@ -696,7 +696,7 @@ async function processRunStream(messages, model) {
|
|
|
696
696
|
}
|
|
697
697
|
async function main(args = process.argv.slice(2)) {
|
|
698
698
|
if (!args.length) {
|
|
699
|
-
const { renderApp } = await import("./assets/tui-
|
|
699
|
+
const { renderApp } = await import("./assets/tui-CCa_vqh0.js");
|
|
700
700
|
reset();
|
|
701
701
|
renderApp();
|
|
702
702
|
return;
|