repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -115,4 +127,14 @@ object EtherWarpHelper : Module(
smoothRotateTo(yaw, pitch, rotTime)
}
}
+
+ @SubscribeEvent
+ fun onSoundPacket(event: PacketReceivedEvent) {
+ with(event.packet) {
+ if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !soun... | what the fuck pt. 2 |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -16,13 +17,14 @@ import net.minecraft.tileentity.TileEntitySkull
import net.minecraft.util.BlockPos
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.concurrent.CopyOnWriteArrayList
import kotlin.math.ceil
import kotlin.math.floor... | remove this before i merge |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -107,14 +118,31 @@ object DungeonUtils {
var score = 0
score += cryptCount.coerceAtMost(5)
if (mimicKilled) score += 2
- if (isPaul) score += 10
+ if ((isPaul && togglePaul == 0) || togglePaul == 2) score += 10
return score
}
+ inline val bloodDone: Boolean... | all of these things should realistically not be in this class but its fine for now someone will refactor later |
Odin | github_2023 | others | 80 | odtheking | freebonsai | @@ -54,6 +55,17 @@ object ChocolateFactory : Module(
if (!isInChocolateFactory()) return@execute
if (clickFactory) windowClick(13, PlayerUtils.ClickType.Right)
+
+ if (claimStray) {
+ val container = mc.thePlayer.openContainer as? ContainerChest ?: return@execute
+ ... | use container.inventorySlots.find { // logic } instead |
Odin | github_2023 | others | 76 | odtheking | freebonsai | @@ -5,37 +5,31 @@ import me.odinmain.config.Config
import me.odinmain.features.impl.skyblock.ChatCommands.blacklist
import me.odinmain.utils.skyblock.modMessage
-val blacklistCommand = commodore("blacklist") {
- runs {
- modMessage("Usage:\n /blacklist <add/remove> <name>\n /blacklist <clear/list>")
- ... | fix capitilization in these messages |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -64,21 +74,92 @@ object DungeonWaypoints : Module(
val filled: Boolean,
val depth: Boolean,
val aabb: AxisAlignedBB,
- val title: String?
+ val title: String?,
+ val secret: Boolean,
+ var clicked: Boolean = false
)
override fun onKeybind() {
... | What is this? |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -64,21 +74,92 @@ object DungeonWaypoints : Module(
val filled: Boolean,
val depth: Boolean,
val aabb: AxisAlignedBB,
- val title: String?
+ val title: String?,
+ val secret: Boolean,
+ var clicked: Boolean = false
)
override fun onKeybind() {
... | these three events are so chaotic, try to either use something to merge the detection with secret chime, or atleast use the same logic as it |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -41,6 +43,7 @@ class Dungeon {
}
private fun getCurrentFloor() {
+ if (currentArea.isArea(Island.SinglePlayer)) { runCatching { floor = Floor.E } } | why runCatching? thats only needed for scoreboard substring functions |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -0,0 +1,59 @@
+package me.odinmain.features.impl.dungeon.dungeonwaypoints
+
+import me.odinmain.config.DungeonWaypointConfigCLAY
+import me.odinmain.events.impl.SecretPickupEvent
+import me.odinmain.features.impl.dungeon.dungeonwaypoints.DungeonWaypoints.glList
+import me.odinmain.features.impl.dungeon.dungeonwaypoi... | you could do .filter { //logic }.values instead of having to do (_, waypointsList) |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -0,0 +1,59 @@
+package me.odinmain.features.impl.dungeon.dungeonwaypoints
+
+import me.odinmain.config.DungeonWaypointConfigCLAY
+import me.odinmain.events.impl.SecretPickupEvent
+import me.odinmain.features.impl.dungeon.dungeonwaypoints.DungeonWaypoints.glList
+import me.odinmain.features.impl.dungeon.dungeonwaypoi... | could make this a function since its done a lot in DungeonWaypoints.kt too |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -43,6 +43,16 @@ object ClickedSecrets : Module(
}
}
+ @SubscribeEvent
+ fun onSecret(event: SecretPickupEvent.Interact) {
+ if ((DungeonUtils.inBoss && disableInBoss) || secrets.any{ it.pos == event.blockPos }) return | MISSING A SPACE OMG |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -1,24 +1,62 @@
package me.odinmain.events
import kotlinx.coroutines.*
+import me.odinmain.OdinMain.mc
import me.odinmain.events.impl.*
import me.odinmain.utils.*
import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils.inDungeons
+import me.odinmain.utils.skyblock.dungeon.D... | merge the if statements so there is only one with a return |
Odin | github_2023 | others | 78 | odtheking | freebonsai | @@ -1,24 +1,62 @@
package me.odinmain.events
import kotlinx.coroutines.*
+import me.odinmain.OdinMain.mc
import me.odinmain.events.impl.*
import me.odinmain.utils.*
import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils.inDungeons
+import me.odinmain.utils.skyblock.dungeon.D... | use with(event.packet) {} that gives you the packet as _this_ instead of it being a variable, this should be done other places in the mod too but here for now. |
Odin | github_2023 | others | 50 | odtheking | freebonsai | @@ -0,0 +1,52 @@
+package me.odinmain.commands.impl
+
+import me.odinmain.OdinMain.mc
+import me.odinmain.commands.commodore
+import me.odinmain.config.Config
+import me.odinmain.features.impl.skyblock.PetKeybinds.petList
+import me.odinmain.utils.skyblock.itemID
+import me.odinmain.utils.skyblock.modMessage
+import me... | just do this in the assignment of the variable |
Odin | github_2023 | others | 50 | odtheking | freebonsai | @@ -0,0 +1,52 @@
+package me.odinmain.commands.impl
+
+import me.odinmain.OdinMain.mc
+import me.odinmain.commands.commodore
+import me.odinmain.config.Config
+import me.odinmain.features.impl.skyblock.PetKeybinds.petList
+import me.odinmain.utils.skyblock.itemID
+import me.odinmain.utils.skyblock.modMessage
+import me... | again |
Odin | github_2023 | others | 50 | odtheking | freebonsai | @@ -0,0 +1,52 @@
+package me.odinmain.commands.impl
+
+import me.odinmain.OdinMain.mc
+import me.odinmain.commands.commodore
+import me.odinmain.config.Config
+import me.odinmain.features.impl.skyblock.PetKeybinds.petList
+import me.odinmain.utils.skyblock.itemID
+import me.odinmain.utils.skyblock.modMessage
+import me... | big P |
Odin | github_2023 | others | 50 | odtheking | freebonsai | @@ -29,6 +30,11 @@ object ItemsHighlight : Module(
}
private fun getEntityOutlineColor(entity: EntityItem): Color {
- return getRarity(entity.entityItem.lore)?.color ?: Color.WHITE
+ return if (!colorStyle) getRarity(entity.entityItem.lore)?.color ?: Color.WHITE
+ else if (entity.getDis... | do this in one line |
Odin | github_2023 | others | 50 | odtheking | freebonsai | @@ -0,0 +1,70 @@
+package me.odinmain.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.nam... | you sure this works, i would think the first part of the destructured is just the matched string, but if it works its fine |
Odin | github_2023 | others | 72 | odtheking | freebonsai | @@ -205,11 +206,17 @@ object BloodCamp : Module(
currVector.zCoord + speedVectors.zCoord * ping
)
- val boxOffset: Vec3 = Vec3((boxSize/2).unaryMinus(),1.5,(boxSize/2).unaryMinus())
- val pingAABB = AxisAlignedBB(boxSize,boxSize,boxSize, 0.0, 0.0, 0.0).offset(boxOff... | unaryminus is the same as just typing -(boxSize/2) |
Odin | github_2023 | others | 72 | odtheking | freebonsai | @@ -177,15 +178,15 @@ object BloodCamp : Module(
val ping = ServerUtils.averagePing
- forRender.filter { (entity) -> !entity.isDead }.forEach { (entity, data) ->
+ forRender.filter { (entity) -> !entity.isDead }.forEach { (entity, renderData) -> | just use it in the filter |
Odin | github_2023 | others | 72 | odtheking | freebonsai | @@ -177,15 +178,15 @@ object BloodCamp : Module(
val ping = ServerUtils.averagePing | why? |
Odin | github_2023 | others | 72 | odtheking | freebonsai | @@ -205,11 +206,17 @@ object BloodCamp : Module(
currVector.zCoord + speedVectors.zCoord * ping
)
- val boxOffset: Vec3 = Vec3((boxSize/2).unaryMinus(),1.5,(boxSize/2).unaryMinus())
- val pingAABB = AxisAlignedBB(boxSize,boxSize,boxSize, 0.0, 0.0, 0.0).offset(boxOff... | you should be able to just do .offset(boxOffset + renderEndPoint), there is an operator function in vecutils for it |
Odin | github_2023 | others | 72 | odtheking | freebonsai | @@ -205,11 +206,17 @@ object BloodCamp : Module(
currVector.zCoord + speedVectors.zCoord * ping
)
| cant you use your new function for the endPoint Vec3? |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -94,4 +135,65 @@ object ChocolateFactory : Module(
if (!cancelSound) return
if (event.name == "random.eat") event.result = null // This should cancel the sound event
}
+
+
+ private var currentDetectedEggs = arrayOfNulls<Egg>(3)
+
+ private enum class ChocolateEggs(
+ val texture:... | Use odin's onMessage system instead |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -94,4 +135,65 @@ object ChocolateFactory : Module(
if (!cancelSound) return
if (event.name == "random.eat") event.result = null // This should cancel the sound event
}
+
+
+ private var currentDetectedEggs = arrayOfNulls<Egg>(3)
+
+ private enum class ChocolateEggs(
+ val texture:... | You should filter the list instead of checking it while iterating over it
Also switch to foreach should look nicer |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -94,4 +135,65 @@ object ChocolateFactory : Module(
if (!cancelSound) return
if (event.name == "random.eat") event.result = null // This should cancel the sound event
}
+
+
+ private var currentDetectedEggs = arrayOfNulls<Egg>(3)
+
+ private enum class ChocolateEggs(
+ val texture:... | Using foreach should look nicer |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -94,4 +135,65 @@ object ChocolateFactory : Module(
if (!cancelSound) return
if (event.name == "random.eat") event.result = null // This should cancel the sound event
}
+
+
+ private var currentDetectedEggs = arrayOfNulls<Egg>(3)
+
+ private enum class ChocolateEggs(
+ val texture:... | you can lose the brackets here and have each outcome a oneliner |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -256,6 +256,12 @@ data object FlareTextures {
val sosFlareTexture = "ewogICJ0aW1lc3RhbXAiIDogMTY0NjY4NzM0NzQ4OSwKICAicHJvZmlsZUlkIiA6ICI0MWQzYWJjMmQ3NDk0MDBjOTA5MGQ1NDM0ZDAzODMxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNZWdha2xvb24iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICA... | Should mention where these values are used |
Odin | github_2023 | others | 60 | odtheking | odtheking | @@ -1,62 +1,103 @@
package me.odinclient.features.impl.skyblock
+import me.odinmain.events.impl.ChatPacketEvent
import me.odinmain.events.impl.GuiEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.set... | Should use ClickType from PlayerUtils insTead |
Odin | github_2023 | others | 46 | odtheking | freebonsai | @@ -0,0 +1,39 @@
+package me.odinmain.features.impl.skyblock
+
+import me.odinmain.OdinMain.onLegitVersion
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.BooleanSetting
+import me... | doesnt need to be a variable |
Odin | github_2023 | others | 46 | odtheking | freebonsai | @@ -0,0 +1,39 @@
+package me.odinmain.features.impl.skyblock
+
+import me.odinmain.OdinMain.onLegitVersion
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.BooleanSetting
+import me... | dont need {} |
Odin | github_2023 | others | 46 | odtheking | freebonsai | @@ -0,0 +1,39 @@
+package me.odinmain.features.impl.skyblock
+
+import me.odinmain.OdinMain.onLegitVersion
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.BooleanSetting
+import me... | again no need for variable |
Odin | github_2023 | others | 41 | odtheking | freebonsai | @@ -0,0 +1,86 @@
+package me.odinmain.features.impl.floor7.p3
+
+import me.odinmain.events.impl.ChatPacketEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.events.impl.ServerTickEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.i... | make one line if its this short, also if needs a space after it. |
Odin | github_2023 | others | 41 | odtheking | freebonsai | @@ -0,0 +1,86 @@
+package me.odinmain.features.impl.floor7.p3
+
+import me.odinmain.events.impl.ChatPacketEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.events.impl.ServerTickEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.i... | again, one line |
Odin | github_2023 | others | 41 | odtheking | freebonsai | @@ -0,0 +1,86 @@
+package me.odinmain.features.impl.floor7.p3
+
+import me.odinmain.events.impl.ChatPacketEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.events.impl.ServerTickEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.i... | space after if |
Odin | github_2023 | others | 41 | odtheking | freebonsai | @@ -0,0 +1,86 @@
+package me.odinmain.features.impl.floor7.p3
+
+import me.odinmain.events.impl.ChatPacketEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.events.impl.ServerTickEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.i... | editing the value of the current timer is cleaner than making a new object, if you did this every where you could make tickTime a val instead of a var too, which is cleaner imo.
tickTime.time = -1 |
Odin | github_2023 | others | 39 | odtheking | freebonsai | @@ -0,0 +1,57 @@
+package me.odinmain.features.impl.skyblock
+
+import me.odinmain.events.impl.ServerTickEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.HudSetting
+import me.odinmain.font.OdinFont
+import me.odinmain.ui.hud.HudElement
+import m... | Make these into else if's just because its cleaner, and that is the functionality you want from the code. |
Odin | github_2023 | others | 35 | odtheking | freebonsai | @@ -28,7 +34,19 @@ object DragonPriority {
PlayerUtils.alert("§${dragon.colorCode} ${dragon.name}")
}
- private fun sortPriority(spawningDragon: MutableList<WitherDragonsEnum>): WitherDragonsEnum {
+ /** fun tracerDragonPriority() { | Having the function here would be cleaner. |
Odin | github_2023 | others | 35 | odtheking | freebonsai | @@ -101,7 +101,8 @@ val devCommand = commodore("oddev") {
MinecraftForge.EVENT_BUS.post(ChatPacketEvent(str.string))
}
- literal("roomdata").runs {
+ /** | Not sure why this is commented out, add it back before merge. |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -108,7 +108,7 @@ val devCommand = commodore("oddev") {
val xPos = -185 + x * 32
val zPos = -185 + z * 32
val core = ScanUtils.getCore(xPos, zPos)
- val northPos = DungeonUtils.Vec2(xPos, zPos - 4)
+ val northPos = Vec2(xPos, zPos - 4) | Just remove this from the message, it's redundant as the scanning no longer uses rotation cores. |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -71,6 +71,7 @@ object DungeonWaypoints : Module(
fun onRender(event: RenderWorldLastEvent) {
DungeonUtils.currentRoom?.waypoints?.forEach {
Renderer.drawBox(it.toAABB(it.size), it.color, fillAlpha = if (it.filled) .8 else 0, depth = it.depth)
+ Renderer.drawStringInWorld(it.titl... | Replace ´it.title.toString()" with "it.title ?: "" ´
This removes the need for the function to replace "null" |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -102,9 +102,9 @@ object Renderer {
scale: Float = 0.03f,
shadow: Boolean = true
) {
- RenderUtils.drawStringInWorld(text, vec3, color, renderBlackBox, depth, scale, shadow)
+ RenderUtils.drawStringInWorld(text.replace("null"," "), vec3, color, renderBlackBox, depth, scale, sh... | Do my suggestion in DungeonWaypoints.kt and remove this change. |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -60,7 +85,68 @@ object DungeonWaypoints : Module(
}
private val debugWaypoint: Boolean by BooleanSetting("Debug Waypoint", false).withDependency { DevPlayers.isDev }
- data class DungeonWaypoint(val x: Double, val y: Double, val z: Double, val color: Color, val filled: Boolean, val depth: Boolean, val... | Make this an object instead of a class, you can still achieve the same result, look at TermSim objects if you need. |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -37,10 +41,30 @@ object DungeonWaypoints : Module(
tag = TagType.NEW
) {
private var allowEdits: Boolean by BooleanSetting("Allow Edits", false)
- private val color: Color by ColorSetting("Color", default = Color.GREEN, description = "The color of the next waypoint you place.", allowAlpha = true)
- ... | I see no need to expand these, it makes the code longer for no reason. |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -92,13 +179,42 @@ object DungeonWaypoints : Module(
DungeonWaypointConfig.waypoints.getOrPut(room.data.name) { mutableListOf() }
else
DungeonWaypointConfig.waypoints.getOrPut(room.core.toString()) { mutableListOf() }
-
- if (!waypoints.any { it.toVec3().equal(vec... | Do this in one line |
Odin | github_2023 | others | 37 | odtheking | freebonsai | @@ -107,5 +223,12 @@ object DungeonWaypoints : Module(
fun DungeonWaypoint.toVec3() = Vec3(x, y, z)
fun DungeonWaypoint.toBlockPos() = BlockPos(x, y, z)
- fun DungeonWaypoint.toAABB(size: Double) = AxisAlignedBB(x + .5 - (size/2), y + .5 - (size/2), z + .5 - (size/2), x + .5 + (size/2), y + .5 + (size/2)... | The expansion is fine here as they all line up and are very similar |
Odin | github_2023 | others | 165 | odtheking | gemini-code-assist[bot] | @@ -13,9 +13,11 @@ import me.odinmain.utils.render.Renderer
import me.odinmain.utils.skyblock.LocationUtils.currentDungeon
import me.odinmain.utils.skyblock.dungeon.DungeonUtils
import me.odinmain.utils.skyblock.getSkullValue
+import me.odinmain.utils.skyblock.modMessage | 
This import is not used. Consider removing it to keep the code clean. |
Odin | github_2023 | others | 165 | odtheking | gemini-code-assist[bot] | @@ -36,7 +38,7 @@ object Mimic : Module(
@SubscribeEvent
fun onEntityLeaveWorld(event: EntityLeaveWorldEvent) {
- if (DungeonUtils.inDungeons && event.entity is EntityZombie && event.entity.isChild && getSkullValue(event.entity).equals(MIMIC_TEXTURE)) mimicKilled()
+ if (DungeonUtils.inDungeon... | 
The `!event.entity.isEntityAlive` check seems redundant here. Since this is an `EntityLeaveWorldEvent` and the `LivingDeathEvent` already handles the death, the entity should already be considered dead. Consider removing this check for clarity and efficien... |
quackpipe | github_2023 | go | 40 | metrico | github-advanced-security[bot] | @@ -0,0 +1,147 @@
+package repository
+
+import (
+ "database/sql"
+ "fmt"
+ "os"
+ "path/filepath"
+ "quackpipe/config"
+ "quackpipe/merge/service"
+ "quackpipe/model"
+ "quackpipe/service/db"
+ "sync"
+ "time"
+)
+
+var conn *sql.DB
+
+var registry = make(map[string]*service.MergeTreeService)
+var mergeTicker *time.T... | ## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/5) |
quackpipe | github_2023 | go | 40 | metrico | github-advanced-security[bot] | @@ -0,0 +1,147 @@
+package repository
+
+import (
+ "database/sql"
+ "fmt"
+ "os"
+ "path/filepath"
+ "quackpipe/config"
+ "quackpipe/merge/service"
+ "quackpipe/model"
+ "quackpipe/service/db"
+ "sync"
+ "time"
+)
+
+var conn *sql.DB
+
+var registry = make(map[string]*service.MergeTreeService)
+var mergeTicker *time.T... | ## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/6) |
quackpipe | github_2023 | go | 40 | metrico | github-advanced-security[bot] | @@ -0,0 +1,546 @@
+package service
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/apache/arrow/go/v18/arrow"
+ "github.com/apache/arrow/go/v18/arrow/array"
+ "github.com/apache/arrow/go/v18/arrow/memory"
+ "github.com/apache/arrow/go/v18/parquet"
+ "github.com/apache/arrow/go/v18/parquet/pqarrow"
+ "github.co... | ## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/7) |
quackpipe | github_2023 | go | 40 | metrico | github-advanced-security[bot] | @@ -0,0 +1,546 @@
+package service
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/apache/arrow/go/v18/arrow"
+ "github.com/apache/arrow/go/v18/arrow/array"
+ "github.com/apache/arrow/go/v18/arrow/memory"
+ "github.com/apache/arrow/go/v18/parquet"
+ "github.com/apache/arrow/go/v18/parquet/pqarrow"
+ "github.co... | ## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/8) |
quackpipe | github_2023 | go | 27 | metrico | github-advanced-security[bot] | @@ -0,0 +1,53 @@
+package db
+
+import (
+ "context"
+ "database/sql"
+ "os"
+ "quackpipe/model"
+ "time"
+)
+
+func Quack(appFlags model.CommandLineFlags, query string, stdin bool, params string, hashdb string) (*sql.Rows, time.Duration, error) {
+ var err error
+ alias := *appFlags.Alias
+ motherduck, md := os.Lookup... | ## Database query built from user-controlled sources
This query depends on a [user-provided value](1).
This query depends on a [user-provided value](2).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/4) |
quackpipe | github_2023 | go | 27 | metrico | lmangani | @@ -31,7 +31,7 @@ func QueryOperation(flagInformation *model.CommandLineFlags, query string, r *ht
}
if len(query) == 0 {
- return "", errors.New("query length is empty") | This should be maintained. If the query parameter is provided empty an error should be returned. |
quackpipe | github_2023 | go | 27 | metrico | lmangani | @@ -0,0 +1,50 @@
+package root
+
+import (
+ "crypto/sha256"
+ "errors"
+ "fmt"
+ "net/http"
+ "quackpipe/model"
+ "quackpipe/service/db"
+ "quackpipe/utils"
+)
+
+func QueryOperation(flagInformation *model.CommandLineFlags, query string, r *http.Request, defaultPath string, defaultFormat string, defaultParams string) ... | The error should be maintained. If the query parameter is provided empty an error should be returned. |
quackpipe | github_2023 | go | 24 | metrico | github-advanced-security[bot] | @@ -54,15 +63,17 @@
defer db.Close()
if !stdin {
- check(db.Exec("LOAD httpfs; LOAD json; LOAD parquet;"))
+ check(db.ExecContext(context.Background(),"LOAD httpfs; LOAD json; LOAD parquet;"))
+ check(db.ExecContext(context.Background(),"SET autoinstall_known_extensions=1;"))
+ check(db.ExecContext(context.Ba... | ## Database query built from user-controlled sources
This query depends on a [user-provided value](1).
This query depends on a [user-provided value](2).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/3) |
quackpipe | github_2023 | go | 19 | metrico | github-advanced-security[bot] | @@ -1,361 +1,336 @@
package main
import (
- "bufio"
- "database/sql"
- _ "embed"
- "encoding/json"
- "flag"
- "fmt"
- "io/ioutil"
- "log"
- "net/http"
- "os"
- "regexp"
- "strings"
- "time"
-
- _ "github.com/marcboeker/go-duckdb" // load duckdb driver
+ "context"
+ "crypto/sha256"
+ "database/sql"
+ "en... | ## Database query built from user-controlled sources
This query depends on a [user-provided value](1).
[Show more details](https://github.com/metrico/quackpipe/security/code-scanning/2) |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | logancyang | @@ -80,3 +93,28 @@ export function turnOffPlus(): void {
new CopilotPlusExpiredModal(app).open();
}
}
+
+export async function getComposerSystemPrompt(): Promise<string> {
+ // Get the current system prompt
+ const currentSystemPrompt = getSystemPrompt();
+
+ // If we already have a cached composer prompt, ... | Should we persist this on disk just like how `/pdf4llm` cache works? Just need the simplest invalidation mechanism for now. Ideally we need every way possible to make it faster. |
obsidian-copilot | github_2023 | others | 1,315 | logancyang | zeroliu | @@ -98,12 +98,14 @@
"@radix-ui/react-switch": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.6",
"@tabler/icons-react": "^2.14.0",
+ "@types/diff": "^7.0.1", | this should be a dev dependency |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -194,4 +215,12 @@ export class BrevilabsClient {
async youtube4llm(url: string): Promise<Youtube4llmResponse> {
return this.makeRequest<Youtube4llmResponse>("/youtube4llm", { url });
}
+
+ async composerPrompt(): Promise<ComposerPromptResponse> {
+ return this.makeRequest<ComposerPromptResponse>("/com... | The latest brevilabs client changed makeRequest to return both data and error. The wrapper functions here need to handle the error too |
obsidian-copilot | github_2023 | others | 1,315 | logancyang | zeroliu | @@ -872,3 +896,125 @@ If your plugin does not need CSS, delete this file.
color: var(--text-error);
opacity: 1;
}
+
+/* Apply View Styles */
+.apply-view-container { | We already standardized styling to tailwindcss. All existing CSS class names only exist for legacy reasons. No changes should be introduced to tailwind.css in this PR. |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -203,6 +296,85 @@ const ChatSingleMessage: React.FC<ChatSingleMessageProps> = ({
"", // Empty string for sourcePath as we don't have a specific source file
componentRef.current
);
+
+ // Function to add apply buttons to code blocks
+ const addApplyButtonsToCodeBlocks = () => {
+ ... | interacting with the raw DOM element in the react component can be very error-prone. Is there any reason why it needed to be implemented this instead of relying on React functions? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,351 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | tokens like green-500, red-500, gray-300 are not valid tokens in our design system. We should use the ones configured in the design system. |
obsidian-copilot | github_2023 | others | 1,315 | logancyang | zeroliu | @@ -872,3 +896,125 @@ If your plugin does not need CSS, delete this file.
color: var(--text-error);
opacity: 1;
}
+
+/* Apply View Styles */
+.apply-view-container {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow: hidden;
+}
+
+.apply-view {
+ font-size: var(--font-text-size);
+ line... | We do not allow adding classnames like this. This breaks how we work with tailwindcss. There are existing tokens that work for the color that you need. I highly recommend take a close look at tailwind.config.js and follow tailwindcss styles. |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | is this function used somewhere? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | do we need this class? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | why `this.containerEl.children[1];`? Is this deterministic? what other children does the container element have? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | I don't see how this.state is set. `setState` is not called in this PR and it's not coming from constructor. |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | How would the UI enter this state? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | why do we need two flags to represent this value? is there a case where accepted and rejected can be same values? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -0,0 +1,297 @@
+import React, { useState, useEffect } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "./ui/button";
+import { Check, X as XIcon } from "lucide-rea... | can we apply the change directly in this view when a user accept or reject a block? It's not very clear after a user accepts and rejects the change and what's going to happen |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -80,3 +93,28 @@ export function turnOffPlus(): void {
new CopilotPlusExpiredModal(app).open();
}
}
+
+export async function getComposerSystemPrompt(): Promise<string> { | I suggest move anything composer related to its own file. `plusUtil` should only take care of plus user status checks |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -79,6 +85,100 @@ const ChatSingleMessage: React.FC<ChatSingleMessageProps> = ({
});
};
+ const handleApplyCode = useCallback( | I would also suggest create a custom hook and move this chunk of code to a separate module under composer. Making composer code more isolated from the core chat. |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -79,6 +85,100 @@ const ChatSingleMessage: React.FC<ChatSingleMessageProps> = ({
});
};
+ const handleApplyCode = useCallback(
+ async (path: string, code: string) => {
+ try {
+ // Get the file from the path
+ const file = app.vault.getAbstractFileByPath(path);
+
+ if (!file |... | ```suggestion
file,
originalContent,
newContent,
path,
``` |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | zeroliu | @@ -203,6 +303,32 @@ const ChatSingleMessage: React.FC<ChatSingleMessageProps> = ({
"", // Empty string for sourcePath as we don't have a specific source file
componentRef.current
);
+
+ // Process code blocks after rendering
+ const codeBlocks = contentRef.current.querySelectorAll("p... | is there any reason why we need to escape from react component tree here? |
obsidian-copilot | github_2023 | others | 1,315 | logancyang | zeroliu | @@ -432,26 +432,50 @@ If your plugin does not need CSS, delete this file.
.message-content pre .copy-code-button { | can you please help me understand why we need the changes in this file still? |
obsidian-copilot | github_2023 | typescript | 1,315 | logancyang | logancyang | @@ -0,0 +1,437 @@
+import React, { useState, useMemo, useRef } from "react";
+import { App, ItemView, TFile, WorkspaceLeaf, Notice } from "obsidian";
+import { createRoot } from "react-dom/client";
+import { diffLines, Change } from "diff";
+import { Button } from "../ui/button";
+import { Check, X as XIcon } from "luc... | Should this be removed |
obsidian-copilot | github_2023 | typescript | 1,145 | logancyang | logancyang | @@ -25,255 +40,189 @@ describe("Time Expression Tests", () => {
});
describe("Relative Time Ranges", () => {
- test("last X days", async () => {
- const result = await getTimeRangeMs("last 3 days");
- expect(result).toBeDefined();
- const startDate = DateTime.fromMillis(result!.startTime.epoch... | Why is this removed? Seems no new tests are covering every month name like this. We must make sure all the month names and their abbr are working. |
obsidian-copilot | github_2023 | typescript | 1,316 | logancyang | logancyang | @@ -0,0 +1,137 @@
+import { InlineEditCommandSettings } from "@/settings/model";
+
+export const SELECTED_TEXT_PLACEHOLDER = "{copilot-selection}";
+export const COMMAND_NAME_MAX_LENGTH = 50;
+
+export const DEFAULT_INLINE_EDIT_COMMANDS: InlineEditCommandSettings[] = [
+ {
+ name: "Fix grammar and spelling",
+ p... | This is great. However, any default settings change must make sure it gets reflected without a setting reset. Right now, the prev setting didn't have this entry in the `inlineEditCommands`, so any change here won't show up without a setting reset.
<img width="366" alt="SCR-20250303-kvum" src="https://github.com/user... |
obsidian-copilot | github_2023 | typescript | 1,303 | logancyang | logancyang | @@ -119,7 +119,7 @@ export default class ChatModelManager {
customModel.azureOpenAIApiDeploymentName || settings.azureOpenAIApiDeploymentName,
openAIApiKey: await getDecryptedKey(customModel.apiKey || settings.azureOpenAIApiKey),
configuration: {
- baseURL: `https://copilot-experim... | lol, what did i do |
obsidian-copilot | github_2023 | typescript | 1,261 | logancyang | logancyang | @@ -75,86 +89,209 @@ function getInclusionPatterns(): string[] {
if (!getSettings().qaInclusions) {
return [];
}
- const inclusions: string[] = [];
- inclusions.push(
- ...getSettings()
- .qaInclusions.split(",")
- .map((item) => item.trim())
- );
- return inclusions;
+ return getDecodedP... | Is this check correct? `exclusions` and `inclusions` now exist even when the properties are all empty arrays. Now running "force re-index" with nothing in inclusion shows "0 file to index". |
obsidian-copilot | github_2023 | typescript | 1,243 | logancyang | logancyang | @@ -165,8 +165,6 @@ export const ModelAddDialog: React.FC<ModelAddDialogProps> = ({
if (!isEmbeddingModel) {
return {
...baseModel,
- temperature: 0.1,
- context: 1000, | What is this "context" that was added in the new settings UI in aiParams? Missed it before. |
obsidian-copilot | github_2023 | typescript | 1,225 | logancyang | logancyang | @@ -52,46 +63,152 @@ export const ModelEditDialog: React.FC<ModelEditDialogProps> = ({
</DialogHeader>
<div className="space-y-6">
- <div className="space-y-3">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- ... | Should these be removed? |
obsidian-copilot | github_2023 | typescript | 1,225 | logancyang | logancyang | @@ -338,6 +340,12 @@ export const ProviderSettingsKeyMap: Record<DisplayKeyProviders, keyof CopilotSe
"copilot-plus": "plusLicenseKey",
};
+export const MODEL_CAPABILITIES: Record<ModelCapability, string> = {
+ reasoning: "This model supports general reasoning tasks.",
+ vision: "This model supports visual reco... | Just say it supports "image inputs" |
obsidian-copilot | github_2023 | typescript | 1,225 | logancyang | logancyang | @@ -77,6 +77,7 @@ export const BUILTIN_CHAT_MODELS: CustomModel[] = [
enabled: true,
isBuiltIn: true,
core: true,
+ capabilities: ["vision"], | The other builtin models should also be updated accordingly. |
obsidian-copilot | github_2023 | typescript | 1,225 | logancyang | logancyang | @@ -121,6 +134,7 @@ export const BUILTIN_CHAT_MODELS: CustomModel[] = [
provider: ChatModelProviders.ANTHROPIC,
enabled: true,
isBuiltIn: true,
+ capabilities: [ModelCapability.VISION], | Haiku doesn't support image, does it? |
obsidian-copilot | github_2023 | typescript | 1,207 | logancyang | logancyang | @@ -483,24 +486,59 @@ const ChatInput = forwardRef<{ focus: () => void }, ChatInputProps>(
<DropdownMenu open={isModelDropdownOpen} onOpenChange={setIsModelDropdownOpen}>
<DropdownMenuTrigger asChild>
<Button variant="ghost2" size="fit">
- {settings.activeMo... | Can there be a case where there's no lastValidModel? |
obsidian-copilot | github_2023 | typescript | 1,207 | logancyang | logancyang | @@ -158,6 +160,21 @@ const BasicSettings: React.FC<BasicSettingsProps> = ({ indexVaultToVectorStore }
description="Select the Chat model to use"
value={settings.defaultModelKey}
onChange={(value) => {
+ const selectedModel = settings.activeModels.find(
+ ... | This code is duplicated as in the other file. Can be reused as a util. Something to follow up on. |
obsidian-copilot | github_2023 | typescript | 1,153 | logancyang | logancyang | @@ -13,7 +13,7 @@ export const DEFAULT_SYSTEM_PROMPT = `You are Obsidian Copilot, a helpful assist
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context. If there's no relevant inform... | Have you tested this? Does it work for you? I don't see how the model can get the `url` from anywhere. |
obsidian-copilot | github_2023 | typescript | 1,153 | logancyang | logancyang | @@ -13,7 +13,7 @@ export const DEFAULT_SYSTEM_PROMPT = `You are Obsidian Copilot, a helpful assist
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context. If there's no relevant inform... | Again, have you tested this? Can you please show an example with this system prompt, what does it really return in the response. |
obsidian-copilot | github_2023 | typescript | 1,059 | logancyang | logancyang | @@ -502,6 +502,7 @@ export const DEFAULT_SETTINGS: CopilotSettings = {
numPartitions: 1,
enabledCommands: {},
promptUsageTimestamps: {},
+ defaultConversationNoteName: "{$date}_{$time}__{$topic}", | We should use a backward-compatible pattern, right now it is `{$topic}@{$date}_{$time}`. |
obsidian-copilot | github_2023 | typescript | 1,160 | logancyang | logancyang | @@ -0,0 +1,102 @@
+import { ChainType } from "@/chainFactory";
+import {
+ ChatModelProviders,
+ ChatModels,
+ DEFAULT_SETTINGS,
+ EmbeddingModelProviders,
+ EmbeddingModels,
+ PlusUtmMedium,
+} from "@/constants";
+import { BrevilabsClient } from "@/LLMProviders/brevilabsClient";
+import { getSettings, setSettin... | Should this be `isPlusUser !== true`? Right now this welcome modal is not showing up for new users (undefined). |
obsidian-copilot | github_2023 | typescript | 1,148 | logancyang | logancyang | @@ -82,49 +82,60 @@ export const getNotesFromPath = async (vault: Vault, path: string): Promise<TFil
});
};
-export async function getTagsFromNote(file: TFile, vault: Vault): Promise<string[]> {
- const fileContent = await vault.cachedRead(file);
- // Check if the file starts with frontmatter delimiter
- if (f... | This is now returning both inline and frontmatter tags, while before it only returns frontmatter tags.
The reason I only get frontmatter tags is to
1. Limit the number of notes from tags for custom prompt templating {#tag1, #tags2...} and avoiding overcrowding the context window
2. Have a differentiation betwe... |
obsidian-copilot | github_2023 | typescript | 904 | logancyang | logancyang | @@ -73,6 +67,7 @@ export interface CustomModel {
isBuiltIn?: boolean;
enableCors?: boolean;
core?: boolean;
+ azureOpenAIApiDeploymentName?: string; // Added for Azure OpenAI models | Isn't this the same as the one above? |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | logancyang | @@ -337,8 +339,13 @@ export default class ChatModelManager {
);
return true;
} catch (error) {
- console.error("Chat model ping failed:", error);
- throw error;
+ const msg =
+ "\nwithout CORS Error: " +
+ err2String(firstError) +
+ "\nwith CORS E... | Nit: keep or remove? |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | logancyang | @@ -73,6 +73,17 @@ export interface CustomModel {
isBuiltIn?: boolean;
enableCors?: boolean;
core?: boolean;
+ stream?: boolean;
+ temperature?: number;
+ context?: number; | What is `context`? I assume you mean `maxToken`? |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | logancyang | @@ -44,6 +45,10 @@ export class CopilotSettingTab extends PluginSettingTab {
const div = containerEl.createDiv("div");
const sections = createRoot(div);
+ if (!Platform.isMobile) {
+ sections.render(<SettingsMainV2 plugin={this.plugin} />);
+ return;
+ } | Does this mean mobile is still using the old settings? Do we plan to update mobile too in the future? |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | zeroliu | @@ -0,0 +1,36 @@
+import React, { createContext, useContext, useEffect, useState } from "react";
+
+interface TabContextType {
+ selectedTab: string;
+ setSelectedTab: (tab: string) => void;
+ modalContainer: HTMLElement | null;
+}
+
+const TabContext = createContext<TabContextType | undefined>(undefined);
+
+export... | there is an eslint error here. Also what's the reason for this effect? |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | zeroliu | @@ -0,0 +1,211 @@
+import React, { useState, useEffect } from "react";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Loader2 } from "lucide-react";
+import { PasswordInput } from... | please fix the dependency |
obsidian-copilot | github_2023 | typescript | 955 | logancyang | zeroliu | @@ -0,0 +1,211 @@
+import React, { useState, useEffect } from "react";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Loader2 } from "lucide-react";
+import { PasswordInput } from... | why can't this happen when the dialog closes too? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.