-
Notifications
You must be signed in to change notification settings - Fork 60.2k
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
Chat ahzmr #5341
Chat ahzmr #5341
Changes from all commits
648e600
93bfb55
621b148
eae593d
0a6ddda
b2336f5
fdb89af
0745b64
5c51fd2
31baa10
f1d69cb
2d68f17
0638db1
e8c7ac0
2bf72d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -270,3 +270,16 @@ export function isVisionModel(model: string) { | |||||||||||||||||||||||||||||||||||||||||||||
export function isDalle3(model: string) { | ||||||||||||||||||||||||||||||||||||||||||||||
return "dall-e-3" === model; | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
export function removeOutdatedEntries( | ||||||||||||||||||||||||||||||||||||||||||||||
timeMap: Record<string, number>, | ||||||||||||||||||||||||||||||||||||||||||||||
): Record<string, number> { | ||||||||||||||||||||||||||||||||||||||||||||||
const oneMonthAgo = Date.now() - 30 * 24 * 60 * 60 * 1000; | ||||||||||||||||||||||||||||||||||||||||||||||
// Delete data from a month ago | ||||||||||||||||||||||||||||||||||||||||||||||
Object.keys(timeMap).forEach((id) => { | ||||||||||||||||||||||||||||||||||||||||||||||
if (timeMap[id] < oneMonthAgo) { | ||||||||||||||||||||||||||||||||||||||||||||||
delete timeMap[id]; | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||
return timeMap; | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+274
to
+285
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review of The
Here's a suggested refactor to return a new object: -export function removeOutdatedEntries(timeMap: Record<string, number>): Record<string, number> {
+export function removeOutdatedEntries(timeMap: Record<string, number>): Record<string, number> {
const oneMonthAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
const newTimeMap = {...timeMap};
Object.keys(newTimeMap).forEach((id) => {
if (newTimeMap[id] < oneMonthAgo) {
delete newTimeMap[id];
}
});
return newTimeMap;
} This change ensures that the original Committable suggestion
Suggested change
|
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.
Refactor assignment within expression and improve code readability.
The new checkbox for enabling or disabling automatic synchronization is implemented correctly in terms of functionality. However, the static analysis tool flagged the use of an assignment within an expression in the
onChange
handler (line 369). This can lead to confusion and is generally considered bad practice as it can lead to side effects that are hard to track.Consider refactoring the code to separate the assignment from the expression to improve readability and maintainability.
Here's a suggested refactor:
Committable suggestion
Tools
Biome