Skip to content
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

1.8.3 #198

Merged
merged 1 commit into from
Nov 4, 2024
Merged

1.8.3 #198

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ tokens
html-games.iml
*.iml
test-recordings/
*.index.data
*.parsed.json
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {

val jetty_version = "11.0.24"
val slf4j_version = "2.0.16"
val skyenet_version = "1.2.14"
val skyenet_version = "1.2.16"
val remoterobot_version = "0.11.23"
val jackson_version = "2.17.2"

Expand All @@ -37,13 +37,15 @@ dependencies {
implementation("software.amazon.awssdk:bedrockruntime:2.25.9")
implementation("software.amazon.awssdk:s3:2.25.9")
implementation("software.amazon.awssdk:kms:2.25.9")
implementation("software.amazon.awssdk:sso:2.25.9")
implementation("software.amazon.awssdk:ssooidc:2.25.9")

implementation("org.apache.commons:commons-text:1.11.0")
implementation(group = "com.vladsch.flexmark", name = "flexmark", version = "0.64.8")
implementation("com.googlecode.java-diff-utils:diffutils:1.3.0")
implementation(group = "org.apache.httpcomponents.client5", name = "httpclient5", version = "5.2.3")

implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.11")
implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.12")
implementation(group = "com.simiacryptus.skyenet", name = "kotlin", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginName=intellij-aicoder
pluginRepositoryUrl=https://github.com/SimiaCryptus/intellij-aicoder
pluginVersion=1.8.2
pluginVersion=1.8.3
jvmArgs=-Xmx8g
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package com.github.simiacryptus.aicoder.actions.knowledge

import com.github.simiacryptus.aicoder.AppServer
import com.github.simiacryptus.aicoder.actions.BaseAction
import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer
import com.github.simiacryptus.aicoder.config.AppSettingsState
import com.github.simiacryptus.aicoder.util.BrowseUtil.browse
import com.github.simiacryptus.aicoder.util.UITools
import com.github.simiacryptus.aicoder.util.findRecursively
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.Task
import com.simiacryptus.skyenet.apps.parse.DocumentRecord
import com.simiacryptus.skyenet.core.platform.Session
import com.simiacryptus.skyenet.core.platform.model.User
import com.simiacryptus.skyenet.util.TensorflowProjector
import com.simiacryptus.skyenet.webui.application.AppInfoData
import com.simiacryptus.skyenet.webui.application.ApplicationServer
import com.simiacryptus.skyenet.webui.application.ApplicationSocketManager
import com.simiacryptus.skyenet.webui.session.SocketManager
import org.slf4j.LoggerFactory
import kotlin.jvm.java

class CreateProjectorFromQueryIndexAction : BaseAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT

override fun isEnabled(event: AnActionEvent): Boolean {
if (!super.isEnabled(event)) return false
if (!AppSettingsState.instance.devActions) return false
val selectedFiles = UITools.getSelectedFiles(event)
val processableFiles = selectedFiles.flatMap { file ->
when {
file.isDirectory -> file.findRecursively { it.name.endsWith(".index.data") }
file.name.endsWith(".index.data") -> listOf(file)
else -> emptyList()
}
}
return processableFiles.isNotEmpty()
}

override fun handle(e: AnActionEvent) {
val selectedFiles = UITools.getSelectedFiles(e)
val processableFiles = selectedFiles.flatMap { file ->
when {
file.isDirectory -> file.findRecursively { it.name.endsWith(".index.data") }
file.name.endsWith(".index.data") -> listOf(file)
else -> emptyList()
}
}
if (processableFiles.isEmpty()) {
UITools.showErrorDialog(e.project, "Please select a valid query index file (.index.data).", "Invalid Selection")
return
}

ProgressManager.getInstance().run(object : Task.Backgroundable(e.project, "Creating Projector") {
override fun run(indicator: ProgressIndicator) {
try {
indicator.isIndeterminate = false
indicator.fraction = 0.0

val records = processableFiles.flatMap { DocumentRecord.readBinary(it.path) }
val sessionID = Session.newGlobalID()

ApplicationServer.appInfoMap[sessionID] = AppInfoData(
applicationName = "Projector",
singleInput = true,
stickyInput = false,
loadImages = false,
showMenubar = false
)

SessionProxyServer.Companion.chats[sessionID] = object : ApplicationServer(
applicationName = "Projector",
path = "/projector",
showMenubar = false,
) {
override fun newSession(
user: User?,
session: Session
): SocketManager {
val socketManager = super.newSession(user, session)
val ui = (socketManager as ApplicationSocketManager).applicationInterface
val projector = TensorflowProjector(api, dataStorage, sessionID, ui, null)
val result = projector.writeTensorflowEmbeddingProjectorHtmlFromRecords(records)
val task = ui.newTask(true)
task.complete(result)
return socketManager
}
}

indicator.fraction = 1.0

val server = AppServer.getServer(e.project)

Thread {
Thread.sleep(500)
try {
val uri = server.server.uri.resolve("/#$sessionID")
BaseAction.log.info("Opening browser to $uri")
browse(uri)
} catch (e: Throwable) {
log.warn("Error opening browser", e)
}
}.start()

} catch (ex: Exception) {
log.error("Error during projector creation", ex)
UITools.showErrorDialog(e.project, "Error during projector creation: ${ex.message}", "Projector Creation Failed")
}
}
})
}

companion object {
private val log = LoggerFactory.getLogger(CreateProjectorFromQueryIndexAction::class.java)
}
}
Loading
Loading