-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev Merge to Main #3476
base: main
Are you sure you want to change the base?
Dev Merge to Main #3476
Conversation
Signed-off-by: root <[email protected]>
Signed-off-by: root <[email protected]>
Signed-off-by: root <[email protected]>
Signed-off-by: ykai2 <[email protected]>
Signed-off-by: ykai2 <[email protected]>
2. Rename the modified file. Signed-off-by: ykai2 <[email protected]>
Signed-off-by: ykai2 <[email protected]>
Signed-off-by: ykai2 <[email protected]>
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
|
||
async handleGuestLogin(req: express.Request, res: express.Response) { | ||
return this.authUtils.withErrorHandling(req, res, async () => { | ||
var userId = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead.
var userId = null; | |
let userId = null; |
} | ||
console.log("handleBnbQuery symbol: " + coinsymbol); | ||
const runtime = await this.authUtils.getRuntime(req.params.agentId); | ||
let userId = "blank"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'userId' is never reassigned. Use 'const' instead.
let userId = "blank"; | |
const userId = "blank"; |
} | ||
console.log("handleArenaQuery, kolname: " + kolname); | ||
const runtime = await this.authUtils.getRuntime(req.params.agentId); | ||
let userId = "blank"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'userId' is never reassigned. Use 'const' instead.
let userId = "blank"; | |
const userId = "blank"; |
// const userManager = new UserManager(this.runtime.cacheManager); | ||
const userProfiles = await this.userManager.getAllUserProfiles(); | ||
for (let i = 0; i < userProfiles.length; i++) { | ||
let userProfile = userProfiles[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'userProfile' is never reassigned. Use 'const' instead.
let userProfile = userProfiles[i]; | |
const userProfile = userProfiles[i]; |
userProfile.tweetFrequency.lastTweetTime = Date.now(); | ||
this.userManager.saveUserData(userProfile); | ||
try { | ||
let tweet = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'tweet' is never reassigned. Use 'const' instead.
let tweet = | |
const tweet = |
watcherCompletionFooter; | ||
//console.log("generateText for db, before: " + prompt); | ||
|
||
let response = await generateText({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'response' is never reassigned. Use 'const' instead.
let response = await generateText({ | |
const response = await generateText({ |
const prompt = this.generatePrompt(profile.agentCfg?.imitate, part2); | ||
// console.log("Watcher reTweet Part4: prompt: ", prompt); | ||
|
||
let responseStr = await generateText({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'responseStr' is never reassigned. Use 'const' instead.
let responseStr = await generateText({ | |
const responseStr = await generateText({ |
"sendTweet in share Part5: responseStr: ", | ||
responseStr | ||
); | ||
let responseObj = JSON.parse(responseStr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'responseObj' is never reassigned. Use 'const' instead.
let responseObj = JSON.parse(responseStr); | |
const responseObj = JSON.parse(responseStr); |
|
||
const { resultText } = responseObj; | ||
console.log("sendTweet in share Part7: resultText: ", resultText); | ||
let finalResult = part1 + ":" + resultText + "\n\n" + part3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'finalResult' is never reassigned. Use 'const' instead.
let finalResult = part1 + ":" + resultText + "\n\n" + part3; | |
const finalResult = part1 + ":" + resultText + "\n\n" + part3; |
// Login with v2 | ||
const profile = JSON.parse(cached); | ||
if (profile && profile.tweetProfile.accessToken) { | ||
let twitterClient = await this.getTwitterClient( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'twitterClient' is never reassigned. Use 'const' instead.
let twitterClient = await this.getTwitterClient( | |
const twitterClient = await this.getTwitterClient( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BitPodAI! Welcome to the elizaOS community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now an elizaOS contributor!
this.app.use(cors()); | ||
this.app.use(parseToken); |
Check failure
Code scanning / CodeQL
Missing rate limiting
} | ||
let memos: any = | ||
(await runtime.cacheManager.get(`${userId}-memos`)) ?? []; | ||
memos = memos.filter((memo: any) => !ids.includes(memo.id)); |
Check failure
Code scanning / CodeQL
Type confusion through parameter tampering
this.handleTwitterOauthInit.bind(this) | ||
); | ||
app.get( | ||
"/:agentId/twitter_oauth_callback", |
Check failure
Code scanning / CodeQL
Missing rate limiting
requireAuth, | ||
memoController.handleAddMemo.bind(memoController) | ||
); | ||
app.delete( |
Check failure
Code scanning / CodeQL
Missing rate limiting
}; | ||
await this.handleGrowthExperience(20, userProfile, "twitter auth"); | ||
await userManager.saveUserData(userProfile); | ||
|
||
//return { accessToken }; | ||
res.send(` | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>FungIPle</title> | ||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTczIiBoZWlnaHQ9IjE2MyIgdmlld0JveD0iMCAwIDE3MyAxNjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0wIDEwNi44OUgxOS4yMDM1TDE5LjIzMzYgNzcuNDYwOUgwLjAzMDA3NkwwIDEwNi44OVoiIGZpbGw9IiNGRjk5MDAiLz4KPHBhdGggZD0iTTE3Mi45NTIgMjkuNDI5NUwxNzIuOTY3IDE5LjcxNDlDMTcyLjk2NyA5LjUxOTA5IDE2My4yNjggMCAxNTIuODYyIDBIODMuNzkyMkg4MS43OTIxSDc0LjQzODZINzMuOTQyM1YwLjAxNTAzODFDNjAuMDQ3MiAwLjI0MDYwOSA1MC4wOTIxIDEwLjEzNTcgNTAuMDc3IDIzLjg1MDRMNTAuMDE2OSA3Ny40NjExSDI5LjU2NTJMMjkuNTM1MiAxMDYuODkxSDQ5Ljk4NjhMNDkuOTI2NyAxNjIuNjIySDgzLjY4NjlMODMuNzQ3MSAxMDYuODkxSDgzLjc3NzJIMTQ4LjUzMUMxNjIuNjgxIDEwNi44OTEgMTcyLjg3NyA5Ni45MDUzIDE3Mi44OTIgODMuMDQwMkwxNzIuOTM3IDQxLjQ2NzJIMTM5LjE3N0wxMzkuMTMyIDc3LjQ2MTFIODMuNzkyMlYyOS40Mjk1SDEzOS4xOTJIMTcyLjk1MloiIGZpbGw9IiNGRjk5MDAiLz4KPC9zdmc+Cg=="> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
.container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100vw; | ||
} | ||
.ad_img { | ||
max-width: 1000px; | ||
width: 100%; | ||
height: auto; | ||
} | ||
@media only screen and (max-width: 670px) { | ||
.ad_img { | ||
max-width: 660px; | ||
width: 100%; | ||
height: auto; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div style="text-align: center; font-size: 20px; font-weight: bold;"> | ||
<h1>FungIPle Agent</h1> | ||
<br>Login Success!<br> | ||
<script type="text/javascript"> | ||
console.log('window.opener'); | ||
console.log(window.opener); | ||
function closeWindow() { | ||
console.log('closeWindow'); | ||
try { | ||
window.opener.postMessage({ | ||
type: 'TWITTER_AUTH_SUCCESS', | ||
code: '${code}', | ||
username: '${username}', | ||
accessToken: '${accessToken}', | ||
refreshToken: '${refreshToken}', | ||
expiresIn: '${expiresIn}', | ||
state: '${state}' | ||
}, | ||
'*' | ||
); | ||
window.close(); | ||
} catch(e) { | ||
console.log(e); | ||
} | ||
} | ||
</script> | ||
<button style="text-align: center; width: 40%; height: 40px; font-size: 20px; background-color: #9F91ED; color: #ffffff; margin: 20px; border: none; border-radius: 10px;" | ||
onclick="closeWindow()"> | ||
Click to Close</button> | ||
<br> | ||
</div> | ||
<div class="container"> | ||
<img style="max-width: 40%; width: 40%; height: auto;" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTczIiBoZWlnaHQ9IjE2MyIgdmlld0JveD0iMCAwIDE3MyAxNjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0wIDEwNi44OUgxOS4yMDM1TDE5LjIzMzYgNzcuNDYwOUgwLjAzMDA3NkwwIDEwNi44OVoiIGZpbGw9IiNGRjk5MDAiLz4KPHBhdGggZD0iTTE3Mi45NTIgMjkuNDI5NUwxNzIuOTY3IDE5LjcxNDlDMTcyLjk2NyA5LjUxOTA5IDE2My4yNjggMCAxNTIuODYyIDBIODMuNzkyMkg4MS43OTIxSDc0LjQzODZINzMuOTQyM1YwLjAxNTAzODFDNjAuMDQ3MiAwLjI0MDYwOSA1MC4wOTIxIDEwLjEzNTcgNTAuMDc3IDIzLjg1MDRMNTAuMDE2OSA3Ny40NjExSDI5LjU2NTJMMjkuNTM1MiAxMDYuODkxSDQ5Ljk4NjhMNDkuOTI2NyAxNjIuNjIySDgzLjY4NjlMODMuNzQ3MSAxMDYuODkxSDgzLjc3NzJIMTQ4LjUzMUMxNjIuNjgxIDEwNi44OTEgMTcyLjg3NyA5Ni45MDUzIDE3Mi44OTIgODMuMDQwMkwxNzIuOTM3IDQxLjQ2NzJIMTM5LjE3N0wxMzkuMTMyIDc3LjQ2MTFIODMuNzkyMlYyOS40Mjk1SDEzOS4xOTJIMTcyLjk1MloiIGZpbGw9IiNGRjk5MDAiLz4KPC9zdmc+Cg=="> | ||
</div> | ||
|
||
<div> |
Check failure
Code scanning / CodeQL
Reflected cross-site scripting
let output = `**Token Data**\n`; | ||
output += `Token: ${token}\n\n`; | ||
token = token.replace('@', ''); | ||
token = token.replace('$', ''); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Relates to
Risks
Background
What does this PR do?
What kind of change is this?
Documentation changes needed?
Testing
Where should a reviewer start?
Detailed testing steps