Skip to content

Commit 1cc7c5e

Browse files
authored
1.8.3 (#198)
1 parent 5d35874 commit 1cc7c5e

22 files changed

+576
-209
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ tokens
1717
html-games.iml
1818
*.iml
1919
test-recordings/
20+
*.index.data
21+
*.parsed.json

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repositories {
2828

2929
val jetty_version = "11.0.24"
3030
val slf4j_version = "2.0.16"
31-
val skyenet_version = "1.2.14"
31+
val skyenet_version = "1.2.16"
3232
val remoterobot_version = "0.11.23"
3333
val jackson_version = "2.17.2"
3434

@@ -37,13 +37,15 @@ dependencies {
3737
implementation("software.amazon.awssdk:bedrockruntime:2.25.9")
3838
implementation("software.amazon.awssdk:s3:2.25.9")
3939
implementation("software.amazon.awssdk:kms:2.25.9")
40+
implementation("software.amazon.awssdk:sso:2.25.9")
41+
implementation("software.amazon.awssdk:ssooidc:2.25.9")
4042

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

46-
implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.11")
48+
implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.12")
4749
implementation(group = "com.simiacryptus.skyenet", name = "kotlin", version = skyenet_version)
4850
implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version)
4951
implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pluginName=intellij-aicoder
22
pluginRepositoryUrl=https://github.com/SimiaCryptus/intellij-aicoder
3-
pluginVersion=1.8.2
3+
pluginVersion=1.8.3
44
jvmArgs=-Xmx8g
55
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g
66
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html

src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentDataExtractorAction.kt

Lines changed: 0 additions & 96 deletions
This file was deleted.

src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SaveAsQueryIndexAction.kt

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package com.github.simiacryptus.aicoder.actions.knowledge
2+
3+
import com.github.simiacryptus.aicoder.AppServer
4+
import com.github.simiacryptus.aicoder.actions.BaseAction
5+
import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer
6+
import com.github.simiacryptus.aicoder.config.AppSettingsState
7+
import com.github.simiacryptus.aicoder.util.BrowseUtil.browse
8+
import com.github.simiacryptus.aicoder.util.UITools
9+
import com.github.simiacryptus.aicoder.util.findRecursively
10+
import com.intellij.openapi.actionSystem.ActionUpdateThread
11+
import com.intellij.openapi.actionSystem.AnActionEvent
12+
import com.intellij.openapi.progress.ProgressIndicator
13+
import com.intellij.openapi.progress.ProgressManager
14+
import com.intellij.openapi.progress.Task
15+
import com.simiacryptus.skyenet.apps.parse.DocumentRecord
16+
import com.simiacryptus.skyenet.core.platform.Session
17+
import com.simiacryptus.skyenet.core.platform.model.User
18+
import com.simiacryptus.skyenet.util.TensorflowProjector
19+
import com.simiacryptus.skyenet.webui.application.AppInfoData
20+
import com.simiacryptus.skyenet.webui.application.ApplicationServer
21+
import com.simiacryptus.skyenet.webui.application.ApplicationSocketManager
22+
import com.simiacryptus.skyenet.webui.session.SocketManager
23+
import org.slf4j.LoggerFactory
24+
import kotlin.jvm.java
25+
26+
class CreateProjectorFromQueryIndexAction : BaseAction() {
27+
override fun getActionUpdateThread() = ActionUpdateThread.BGT
28+
29+
override fun isEnabled(event: AnActionEvent): Boolean {
30+
if (!super.isEnabled(event)) return false
31+
if (!AppSettingsState.instance.devActions) return false
32+
val selectedFiles = UITools.getSelectedFiles(event)
33+
val processableFiles = selectedFiles.flatMap { file ->
34+
when {
35+
file.isDirectory -> file.findRecursively { it.name.endsWith(".index.data") }
36+
file.name.endsWith(".index.data") -> listOf(file)
37+
else -> emptyList()
38+
}
39+
}
40+
return processableFiles.isNotEmpty()
41+
}
42+
43+
override fun handle(e: AnActionEvent) {
44+
val selectedFiles = UITools.getSelectedFiles(e)
45+
val processableFiles = selectedFiles.flatMap { file ->
46+
when {
47+
file.isDirectory -> file.findRecursively { it.name.endsWith(".index.data") }
48+
file.name.endsWith(".index.data") -> listOf(file)
49+
else -> emptyList()
50+
}
51+
}
52+
if (processableFiles.isEmpty()) {
53+
UITools.showErrorDialog(e.project, "Please select a valid query index file (.index.data).", "Invalid Selection")
54+
return
55+
}
56+
57+
ProgressManager.getInstance().run(object : Task.Backgroundable(e.project, "Creating Projector") {
58+
override fun run(indicator: ProgressIndicator) {
59+
try {
60+
indicator.isIndeterminate = false
61+
indicator.fraction = 0.0
62+
63+
val records = processableFiles.flatMap { DocumentRecord.readBinary(it.path) }
64+
val sessionID = Session.newGlobalID()
65+
66+
ApplicationServer.appInfoMap[sessionID] = AppInfoData(
67+
applicationName = "Projector",
68+
singleInput = true,
69+
stickyInput = false,
70+
loadImages = false,
71+
showMenubar = false
72+
)
73+
74+
SessionProxyServer.Companion.chats[sessionID] = object : ApplicationServer(
75+
applicationName = "Projector",
76+
path = "/projector",
77+
showMenubar = false,
78+
) {
79+
override fun newSession(
80+
user: User?,
81+
session: Session
82+
): SocketManager {
83+
val socketManager = super.newSession(user, session)
84+
val ui = (socketManager as ApplicationSocketManager).applicationInterface
85+
val projector = TensorflowProjector(api, dataStorage, sessionID, ui, null)
86+
val result = projector.writeTensorflowEmbeddingProjectorHtmlFromRecords(records)
87+
val task = ui.newTask(true)
88+
task.complete(result)
89+
return socketManager
90+
}
91+
}
92+
93+
indicator.fraction = 1.0
94+
95+
val server = AppServer.getServer(e.project)
96+
97+
Thread {
98+
Thread.sleep(500)
99+
try {
100+
val uri = server.server.uri.resolve("/#$sessionID")
101+
BaseAction.log.info("Opening browser to $uri")
102+
browse(uri)
103+
} catch (e: Throwable) {
104+
log.warn("Error opening browser", e)
105+
}
106+
}.start()
107+
108+
} catch (ex: Exception) {
109+
log.error("Error during projector creation", ex)
110+
UITools.showErrorDialog(e.project, "Error during projector creation: ${ex.message}", "Projector Creation Failed")
111+
}
112+
}
113+
})
114+
}
115+
116+
companion object {
117+
private val log = LoggerFactory.getLogger(CreateProjectorFromQueryIndexAction::class.java)
118+
}
119+
}

0 commit comments

Comments
 (0)