[Feature Request]: Hop GUI API for plugins to ask the default AI provider
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- ai, backend-api-design
調査の方向性
Start with the existing HopGui.openAiAdvisorSession route in hop-ui and the extension-point lookup it uses, then read HopAiConfigSingleton, AiProviderLoader and AiChatFactory in hop-tech-ai. The work spans hop-ui (HopAi, AiPrompt, AiAnswer), hop-core (IHopAiService) and hop-tech-ai (HopAiServiceImpl, HopGuiAiServiceLookup); first settle the lookup contract and how isAvailable stays cheap. Done when a plugin can call HopAi.askAsync against the default provider with masking and full-XML rules enforced, and Hop Web's UI-thread callback path is checked.
索引モデルが issue の本文から書いたものです。
説明
What would you like to happen?
Why
A plugin that wants to ask the configured AI provider a simple question has to use too much Java reflection.
This came up while prototyping a button in the Git commit perspective that generates the commit message from the changes. The feature only concerns the Git plugin, but hop-tech-ai is optional and has its own class loader, so the Git plugin cannot compile against it. To send one prompt, it has to find the AI plugin in the registry, get its class loader, and call these by name:
HopAiLegacyConfigMigrator.migrateHopAiConfigSingleton.getConfig, thenisAiEnabled,getDefaultProviderNameandisAllowSendFullXmlAiTextUtil.redactSecretsAiProviderLoader.loadAiChatFactory.generate
This has several drawbacks:
- A rename in
hop-tech-aionly fails at runtime. - Each plugin has to apply the AI privacy rules itself (enabled switch, secret masking, "Allow sending full XML"), and can forget one.
- Each plugin repeats the same work: thread context class loader, background thread, return to the UI thread, clean-up of the answer.
Proposal
A small API in Hop GUI to know whether AI can be used and to ask it something, with no reflection in the calling plugin.
if (HopAi.isAvailable(hopGui)) {
AiPrompt prompt =
AiPrompt.builder()
.system(SYSTEM_PROMPT)
.data("changed_files", files) // secrets masked, block tags neutralized
.data("diff", textDiff, 60_000) // with a maximum size
.hopXml("pipeline_diff", xmlDiff, summary) // summary when full XML is not allowed
.build();
HopAi.askAsync(
hopGui,
prompt,
answer -> wMessage.setText(answer.text()), // called on the UI thread
error -> showStatus(error.getMessage()));
}
hop-ui: the entry point for plugins
public final class HopAi {
/** True when the AI plugin is installed and enabled, with a valid default provider. */
public static boolean isAvailable(HopGui hopGui);
/** Call outside the UI thread. */
public static AiAnswer ask(HopGui hopGui, AiPrompt prompt) throws HopException;
/** Runs in the background, and calls back on the UI thread. */
public static void askAsync(
HopGui hopGui,
AiPrompt prompt,
Consumer<AiAnswer> onAnswer,
Consumer<HopException> onError);
}
hop-core: the contract, without any model library type
public interface IHopAiService {
boolean isAvailable(IHopMetadataProvider metadata);
AiAnswer ask(AiPrompt prompt, IVariables variables, IHopMetadataProvider metadata)
throws HopException;
}
public record AiAnswer(
String text, Integer inputTokens, Integer outputTokens, long durationMs) {}
AiPrompt is a plain builder: system, data, hopXml, and the optional provider(name) and jsonOnly().
hop-tech-ai: the implementation
HopAiServiceImpl reads the configuration, loads the provider, applies the privacy rules and calls the model. HopAi gets it through a new extension point, HopGuiAiServiceLookup, the same way HopGui.openAiAdvisorSession reaches the plugin today. After that lookup, calls are normal Java calls, checked at compile time.
Behavior
isAvailablereturns false without the AI plugin. It makes no network call and stays cheap, so a plugin can call it when it refreshes its toolbar. Availability can change during a session (option, default provider, project).askthrows aHopExceptionwith a message for the user when AI cannot be used, for example if the provider was removed in the meantime.- The privacy rules are in the implementation, so a plugin cannot bypass them:
datais always masked, andhopXmlonly sends its content with "Allow sending full XML". - Model reasoning (
<think>) and a surrounding code block are removed from the answer. - The default AI provider is used unless
provider(name)is set.
Out of scope for a first version
- Streaming and conversation history.
- Cancellation:
AiChatFactorycannot interrupt a request today. LanguageModelChatAiProviderSupport, which merges a provider configuration and does not ask the model anything.
To check
Hop Web: calling back on the UI thread from a background thread may need RAP server push.
Issue Priority
Priority: 3
Issue Component
Component: AI
- 主要言語
- Java
- スター
- 1.6k
- フォーク
- 499
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 316
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/hop のほかの issue
-
Beam P2
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
awaiting triage Hop Gui P3
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
apache/hop#9325 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
awaiting triage Documentation P3
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
awaiting triage Documentation P3
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
awaiting triage Documentation P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
CI: LFC/ANTLR caches still use the old lfc/ paths, so the ANTLR jar is downloaded on every run対応中かも @NicoBiernat が今日担当しました。 オープンbug CI
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
lf-lang/reactor-uc#443 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Card-Forge/forge#13128 ·
メンテナーはふだん 1 日以内に返信
-
client documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
ClickHouse/clickhouse-java#3469 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信