fix: update terminology from 'multimodal recognition' to 'OCR text recognition'

This commit is contained in:
cunninger 2025-03-26 18:54:50 +08:00
parent 95d8f03c48
commit ff2d2bf290

372
worker.js
View File

@ -267,22 +267,22 @@ async function recognizeImage(token, imageId, request) {
console.error('Prompt解码错误:', error);
}
const defaultPrompt = '请识别图片中的内容,注意以下要求:\n' +
'对于数学公式和普通文本\n' +
'1. 所有数学公式和数学符号都必须使用标准的LaTeX格式\n' +
'2. 行内公式使用单个$符号包裹,如:$x^2$\n' +
'3. 独立公式块使用两个$$符号包裹,如:$$\\sum_{i=1}^n i^2$$\n' +
'4. 普通文本保持原样不要使用LaTeX格式\n' +
'5. 保持原文的段落格式和换行\n' +
'6. 明显的换行使用\\n表示\n' +
'7. 确保所有数学符号都被正确包裹在$或$$中\n\n' +
'对于验证码图片:\n' +
'1. 只输出验证码字符,不要加任何额外解释\n' +
'2. 忽略干扰线和噪点\n' +
'3. 注意区分相似字符如0和O、1和l、2和Z等\n' +
'4. 验证码通常为4-6位字母数字组合\n\n' +
'不要输出任何额外的解释或说明';
const defaultPrompt =
'不要输出任何额外的解释或说明,禁止输出例如:识别内容、以上内容已严格按照要求进行格式化和转换等相关无意义的文字!' + '请识别图片中的内容,注意以下要求\n' +
'对于数学公式和普通文本:\n' +
'1. 所有数学公式和数学符号都必须使用标准的LaTeX格式\n' +
'2. 行内公式使用单个$符号包裹,如:$x^2$\n' +
'3. 独立公式块使用两个$$符号包裹,如:$$\\sum_{i=1}^n i^2$$\n' +
'4. 普通文本保持原样不要使用LaTeX格式\n' +
'5. 保持原文的段落格式和换行\n' +
'6. 明显的换行使用\\n表示\n' +
'7. 确保所有数学符号都被正确包裹在$或$$中\n\n' +
'对于验证码图片:\n' +
'1. 只输出验证码字符,不要加任何额外解释\n' +
'2. 忽略干扰线和噪点\n' +
'3. 注意区分相似字符如0和O、1和l、2和Z等\n' +
'4. 验证码通常为4-6位字母数字组合\n\n' +
'';
const response = await fetch('https://chat.qwenlm.ai/api/chat/completions', {
method: 'POST',
headers: {
@ -1074,205 +1074,205 @@ function getHTML() {
' justify-content: center;',
' align-items: center;',
' }',
' .footer-content {',
' text-align: center;',
' width: 100%;',
' }',
' .footer-content {',
' text-align: center;',
' width: 100%;',
' }',
' .powered-by {',
' color: #7f8c8d;',
' font-size: 0.9rem;',
' }',
' color: #7f8c8d;',
' font-size: 0.9rem;',
' }',
' .powered-by a {',
' color: #3498db;',
' text-decoration: none;',
' transition: color 0.3s ease;',
' font-weight: 500;',
' }',
' .powered-by a {',
' color: #3498db;',
' text-decoration: none;',
' transition: color 0.3s ease;',
' font-weight: 500;',
' }',
' .powered-by a:hover {',
' color: #2980b9;',
' }',
' .powered-by a:hover {',
' color: #2980b9;',
' }',
' .powered-by {',
' color: #7f8c8d;',
' font-size: 0.9rem;',
' }',
' .powered-by {',
' color: #7f8c8d;',
' font-size: 0.9rem;',
' }',
' .powered-by a {',
' color: #3498db;',
' text-decoration: none;',
' transition: color 0.3s ease;',
' font-weight: 500;',
' }',
' .powered-by a {',
' color: #3498db;',
' text-decoration: none;',
' transition: color 0.3s ease;',
' font-weight: 500;',
' }',
' .powered-by a:hover {',
' color: #2980b9;',
' }',
' .powered-by a:hover {',
' color: #2980b9;',
' }',
' /* 输入控件组样式 */',
' .input-controls {',
' margin-top: 15px;',
' width: 100%;',
' }',
' /* 输入控件组样式 */',
' .input-controls {',
' margin-top: 15px;',
' width: 100%;',
' }',
' .button-group {',
' display: flex;',
' gap: 10px;',
' margin-top: 10px;',
' justify-content: center;',
' }',
' .button-group {',
' display: flex;',
' gap: 10px;',
' margin-top: 10px;',
' justify-content: center;',
' }',
' #urlInput {',
' width: 100%;',
' padding: 10px;',
' border: 1px solid #dcdde1;',
' border-radius: 8px;',
' resize: none;',
' font-size: 14px;',
' }',
' #urlInput {',
' width: 100%;',
' padding: 10px;',
' border: 1px solid #dcdde1;',
' border-radius: 8px;',
' resize: none;',
' font-size: 14px;',
' }',
' .github-link {',
' position: fixed;',
' right: 150px;',
' top: 20px;',
' background: #333;',
' color: white;',
' border: none;',
' padding: 10px;',
' border-radius: 50%;',
' cursor: pointer;',
' z-index: 1001;',
' width: 40px;',
' height: 40px;',
' display: flex;',
' align-items: center;',
' justify-content: center;',
' transition: background 0.3s ease;',
' }',
' .github-link {',
' position: fixed;',
' right: 150px;',
' top: 20px;',
' background: #333;',
' color: white;',
' border: none;',
' padding: 10px;',
' border-radius: 50%;',
' cursor: pointer;',
' z-index: 1001;',
' width: 40px;',
' height: 40px;',
' display: flex;',
' align-items: center;',
' justify-content: center;',
' transition: background 0.3s ease;',
' }',
' .github-link:hover {',
' background: #24292e;',
' }',
' .github-link:hover {',
' background: #24292e;',
' }',
' .github-icon {',
' width: 24px;',
' height: 24px;',
' }',
' .github-icon {',
' width: 24px;',
' height: 24px;',
' }',
' .cookie-input-container {',
' margin-bottom: 15px;',
' }',
' .cookie-input-container {',
' margin-bottom: 15px;',
' }',
' #cookieInput {',
' width: 100%;',
' padding: 12px;',
' border: 2px solid #e9ecef;',
' border-radius: 8px;',
' font-size: 0.95rem;',
' resize: vertical;',
' min-height: 120px;',
' font-family: monospace;',
' line-height: 1.4;',
' }',
' #cookieInput {',
' width: 100%;',
' padding: 12px;',
' border: 2px solid #e9ecef;',
' border-radius: 8px;',
' font-size: 0.95rem;',
' resize: vertical;',
' min-height: 120px;',
' font-family: monospace;',
' line-height: 1.4;',
' }',
' #cookieInput:focus {',
' outline: none;',
' border-color: #3498db;',
' }',
' #cookieInput:focus {',
' outline: none;',
' border-color: #3498db;',
' }',
' .cookie-info {',
' background: #f8f9fa;',
' padding: 12px;',
' border-radius: 8px;',
' margin-bottom: 15px;',
' }',
' .cookie-info {',
' background: #f8f9fa;',
' padding: 12px;',
' border-radius: 8px;',
' margin-bottom: 15px;',
' }',
' .cookie-info p {',
' margin: 0;',
' color: #2c3e50;',
' font-size: 0.9rem;',
' margin-bottom: 8px;', // 添加底部间距
' }',
' .cookie-info p {',
' margin: 0;',
' color: #2c3e50;',
' font-size: 0.9rem;',
' margin-bottom: 8px;', // 添加底部间距
' }',
' .cookie-info p:last-child {',
' margin-bottom: 0;', // 最后一个p元素不需要底部间距
' }',
' .cookie-info p:last-child {',
' margin-bottom: 0;', // 最后一个p元素不需要底部间距
' }',
' .token-expiry {',
' color: #7f8c8d;',
' font-size: 0.85rem;',
' }',
' .token-expiry {',
' color: #7f8c8d;',
' font-size: 0.85rem;',
' }',
' .token-expiry.expired {',
' color: #e74c3c;',
' }',
' .token-expiry.expired {',
' color: #e74c3c;',
' }',
' #currentTokenDisplay {',
' color: #3498db;',
' font-family: monospace;',
' word-break: break-all;',
' }',
' #currentTokenDisplay {',
' color: #3498db;',
' font-family: monospace;',
' word-break: break-all;',
' }',
// 添加获取cookie按钮样式
' .get-cookie-link {',
' position: fixed;',
' left: 150px;', // 放在github图标左边
' top: 22px;',
' background: #2ecc71;', // 使用不同的颜色区分
' color: white;',
' border: none;',
' padding: 8px 15px;',
' border-radius: 5px;',
' cursor: pointer;',
' z-index: 1001;',
' text-decoration: none;',
' font-size: 14px;',
' transition: background 0.3s ease;',
' }',
// 添加获取cookie按钮样式
' .get-cookie-link {',
' position: fixed;',
' left: 150px;', // 放在github图标左边
' top: 22px;',
' background: #2ecc71;', // 使用不同的颜色区分
' color: white;',
' border: none;',
' padding: 8px 15px;',
' border-radius: 5px;',
' cursor: pointer;',
' z-index: 1001;',
' text-decoration: none;',
' font-size: 14px;',
' transition: background 0.3s ease;',
' }',
' .get-cookie-link:hover {',
' background: #27ae60;',
' }',
' .get-cookie-link:hover {',
' background: #27ae60;',
' }',
' .advanced-mode-toggle {',
' display: flex;',
' align-items: center;',
' margin-bottom: 15px;',
' padding: 10px;',
' background: #f8f9fa;',
' border-radius: 8px;',
' }',
' .advanced-mode-toggle {',
' display: flex;',
' align-items: center;',
' margin-bottom: 15px;',
' padding: 10px;',
' background: #f8f9fa;',
' border-radius: 8px;',
' }',
' .advanced-mode-toggle input[type="checkbox"] {',
' margin-right: 10px;',
' }',
' .advanced-mode-toggle input[type="checkbox"] {',
' margin-right: 10px;',
' }',
' .prompt-container {',
' display: none;', // 默认隐藏
' margin-bottom: 15px;',
' }',
' .prompt-container {',
' display: none;', // 默认隐藏
' margin-bottom: 15px;',
' }',
' .prompt-container.show {',
' display: block;',
' }',
' .prompt-container.show {',
' display: block;',
' }',
' #promptInput {',
' width: 100%;',
' padding: 12px;',
' border: 2px solid #e9ecef;',
' border-radius: 8px;',
' font-size: 0.95rem;',
' resize: vertical;',
' min-height: 120px;',
' font-family: monospace;',
' line-height: 1.4;',
' }',
' #promptInput {',
' width: 100%;',
' padding: 12px;',
' border: 2px solid #e9ecef;',
' border-radius: 8px;',
' font-size: 0.95rem;',
' resize: vertical;',
' min-height: 120px;',
' font-family: monospace;',
' line-height: 1.4;',
' }',
' #promptInput:focus {',
' outline: none;',
' border-color: #3498db;',
' }',
' #promptInput:focus {',
' outline: none;',
' border-color: #3498db;',
' }',
'</style>',
'</head>',
'<body>',