-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add OpenRouter client configuration and panel for AI commit generation #267
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @chernistry,
thanks a lot for opening this PR. If I see correctly, you've re-used the OpenAI client. Since everything is the same, I'm wondering why couldn't you just use the existing OpenAI client to generate commits with OpenRouter? The host and modelId fields are editable, meaning you can add you own host and modelIds.
|
||
|
||
settings.openRouter.token.example=sk-or-v1-... | ||
settings.openRouter.token.comment=Your OpenRouter API key. You can find it in your OpenRouter account settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe add a link (with ) to the account settings? Check how it's done for the others.
], | ||
style = XCollection.Style.v2 | ||
) | ||
var llmClientConfigurations = setOf<LLMClientConfiguration>( | ||
OpenAiClientConfiguration() | ||
OpenAiClientConfiguration(), | ||
OpenRouterClientConfiguration() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary. Users can create new configurations via the add button. OpenAiClientConfiguration is added just as an example.
@@ -2,6 +2,9 @@ package com.github.blarc.ai.commits.intellij.plugin.settings.clients | |||
|
|||
import com.github.blarc.ai.commits.intellij.plugin.AICommitsBundle.message | |||
import com.github.blarc.ai.commits.intellij.plugin.createColumn | |||
import com.github.blarc.ai.commits.intellij.plugin.settings.clients.openrouter.OpenRouterClientConfiguration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to be nit-picky, but are these empty lines should be removed.
|
||
override fun getClientName(): String = CLIENT_NAME | ||
|
||
override fun getClientIcon(): Icon = Icons.OPEN_AI // You may want to create a custom icon for OpenRouter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the comment says, please add the icon for OpenRouter. You can add it to main/resources/icons. Preferably svg and 15px x 15px size. Icon should be added to Icons object and then referenced here. I usually just download it from llm's website an resize it online.
Hey @Blarc, Spot on, mate. Just wanted to get OpenRouter sorted, so I thought a quick tweak might do the trick. Truth be told, I'm barely scraping the surface of Kotlin — for the second time in life today literally for the sake of OpenRouter in this plugin —so you're probably right about those glitches. Time's a bit tight, and honestly, I thought sharing what worked might lend a hand to someone else. Cheers! - Sasha |
This PR introduces OpenRouter integration, enabling users to generate commit messages with various free AI models.
Key Changes:
OpenRouterClientConfiguration
, Panel, Service, and SharedState.LLMClientTable
andAppSettings2
to support OpenRouter.nousresearch/hermes-3-llama-3.1-405b:free
Models can be accessed here: OpenRouter Models.
Testing: