Skip to content

Commit a8978aa

Browse files
committed
chore: remove code
1 parent e5c1c9b commit a8978aa

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

main.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
async function recognize(base64, lang, options) {
22
const { config } = options;
3-
// const { tauriFetch: fetch } = utils;
43
let { model = "Pro/Qwen/Qwen2-VL-7B-Instruct", apiKey, requestPath, customPrompt } = config;
54

65
if (!requestPath) {
@@ -14,7 +13,6 @@ async function recognize(base64, lang, options) {
1413

1514
// in openai like api, /v1 is not required
1615
if (!apiUrl.pathname.endsWith('/chat/completions')) {
17-
// not openai like, populate completion endpoint
1816
apiUrl.pathname += apiUrl.pathname.endsWith('/') ? '' : '/';
1917
apiUrl.pathname += 'v1/chat/completions';
2018
}
@@ -33,15 +31,6 @@ async function recognize(base64, lang, options) {
3331
const body = {
3432
model,
3533
messages: [
36-
// {
37-
// "role": "system",
38-
// "content": [
39-
// {
40-
// "type": "text",
41-
// "text": customPrompt
42-
// }
43-
// ],
44-
// },
4534
{
4635
"role": "user",
4736
"content": [
@@ -71,13 +60,7 @@ async function recognize(base64, lang, options) {
7160
if (choices) {
7261
let target = choices[0].message.content.trim();
7362
if (target) {
74-
if (target.startsWith('"')) {
75-
target = target.slice(1);
76-
}
77-
if (target.endsWith('"')) {
78-
target = target.slice(0, -1);
79-
}
80-
return target.trim();
63+
return target
8164
} else {
8265
throw JSON.stringify(choices);
8366
}

0 commit comments

Comments
 (0)