Last active
July 19, 2025 09:36
-
-
Save NyaMisty/850f6b126d7425a71a1d4d35f29a094a to your computer and use it in GitHub Desktop.
Make Trae automatically "continue"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tested on Trae v2.0.1 20250719 | |
// Trae 全自动继续 (Trae Full Auto) | |
// will only continues ("继续") if it detects "模型思考次数已达上限" | |
// paste the code in Trae's developer tool console | |
window.$ = $ | |
clearInterval(window.autoContinue) | |
window.autoContinue = setInterval(function() { | |
var continueText = '继续' | |
var lastMsg = $('#mc-agent-content-container > div > div > div:last-child > section > div.agent-error-wrap') | |
if (lastMsg && lastMsg.innerText.startsWith('模型思考次数已达上限') || lastMsg.innerText.startsWith('输出过长') || lastMsg.innerText.startsWith('模型响应超时')) { | |
console.log('not finished, need more!') | |
let editor = $('div.chat-input-v2-input-box-editable') | |
editor.focus() | |
let evt = new InputEvent('input', { inputType: 'insertText', data: continueText, isComposing: false, bubbles: true, cancelable: false }) | |
editor.dispatchEvent(evt) | |
var button = $('div.chat-input-v2-editor-part-lower__right > button.chat-input-v2-send-button') | |
setTimeout(function() { | |
button.click() | |
}, 300) | |
} else { | |
//console.log('finished!') | |
} | |
}, 5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修复trae历史记录过长导致的oom oom
在trae的index.js搜索所有的e.messages引用可以找到两处增加数据的地方,一处是
另一处通过
messages.{0,4}concat
正则搜索可以找到在r.appendToSession中下断点在e.addTurn之后,在devtool中按Ctrl-R,等到断点断下后,执行替换掉addTurn