This commit is contained in:
恍兮惚兮 2024-07-22 20:36:47 +08:00
parent 674b4c232c
commit 568b5eee66
4 changed files with 72 additions and 4 deletions

View File

@ -10,9 +10,6 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="icon" href="https://image.lunatranslator.xyz/luna.ico" type="image/x-icon">
<link rel="stylesheet" href="https://unpkg.com/docsify-themeable/dist/css/theme-simple.css" />
<link href="//unpkg.com/prismjs/plugins/line-numbers/prism-line-numbers.css" rel="stylesheet" />
<link rel="stylesheet" href="https://unpkg.com/docsify-themeable/dist/css/theme-simple.css" />
<link href="//unpkg.com/prismjs/plugins/line-numbers/prism-line-numbers.css" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />

View File

@ -65,6 +65,69 @@ window.$docsify = {
});
})
},
function (hook, vm) {
hook.doneEach(() => {
var toupiao = document.getElementById('toupiao')
if (toupiao == null) return
fetch('https://lunatranslator.xyz/toupiao_query?toupiao=1&toupiao=2&toupiao=3&toupiao=4&toupiao=5&toupiao=6&toupiao=7&toupiao=8&toupiao=9&toupiao=10').then(
(_) => {
return _.json()
}
)
.then((res) => {
var averages = []
for (let idx = 0; idx < 10; idx++) {
const values = res[idx]
var average = 0;
if (values.length) {
const sum = values.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
average = sum / values.length;
}
const names = ["DeepSeek", "阿里云百炼大模型", "字节跳动豆包大模型", "月之暗面", "智谱AI", "零一万物", "硅基流动", "讯飞星火大模型", "腾讯混元大模型", "百度千帆大模型"]
averages.push({ average: average, name: names[idx], idx: idx })
}
averages.sort((a, b) => b.average - a.average)
for (let idx = 0; idx < 10; idx++) {
let item = averages[idx]
toupiao.innerHTML += `
<tr><td>${item.name}</td><td>${item.average}</td>
<td><input type="radio" name="rate-${item.idx}" id="rate-${item.idx}-1">
<input type="radio" name="rate-${item.idx}" id="rate-${item.idx}-2">
<input type="radio" name="rate-${item.idx}" id="rate-${item.idx}-3">
<input type="radio" name="rate-${item.idx}" id="rate-${item.idx}-4">
<input type="radio" name="rate-${item.idx}" id="rate-${item.idx}-5">
</td></tr>
`
}
for (let i = 0; i < 10; i++) {
const values = res[i]
var average = 0;
if (values.length) {
const sum = values.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
average = sum / values.length;
}
var value = Math.floor(average)
if (value == 0) value = 1;
document.querySelector(`#rate-${i}-${value}`).checked = true
for (let ii = 0; ii < 5; ii += 1) {
document.querySelector(`#rate-${i}-${ii + 1}`).addEventListener('click', function () {
window.open(`https://lunatranslator.xyz/toupiao_set?toupiao=${1 + Number(this.id.split('-')[1])}&value=${Number(this.id.split('-')[2])}`, '_blank');
})
}
}
})
})
},
]
}

1
docs/test.bat Normal file
View File

@ -0,0 +1 @@
python -m http.server

View File

@ -82,4 +82,11 @@
![img](https://image.lunatranslator.xyz/zh/damoxing/qianfan2.png)
<!-- tabs:end -->
<!-- tabs:end -->
<details>
<summary>翻译效果</summary>
<table id="toupiao">
</table>
</details>