Js逆向:批改网提交的文章如何自检验AI生成概率(官方接口)
依旧js逆向一个网站。
发现一些有关对文章检测的函数。
//checkGTP
function checkGTP2(str,cb){
let arr =str.replace(/\r/ig,'').replace(/\t{2}/ig,'').split("\n").filter( function(v){ return /[a-zA-Z]+/.test(v) });
let rz={info:[],total:{score:0}};
if(arr.length<=0 ){
cb(rz);
return ;
}
let data= JSON.stringify( arr);
$.ajax({
url:'/gpt8000/chatgpt/check',
data:data,
method:'POST',
contentType: 'application/json; charset=UTF-8',
success:function (d) {
//console.log('chatgpt',d );
let total=0;
rz.info= d.map(function(v2){
let v=v2[0];
if(v.label!='ChatGPT' ) return 0;
total+=parseInt(v.score*1000);
return parseInt(v.score*1000);
});
rz.total=total>0? parseInt( total/d.length):0;
cb( rz );
}
});
}
function checkGTPScore(eid,version,str ,cb ){
let t= getCheckGtpFromLocal( eid,version );
if(t>=0) {
cb(t, eid);
return ;
}
checkGTP2( str, function(d){
console.log("checkGTP", d , localStorage.getItem('g'+eid) ) ;
localStorage.setItem('g'+_eid, JSON.stringify( {vr: parseInt( version),v:d.total}) );
cb(d.total, eid);
});
}
function getCheckGtpFromLocal(eid,version){
//return -3;
let s =localStorage.getItem('g'+eid) ;
if(s===null) return -1;
let o = JSON.parse( s);
if(o.vr!= version)return -2;
return o.v ;
}
这里面的 checkGTP2 是有关
这个原生接口直接放在了前端js里面.
尝试console调用:
const testText = `Living in big cities like Guangzhou brings obvious drawbacks. First, daily commutes are exhausting. A white-collar worker in Guangzhou may take crowded subways or buses and spend over 1.5 hours traveling between home and office, sapping energy before the workday begins. Second, high living costs cause financial pressure. Renting a small studio in downtown Guangzhou often costs over 3,500 yuan monthly, accounting for nearly 40% of an average young professional’s income. Third, the fast-paced life leads to social isolation. Many Guangzhou residents are too busy with work and daily tasks to chat with neighbors, even after years of living in the same community. These facts prove big-city life, despite its opportunities, entails inevitable challenges.`
// 调用
checkGTP2(testText, function(result) {
console.log("AI检测结果:", result);
console.log("总分:", result.total);
console.log("详细信息:", result.info);
});
返回
AI检测结果: {info: Array(1), total: 0}
总分: 0
详细信息: [0]0: 0length: 1[[Prototype]]: Array(0)
这里给总分是零,可能是因为传参的text只有一个段落的问题。
为了验证接口有效性,我们对照处理。
选择一篇AI生成的四级范文做对照。
English is an integral part of global communication and knowledge exchange. Therefore, it should be a compulsory subject in universities.
With the world becoming more interconnected, the ability to communicate in English is crucial for students to engage with the international community. It opens up opportunities for studying abroad, participating in global research collaborations, and accessing a vast amount of information and resources.
Moreover, English is the language of science and technology, and many academic publications are written in English. Therefore, students who do not have a strong command of English may be at a disadvantage in their academic pursuits.
In conclusion, making English a mandatory subject in universities is essential for students to succeed in today's globalized world.
调用返回:
AI检测结果: {info: Array(4), total: 725}info: (4) [0, 999, 994, 909]total: 725[[Prototype]]: Object
总分: 725
详细信息: (4) [0, 999, 994, 909]
完整js:
const Text = `input ur english essay here`
// 调用
checkGTP2(Text, function(result) {
console.log("AI检测结果:", result);
console.log("总分:", result.total);
console.log("详细信息:", result.info);
});
只需要在http://pigai.org 这个域名下就可以调用。
这里的参数:
几组测试验证接口有效性
第一组(全篇)城市带来的挑战 AI生成 Doubao1.5 无思考
Living in big cities like Guangzhou undoubtedly brings numerous opportunities for career growth and personal development, but it also comes with obvious drawbacks that cannot be ignored.
First, daily commutes are often exhausting. As a major economic hub in southern China, Guangzhou’s urban area is sprawling, and public transportation can get extremely crowded during rush hours. A typical white-collar worker here may have to squeeze into packed subways or buses, spending over 1.5 hours traveling back and forth between home and the office. This long and tiring journey not only wastes precious time but also saps a lot of energy, leaving people feeling drained even before the workday officially begins.
Second, the high cost of living imposes significant financial pressure on residents. Housing expenses, in particular, are a heavy burden. Renting a small studio apartment in downtown areas like Tianhe or Yuexiu often costs over 3,500 yuan per month, and for many young professionals just starting their careers, this accounts for nearly 40% of their monthly income. Beyond rent, daily expenses such as food, transportation, and utility bills also add up, making it difficult for people to save money or enjoy a comfortable life without working overtime constantly.
Third, the fast-paced and stressful life in big cities often leads to social isolation. Most residents in Guangzhou are busy with work deadlines, project tasks, and daily chores, leaving little time for social interaction. Even neighbors living in the same community may pass each other without a word, and it’s common for people to go months without having a meaningful conversation with those around them. This lack of human connection can make people feel lonely and disconnected, affecting their mental health over time.
While Guangzhou’s vibrant economy, diverse culture, and convenient facilities attract countless people to settle down, these drawbacks—tiring commutes, high living costs, and social isolation—are inevitable parts of big-city life. For those considering moving to such a metropolis, it’s important to weigh the pros and cons carefully and prepare themselves for the challenges that come with this lifestyle.
调用返回:
AI检测结果: {info: Array(5), total: 502}
总分: 502
详细信息: (5) [0, 524, 987, 999, 0]
第二组(全篇)在第一组基础上降低难度到Cambridge PET词汇,并降低文章复杂度与篇幅
Living in big cities like Guangzhou has many good things, such as more jobs and fun activities. But it also has some clear problems that are hard to ignore.
First, traveling to work every day is tiring. Guangzhou is a busy city in southern China, and its subways and buses get very crowded during rush hours. Many office workers here spend over 1.5 hours on these crowded transport to go to work and come back home. This long trip wastes time and makes people feel tired even before they start working.
Second, living here is expensive, which brings a lot of financial stress. Housing costs are especially high. Renting a small studio flat in downtown areas like Tianhe or Yuexiu usually costs more than 3,500 yuan a month. For many young people who just start working, this takes up nearly 40% of their monthly salary. Besides rent, daily things like food, transport and utility bills also cost money. So it’s not easy for people to save money or live comfortably without working extra hours.
Third, the fast and busy life in big cities often makes people feel lonely. Most people in Guangzhou are busy with work, tasks and daily chores. They don’t have much time to meet friends or talk to others. Even neighbors living in the same community may not say hello when they pass by. It’s common for people to live in the same place for years but never have a real conversation with those around them. This lack of connection can make people feel sad and isolated.
Guangzhou is a lively city with many chances, so many people want to live here. But the tiring commutes, high living costs and feeling lonely are part of life in such a big city. If you are thinking about moving to a big city like Guangzhou, you should think carefully about the good and bad sides and get ready for these challenges.
调用返回:
AI检测结果: {info: Array(5), total: 733}
总分: 733
详细信息: (5) [999, 996, 0, 999, 671]
第三组 (全篇)城市带来的挑战 AI生成 deepseekV3.1 无思考
Cities have long been celebrated as engines of innovation, culture, and opportunity. They symbolize human progress, drawing people in with the promise of better education, careers, and a vibrant lifestyle. However, beneath the glittering skyline lies a complex web of challenges that test the resilience of their inhabitants. The very concentration of people and progress that defines a city also generates its most pressing difficulties, including the high cost of living, social isolation, and environmental strain.
First and foremost, the financial pressure of city life poses a significant hurdle, especially for young people and new residents. The demand for housing in desirable urban areas far exceeds the supply, leading to exorbitant rent and property prices. For a high school student like myself, witnessing this struggle is a sobering preview of adulthood. A simple coffee, a movie ticket, or a meal out often carries a "city premium," straining the budgets of students and families alike. This constant financial burden can overshadow the economic opportunities that cities are supposed to provide, forcing residents to make difficult trade-offs between their quality of life and their financial stability.
Furthermore, the fast-paced, densely populated nature of cities often breeds a paradoxical sense of isolation. In a crowd of millions, one can feel utterly alone. The "rush hour" mentality prioritizes efficiency over human connection, with commuters buried in their phones, avoiding eye contact. For teenagers, this can be particularly challenging. While we are more digitally connected than ever, genuine, face-to-face friendships can be harder to forge. The anonymity of the city can be liberating, but it can also lead to feelings of being lost in the crowd, where individual struggles go unnoticed in the relentless urban rhythm.
Finally, the environmental toll of urbanization is an inescapable challenge. Cities are major contributors to pollution, generating immense amounts of waste and greenhouse gases. The consequence is often poor air quality, which poses a direct threat to public health. Moreover, the "urban heat island" effect makes cities significantly warmer than their surrounding rural areas, exacerbating the discomfort during summer months. Replacing green spaces with concrete jungles not only harms local ecosystems but also deprives residents of vital areas for relaxation and recreation, impacting mental well-being.
In conclusion, while cities undeniably offer unparalleled opportunities, they are not without their serious drawbacks. The financial strain, the sense of social disconnection, and the environmental degradation are significant challenges that require thoughtful and innovative solutions. As the next generation poised to inherit these urban landscapes, it is our responsibility to acknowledge these issues. By striving for smarter urban planning, fostering stronger communities, and advocating for sustainable practices, we can work towards transforming our cities into not just centers of economic power, but truly livable and harmonious homes for all.
调用返回:
AI检测结果: {info: Array(5), total: 769}
总分: 769
详细信息: (5) [995, 0, 972, 894, 985]
第四组 老师推荐的精选文章 手写 机改90分 出国留学的好处
Studying abroad has many benefits. Firstly, it allows students to experience different cultures and meet people from diverse backgrounds. If a student always studies and lives in one place they can only experience one way of life. To most students,Studying abroad can be a new experience.
Secondly,Studying abroad can enhance students' language skills. Going to an unfamiliar country means you need to talk to the locals. In this process,students will master a language very well These experiences collectively foster personal growth and global awareness.
Finally These experiences not only enhance personal growth but also improve career prospects.
AI检测结果: {info: Array(3), total: 0}
总分: 0
详细信息: (3) [0, 0, 0]
总结
利用AI全段写成文,doubao检测AI得分几乎全是0,其余模型表现均不佳。
如果分段落,任何一种AI的段落几乎都会被检测为接近1000分的满分.
如果命令AI故意降低表达难度,可能得到更高的GPT检测得分,但同时也会得到更低的批改得分()
所以,如果作业是写段落,放心用。如果是全文,还是自己写为好。
如果你害怕老师因AI生成的作文而减少平时分,自行调用接口检测。
书签封装
javascript:(function(){
// 检查是否已存在弹窗,避免重复创建
if(document.getElementById('ai-detector-popup')) return;
// 创建弹窗容器
const popup = document.createElement('div');
popup.id = 'ai-detector-popup';
popup.style.cssText = `
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 5px 25px rgba(0,0,0,0.3);
z-index: 10000;
min-width: 400px;
max-width: 90vw;
max-height: 80vh;
overflow-y: auto;
font-family: Arial, sans-serif;
`;
// 创建遮罩层
const overlay = document.createElement('div');
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 9999;
`;
// 弹窗内容
popup.innerHTML = `
<h3 style="margin-top: 0; color: #333;">AI内容检测器</h3>
<textarea id="essay-input"
placeholder="请输入英文文章进行AI检测..."
style="width: 100%;
height: 200px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
resize: vertical;
font-family: inherit;
margin-bottom: 15px;"></textarea>
<div style="display: flex; justify-content: space-between; align-items: center;">
<button id="detect-btn" style="padding: 8px 16px; background: #007cba; color: white; border: none; border-radius: 5px; cursor: pointer;">开始检测</button>
<button id="close-btn" style="padding: 8px 16px; background: #ccc; color: #333; border: none; border-radius: 5px; cursor: pointer;">关闭</button>
</div>
<div id="loading" style="display: none; text-align: center; margin: 15px 0; color: #007cba;">
<p>正在检测中,请稍候...</p>
</div>
<div id="result" style="display: none; margin-top: 15px; padding: 15px; background: #f5f5f5; border-radius: 5px;"></div>
`;
// 添加到页面
document.body.appendChild(overlay);
document.body.appendChild(popup);
// 获取元素
const essayInput = document.getElementById('essay-input');
const detectBtn = document.getElementById('detect-btn');
const closeBtn = document.getElementById('close-btn');
const loading = document.getElementById('loading');
const resultDiv = document.getElementById('result');
// 关闭弹窗函数
function closePopup() {
document.body.removeChild(popup);
document.body.removeChild(overlay);
}
// 绑定关闭事件
closeBtn.addEventListener('click', closePopup);
overlay.addEventListener('click', closePopup);
// 检测函数
detectBtn.addEventListener('click', function() {
const text = essayInput.value.trim();
if (!text) {
alert('请输入要检测的英文文章!');
return;
}
// 显示加载中
loading.style.display = 'block';
resultDiv.style.display = 'none';
detectBtn.disabled = true;
// 保存原始console.log函数
const originalConsoleLog = console.log;
let detectionResult = null;
// 重写console.log来捕获结果
console.log = function(...args) {
originalConsoleLog.apply(console, args); // 保持原有功能
// 检查是否包含检测结果
args.forEach(arg => {
if (typeof arg === 'string' && arg.includes('AI检测结果:')) {
// 下一个log应该是结果对象
return;
}
if (arg && typeof arg === 'object' && arg.total !== undefined) {
detectionResult = arg;
}
});
};
try {
// 调用检测函数
checkGTP2(text, function(result) {
// 恢复原始console.log
console.log = originalConsoleLog;
// 隐藏加载中
loading.style.display = 'none';
detectBtn.disabled = false;
if (result) {
displayResult(result);
} else if (detectionResult) {
displayResult(detectionResult);
} else {
resultDiv.innerHTML = '<p style="color: red;">检测失败,请确保checkGTP2函数已定义</p>';
resultDiv.style.display = 'block';
}
});
} catch (error) {
// 恢复原始console.log
console.log = originalConsoleLog;
loading.style.display = 'none';
detectBtn.disabled = false;
resultDiv.innerHTML = `<p style="color: red;">检测出错:${error.message}</p>`;
resultDiv.style.display = 'block';
}
// 超时处理(30秒)
setTimeout(() => {
if (loading.style.display !== 'none') {
console.log = originalConsoleLog;
loading.style.display = 'none';
detectBtn.disabled = false;
resultDiv.innerHTML = '<p style="color: red;">检测超时,请重试</p>';
resultDiv.style.display = 'block';
}
}, 30000);
});
// 显示结果函数
function displayResult(result) {
let resultHTML = `
<h4 style="margin-top: 0; color: #333;">检测结果</h4>
<p><strong>总分:</strong>${result.total}</p>
`;
if (result.info) {
resultHTML += `<p><strong>详细信息:</strong>${JSON.stringify(result.info)}</p>`;
}
// 根据分数给出建议
let suggestion = '';
if (result.total < 0.3) {
suggestion = '<p style="color: green;">✅ 这篇文章很可能是人工创作的</p>';
} else if (result.total < 0.7) {
suggestion = '<p style="color: orange;">⚠️ 这篇文章可能包含AI生成内容</p>';
} else {
suggestion = '<p style="color: red;">🚨 这篇文章很可能是AI生成的</p>';
}
resultHTML += suggestion;
resultDiv.innerHTML = resultHTML;
resultDiv.style.display = 'block';
// 同时用alert显示主要信息
alert(`AI检测完成!\n总分:${result.total}\n详细信息:${JSON.stringify(result.info || '无')}`);
}
// 让输入框获得焦点
essayInput.focus();
})();
后期
有空闲时间测评一下市面上主流免费版的降AI,在这个接口中是否会降低GPT检测得分。以及一些提示词是否能真正实现降分。
收录于知乎专栏「js逆向实例」· 查看知乎原文