Skip to content

Commit d79b1cf

Browse files
Introduce new assistant module
Signed-off-by: Phillip Kruger <[email protected]>
1 parent 1e0830b commit d79b1cf

File tree

26 files changed

+925
-23
lines changed

26 files changed

+925
-23
lines changed

bom/application/pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,16 @@
594594
</dependency>
595595

596596
<!-- Quarkus libraries -->
597-
597+
<dependency>
598+
<groupId>io.quarkus</groupId>
599+
<artifactId>quarkus-assistant</artifactId>
600+
<version>${project.version}</version>
601+
</dependency>
602+
<dependency>
603+
<groupId>io.quarkus</groupId>
604+
<artifactId>quarkus-assistant-deployment</artifactId>
605+
<version>${project.version}</version>
606+
</dependency>
598607
<dependency>
599608
<groupId>io.quarkus</groupId>
600609
<artifactId>quarkus-caffeine</artifactId>

bom/dev-ui/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<codeblock.version>1.1.1</codeblock.version>
3434
<qomponent.version>1.0.4</qomponent.version>
3535
<directory-tree.version>1.0.3</directory-tree.version>
36+
<dot.version>0.0.1</dot.version>
3637
<hpcc-js-wasm.version>2.15.3</hpcc-js-wasm.version>
3738
<yargs.version>17.7.2</yargs.version>
3839
<cliui.version>8.0.1</cliui.version>
@@ -50,6 +51,7 @@
5051
<ansi-styles.version>4.3.0</ansi-styles.version>
5152
<color-convert.version>2.0.1</color-convert.version>
5253
<color-name.version>1.1.4</color-name.version>
54+
<viz-js.version>3.12.0</viz-js.version>
5355
</properties>
5456

5557
<dependencyManagement>
@@ -277,6 +279,14 @@
277279
<scope>runtime</scope>
278280
</dependency>
279281

282+
<!-- Dot files render -->
283+
<dependency>
284+
<groupId>org.mvnpm.at.qomponent</groupId>
285+
<artifactId>qui-dot</artifactId>
286+
<version>${dot.version}</version>
287+
<scope>runtime</scope>
288+
</dependency>
289+
280290
<!-- Markdown render -->
281291
<dependency>
282292
<groupId>org.mvnpm</groupId>
@@ -335,6 +345,14 @@
335345
<version>${es-module-shims.version}</version>
336346
<scope>runtime</scope>
337347
</dependency>
348+
349+
<!-- Viz.js to render dot file -->
350+
<dependency>
351+
<groupId>org.mvnpm.at.viz-js</groupId>
352+
<artifactId>viz</artifactId>
353+
<version>${viz-js.version}</version>
354+
<scope>runtime</scope>
355+
</dependency>
338356
</dependencies>
339357
</dependencyManagement>
340358
</project>

devtools/bom-descriptor-json/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@
226226
</exclusion>
227227
</exclusions>
228228
</dependency>
229+
<dependency>
230+
<groupId>io.quarkus</groupId>
231+
<artifactId>quarkus-assistant</artifactId>
232+
<version>${project.version}</version>
233+
<type>pom</type>
234+
<scope>test</scope>
235+
<exclusions>
236+
<exclusion>
237+
<groupId>*</groupId>
238+
<artifactId>*</artifactId>
239+
</exclusion>
240+
</exclusions>
241+
</dependency>
229242
<dependency>
230243
<groupId>io.quarkus</groupId>
231244
<artifactId>quarkus-avro</artifactId>

docs/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,19 @@
237237
</exclusion>
238238
</exclusions>
239239
</dependency>
240+
<dependency>
241+
<groupId>io.quarkus</groupId>
242+
<artifactId>quarkus-assistant-deployment</artifactId>
243+
<version>${project.version}</version>
244+
<type>pom</type>
245+
<scope>test</scope>
246+
<exclusions>
247+
<exclusion>
248+
<groupId>*</groupId>
249+
<artifactId>*</artifactId>
250+
</exclusion>
251+
</exclusions>
252+
</dependency>
240253
<dependency>
241254
<groupId>io.quarkus</groupId>
242255
<artifactId>quarkus-avro-deployment</artifactId>

extensions/agroal/deployment/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<groupId>io.quarkus</groupId>
2626
<artifactId>quarkus-datasource-deployment</artifactId>
2727
</dependency>
28+
<dependency>
29+
<groupId>io.quarkus</groupId>
30+
<artifactId>quarkus-assistant-deployment</artifactId>
31+
</dependency>
2832
<dependency>
2933
<groupId>io.quarkus</groupId>
3034
<artifactId>quarkus-agroal</artifactId>

extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class AgroalProcessor {
7373

7474
private static final Logger log = Logger.getLogger(AgroalProcessor.class);
7575

76-
private static final String OPEN_TELEMETRY_DRIVER = "io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver";
7776
private static final DotName DATA_SOURCE = DotName.createSimple(javax.sql.DataSource.class.getName());
7877
private static final DotName AGROAL_DATA_SOURCE = DotName.createSimple(AgroalDataSource.class.getName());
7978

extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package io.quarkus.agroal.deployment.devui;
22

3+
import java.util.Optional;
4+
35
import io.quarkus.agroal.runtime.DataSourcesJdbcBuildTimeConfig;
46
import io.quarkus.agroal.runtime.dev.ui.DatabaseInspector;
7+
import io.quarkus.assistant.deployment.Assistant;
8+
import io.quarkus.assistant.deployment.AssistantBuildItem;
59
import io.quarkus.deployment.IsLocalDevelopment;
610
import io.quarkus.deployment.annotations.BuildProducer;
711
import io.quarkus.deployment.annotations.BuildStep;
812
import io.quarkus.deployment.annotations.BuildSteps;
913
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
1014
import io.quarkus.dev.spi.DevModeType;
1115
import io.quarkus.devui.spi.JsonRPCProvidersBuildItem;
16+
import io.quarkus.devui.spi.buildtime.BuildTimeActionBuildItem;
1217
import io.quarkus.devui.spi.page.CardPageBuildItem;
1318
import io.quarkus.devui.spi.page.Page;
1419

@@ -37,8 +42,35 @@ void devUI(DataSourcesJdbcBuildTimeConfig config,
3742
}
3843
}
3944

45+
@BuildStep
46+
void createBuildTimeActions(Optional<AssistantBuildItem> assistantBuildItem,
47+
BuildProducer<BuildTimeActionBuildItem> buildTimeActionProducer) {
48+
49+
if (assistantBuildItem.isPresent()) {
50+
BuildTimeActionBuildItem bta = new BuildTimeActionBuildItem();
51+
52+
Assistant assistant = assistantBuildItem.get().getAssistant();
53+
54+
// TODO: If currentInsertScript is empty, maybe send tables schema
55+
56+
bta.addAction("generateMoreData", params -> {
57+
return assistant.assist(USER_MESSAGE, params);
58+
});
59+
60+
buildTimeActionProducer.produce(bta);
61+
}
62+
}
63+
4064
@BuildStep
4165
JsonRPCProvidersBuildItem createJsonRPCService() {
4266
return new JsonRPCProvidersBuildItem(DatabaseInspector.class);
4367
}
68+
69+
private static final String USER_MESSAGE = """
70+
Given the provided sql script:
71+
{{currentInsertScript}}
72+
Can you add 10 more inserts into the script and return the result
73+
(including the provided entries, so update the script)
74+
Return the result in a field called `script`.
75+
""";
4476
}

0 commit comments

Comments
 (0)