Commit Graph

892 Commits

Author SHA1 Message Date
Mattias Granlund
f285579113 Use getContextByClass for Project
This removes quite a bit of prop drilling.
2024-03-21 23:17:49 +01:00
Mattias Granlund
edaec8ebbd Convert cloud api object to class 2024-03-21 19:35:27 +01:00
Mattias Granlund
0acb4c106f Refactor prompt service to be easier to use 2024-03-21 16:30:13 +01:00
Mattias Granlund
b594c68597 Show prompt from CLI in PassphraseBox
- missed this in the initial commit
2024-03-20 22:27:31 +01:00
Caleb Owens
b3699e2b5a Refactor away random.ts
Removed unused/duplicate methods and moved unsubscribe() to a better named file
2024-03-20 21:08:03 +00:00
Mattias Granlund
123843799d Bugfix for PassphraseBox to show prompt correctly 2024-03-20 15:47:23 +01:00
Mattias Granlund
01dc79ee62 Set default headers for GitHub API
- defines headers constant for octokit.js
- cache-control header prevents stale results
2024-03-20 15:16:21 +01:00
Pavel Laptev
42c7d7fd8e
Style and copy fixes (#3242)
* Project setup GH integration missing flag

* Style fix: Project setup GH integration margin

* Added ProjectNameLabel component

* UI: new icons

* Copy update and `DecorativeSplitView` link update

* Style tweak
2024-03-20 15:01:17 +01:00
Mattias Granlund
0d5dbc25b7 Organise the prompt service code a bit better
Note that instance fields are evaluated during instance creation, at the start of the constructor.
2024-03-20 13:15:04 +01:00
Mattias Granlund
14def6e616 Show prompt from CLI in PassphraseBox 2024-03-20 12:12:24 +01:00
Mattias Granlund
c8e9f4f9a4 Organise the prompt modal code a bit better
- submit on enter
2024-03-20 12:11:10 +01:00
Kiril Videlov
80b3b682cf fix(community-links): update discord link 2024-03-20 11:05:11 +01:00
Caleb Owens
792ea08eee Consolidate on one commit splitting implementation
The changes in this commit focus on improving the handling and display of commit messages. The key changes are:

1. Introduced a new `splitMessage` utility function to split a commit message into a title and description.
2. Updated the `Commit` and `RemoteCommit` classes to use the `splitMessage` function to extract the title and description from the commit message.
3. Updated the `AIService` to use the `splitMessage` function to construct the summarized commit message.
4. Added a test suite for the `splitMessage` function to ensure it handles various commit message formats correctly.

These changes will make it easier to work with and display commit messages, as the title and description will be separated, allowing for better formatting and presentation.
2024-03-20 02:22:42 +01:00
Caleb Owens
415370a422 Keep showing commit description field if present 2024-03-20 02:20:29 +01:00
Mattias Granlund
690ec9cced Bugfix checks.. again
- simplify logic a bit here, never show checks if pr closed
2024-03-20 00:47:07 +01:00
Mattias Granlund
9e41f63e99 Improve pull request checks state accuracy 2024-03-20 00:32:51 +01:00
Mattias Granlund
1b9e6649c7 Stores from observables should not subscribe until store subscribed 2024-03-20 00:03:03 +01:00
Mattias Granlund
009478a67a Fix erroneous error message when adding project
- for a split second the navigation bar comes into existence
- was trigger remote branches load
2024-03-20 00:02:43 +01:00
Mattias Granlund
6aa883f7f8 Wire up backend input requests to new components
- adds a modal for use with sync button and credentials checker
- uses branch lane PassphraseBox for pushing
2024-03-20 00:00:29 +01:00
Pavel Laptev
8498e35d9f new component PassphraseBox 2024-03-20 00:00:29 +01:00
Pavel Laptev
e3ffef17a8 Show/hide icon if textbox type is "password" 2024-03-20 00:00:29 +01:00
Pavel Laptev
554a3daa13 UI: TextBox paddings update 2024-03-20 00:00:29 +01:00
Mattias Granlund
56ca8b233d Fix for pr tag being stuck on "open" 2024-03-19 17:53:34 +01:00
Mattias Granlund
61d864512c Disable merge button if PR in draft state 2024-03-19 17:53:11 +01:00
Mattias Granlund
8e0e048e0a Increase timeout for branch reload
- up from 10s to 30s
2024-03-19 15:16:07 +01:00
Mattias Granlund
8987b10647 Fix occasional problem with unsubscribing observable
- can happen when switching projects
2024-03-19 14:50:47 +01:00
Mattias Granlund
2e6a62f82a feat(project): Force component recreation on projectId change
- solves problem of `getContext` retrieving old values
2024-03-19 14:46:13 +01:00
Kiril Videlov
6c6c830921 fix: remove setting of passphrases for projects
Passphrases for ssh keys will no longer be set and persisted in favour of prompting just in time
2024-03-19 12:41:00 +01:00
Pavel Laptev
fdfd7dd905
UI: lane resizer color update (#3211) 2024-03-19 12:17:09 +01:00
Pavel Laptev
2670fb4ef3
UI: update outline colors, added missing tokens (#3206) 2024-03-19 00:49:41 +01:00
Pavel Laptev
b7a0f7c593
UI: empty board idle animation (#3204)
* refactor: `FullscreenLoading` to `FullviewLoading`
in case we use this not only on pages but on components that are not fullscreen

* refactor: remove unused import

* idle animation for empty board added

* min-height to the empty board suggestions panel
2024-03-18 23:50:04 +01:00
Mattias Granlund
d78f95417d Prevent future DI bugs by throwing error
At present we never get optional dependencies, and if that was necessary we'd be explicit about it.
2024-03-18 21:17:44 +01:00
Pavel Laptev
debfb48ba7
CSS fixes (#3200)
* UI: Adjusted padding for better UI alignment

* UI: search field icon updated

* UI: Commit dialog padding fixes

* lint: Fix indentation in commit-box__textarea-wrapper padding.

* fix: commented loading
2024-03-18 20:19:56 +01:00
Mattias Granlund
37d921c83a Fix DI bug in branch header
- `BaseBranch` is both a class and a component, used the wrong import
2024-03-18 20:19:27 +01:00
Mattias Granlund
bcb39aab31 Fix a couple of pr card bugs
- prevent caching checks and pr Octokit requests
- throw exception if checks fail instead of returning error
2024-03-18 19:55:55 +01:00
Mattias Granlund
91fbeec587 Simplify padding in commit dialog
- under some conditions we lost all padding in commit dialog
- with these changes the bottom padding is always correct
2024-03-18 19:49:02 +01:00
Mattias Granlund
ec193efd73 Just a couple of nits 2024-03-18 19:20:18 +01:00
Caleb Owens
ef8734d638 Allow AI use without user and update settings to match 2024-03-18 19:20:18 +01:00
Caleb Owens
fcd4e616ac Add in an error toast when branch messages fail to generate 2024-03-18 19:20:18 +01:00
Caleb Owens
bdb596005d Rename "ConfigKeys" enum to "GitAIConfigKey" 2024-03-18 19:20:18 +01:00
Caleb Owens
9c3093a918 Update tests to use ConfigKeys 2024-03-18 19:20:18 +01:00
Caleb Owens
0538b9a94a Style: Move conditional assignment into a single line 2024-03-18 19:20:18 +01:00
Caleb Owens
62f87863af Improve commit message guidelines for Haiku
- Adds guideline to not use hash symbols before commit message lines
- Wraps commit message lines at 72 characters
- Specifies that only the commit message should be returned in the response
2024-03-18 19:20:18 +01:00
Caleb Owens
7cb17e9180 Fix: Correctly pass model kind to API 2024-03-18 19:20:18 +01:00
Caleb Owens
9ac44479a5 Pass model_kind to API 2024-03-18 19:20:18 +01:00
Caleb Owens
2cc474d2f9 Test toast error messages 2024-03-18 19:20:18 +01:00
Caleb Owens
4a36585f0d return undefined when git config value is null 2024-03-18 19:20:18 +01:00
Caleb Owens
5e524f4ed0 Fix regex and refactor
`/\n+(.*?)\w*/s` wasn't behaving correctly so I used `/\n+(.*)/s` from CommitDialog.svelte.
I want to consolidate this logic at some point because we've
got similar logic multiple times.

The ORing to empty strings isn't required and we can use the falsey nature of "" to
see if we should be showing just the summary or both
2024-03-18 19:20:18 +01:00
Caleb Owens
ff6f9a73e7 use ConfigKeys enum for dummy GitConfig keys
Change git config access to use the ConfigKeys enum instead of
string literals.

Also update import paths to use the new $lib alias for better modularity.
2024-03-18 19:20:18 +01:00
Mattias Granlund
c90d887ab7 Some suggestions for improvement 2024-03-18 19:20:18 +01:00
Caleb Owens
6c2d98d2f4 Refactor to use new context patterns 2024-03-18 19:20:18 +01:00
Caleb Owens
8b9b573b98 Added some tests to cover the aiService 2024-03-18 19:20:18 +01:00
Caleb Owens
d80a334bbd Improve AI client error handling 2024-03-18 19:20:18 +01:00
Caleb Owens
2a1ab3cdec Use default paramaters rather than doing an OR 2024-03-18 19:20:18 +01:00
Caleb Owens
721b9d13fa Add test:watch script to package.json files
Add a test:watch script to the package.json files in the root
and ui directories. This script runs vitest in watch mode for
the development environment, allowing developers to run tests
continuously while making changes to the codebase.
2024-03-18 19:20:18 +01:00
Caleb Owens
1e5c418bd2 Add support for Anthropic's Haiku model
Add a new enum value for Anthropic's Haiku model, which was released
on 2023-03-07. Update the default model to Haiku in the loadConfig
function. Add Haiku to the list of available models in the
configureAnthropicModel function.
2024-03-18 19:20:18 +01:00
Caleb Owens
f50dd13844 Rename model to modelName 2024-03-18 19:20:18 +01:00
Caleb Owens
52427bbed8 Rename AI Provider to AI Client 2024-03-18 19:20:18 +01:00
Caleb Owens
74e3d475ac initial pass of aiService as discussed 2024-03-18 19:20:18 +01:00
Caleb Owens
5457068e3e Small tweaks 2024-03-18 19:20:18 +01:00
Caleb Owens
8fee75762d Ensure set isn't called after initial load 2024-03-18 19:20:18 +01:00
Caleb Owens
5ece49ad41 Fix formatting issues 2024-03-18 19:20:18 +01:00
Caleb Owens
b86b46662c feat: use aiService for commit message generation
Refactor commit message generation to use the summarizer from the
aiService context instead of building it locally. This allows the
summarizer to be shared across components and avoids unnecessary
rebuilds.

Also update the branch name generation in the branch view to use the
summarizer from the aiService context.

Add the aiService to the page context and retrieve the summarizer
observable in the components that need it.

No leaked keys found in the provided git diff.
2024-03-18 19:20:18 +01:00
Caleb Owens
8ddfbd0ffd (non atomic) Moved to storing gitConfig settings with a writable 2024-03-18 19:20:18 +01:00
Caleb Owens
0ca1d9a895 refactor: Refactor code to use onMount for asynchronous data retrieval and setting properties in SummarizerSettings class. Update setters for OpenAIModel in SummarizerSettings class. 2024-03-18 19:20:18 +01:00
Caleb Owens
cfe7369661 refactor: Extracted configuration keys into constants 2024-03-18 19:20:18 +01:00
Caleb Owens
c34a0047ee Spread comment on multiple lines 2024-03-18 19:20:18 +01:00
Caleb Owens
32854787fb Remove typecast 2024-03-18 19:20:18 +01:00
Caleb Owens
7437b2f860 refactor: extract summarizer settings to use gitConfig
The summarizer settings are extracted to a new class
`SummarizerSettings` that takes a `GitConfig` instance in its
constructor. This allows the settings to be built using the
`GitConfig` methods, removing the need for individual functions to
get and set each setting. The `GitConfig` instance is injected in
the `+page.svelte` file.
2024-03-18 19:20:18 +01:00
Caleb Owens
58b0eb2324 fix: Changed icon name from "stat" to "search" in AI Options button
Updated the icon displayed in the AI Options button from "stat" to "search" to accurately represent the functionality.
2024-03-18 19:20:18 +01:00
Caleb Owens
c22cef4631 feat: improve AI settings UI and copy
* Update "Yes, I'll use my own key" to "Yes, I'll provide my own key"
in the AI settings
* Add copy explaining GitButler's AI provider support and the
requirement to be logged in to use the GitButler API
* Remove unnecessary line breaks and simplify JSX in the AI settings
* Add copy about Anthropic's Opus and Sonnet models
2024-03-18 19:20:18 +01:00
Caleb Owens
bdcd2a47f0 feat: add radio buttons for model selection
- Change model kind selection from a dropdown to radio buttons
- Update copy for key option selection
- Conditionally show model version and API key inputs based on 
  selected model kind
- Add form element to handle model kind changes
- Update layout and styling of settings page

The most significant changes are:
- Switching from a dropdown to radio buttons for selecting the model 
  kind (OpenAI or Anthropic)
- Conditionally rendering the model version and API key inputs based
  on the selected model kind
- Adding a form to handle changes to the selected model kind

This refactors the settings page to improve the user experience when
selecting the model configuration. The radio buttons make the options
clearer, and conditionally showing fields reduces clutter.
2024-03-18 19:20:18 +01:00
Caleb Owens
3ded414a5a Code review updates
- Use await instead of then when calling the summarizer.branch
method to get the branch message
- Update the condition to check the currentSection value using ==
instead of ===
2024-03-18 19:20:18 +01:00
Caleb Owens
6b61b068a7 Update imports 2024-03-18 19:20:18 +01:00
Caleb Owens
305f17accc feat: Improve key leak warning in commit message instructions
Update the instructions for generating commit messages to clarify
that a warning should be given if any leaked keys are found in the
provided git diff, rather than a more general warning about leaked
keys.

This change improves the specificity and accuracy of the instructions,
making it clear that a warning is only necessary if keys are actually
detected in the diff under analysis.
2024-03-18 19:20:18 +01:00
Caleb Owens
1a059d885d refactor: rename summarizer_settings → summarizerSettings 2024-03-18 19:20:18 +01:00
Caleb Owens
7b6e92f22d refactor: remove cloud object from branch and commit components
The main changes in this commit are:

- Remove the `cloud` object from various branch and commit
  components, including:
  - BranchList.svelte
  - Branch.svelte
  - MiniCommitInfo.svelte
  - CommitMessageBox.svelte
- Update the corresponding type imports to only import the `User` type
  instead of also importing `getCloudApiClient`
- Remove the `cloud` prop from the usages of these components
- Adjust the indentation of the `<AiSettings>` component in the
  settings page

These changes were made to remove the unused `cloud` object from
several components related to branches and commits. The `cloud` prop
was being passed down to these components but was not actually being
used within them. Removing this unnecessary prop helps simplify the
components and their usage.
2024-03-18 19:20:18 +01:00
Caleb Owens
12aefe73a3 feat: add model and key configuration options
Add UI components for configuring the model kind (OpenAI or
Anthropic), key option (Butler API or bring your own key),
and associated settings.

The model kind can be set to either OpenAI or Anthropic. The
key option allows using the Butler API proxy or providing
your own API key.

When using your own key, the API key and model version can
be specified for the selected model kind (OpenAI or
Anthropic).

The selected options are persisted and loaded from the
backend settings.
2024-03-18 19:20:18 +01:00
Caleb Owens
15956c0729 refactor: Update AIProvider classes and add model options
Refactor AIProvider classes to include model options for OpenAIProvider
and AnthropicAIProvider. Also, add functions to get and set the model
for both providers to allow for more flexibility in model selection.
2024-03-18 19:20:18 +01:00
Caleb Owens
7890f3cf56 Updated Summarizer to use different AI providers based on settings
- Modified Summarizer to use different AI providers based on the selected model
  kind and token option.
- Added functionality to build Summarizer contextually based on user and settings.
- Introduced OpenAIProvider and AnthropicAIProvider for specific AI services.
- Integrated gitGetConfig and gitSetConfig functions for potential future use.
2024-03-18 19:20:18 +01:00
Caleb Owens
a43cdb4060 Set up dependencies for anthropics and open AI in client
I've been able to use the OpenAI library as they support being in the browser if you pass the "dangerouslyAllowBrowser" flag.

Anthropics don't have any interest in supporting browers making API calls and causes sugnificant CORS problems, so I've made use of the Tauri HTTP library, so this commit also sets that up
2024-03-18 19:20:18 +01:00
Caleb Owens
8b58ab3c54 Generate commit messages from diff
Add instructions to only respond with the commit message and to warn
about any leaked keys. This improves the specificity and security of
the assistant's output.
2024-03-18 19:20:18 +01:00
Mattias Granlund
98a0229e1b Fix mistake that broke previewing stashed branches 2024-03-18 18:25:49 +01:00
Pavel Laptev
16bc897442 UI tweak: Profile sidebar paddings 2024-03-18 16:50:21 +01:00
Pavel Laptev
8357dc0986 refactor: Updated empty board layout 2024-03-18 02:14:34 +01:00
Pavel Laptev
3eb198e552 styles: updated empty board layout 2024-03-18 01:48:33 +01:00
Pavel Laptev
8d7cb1c853 style: Add left padding to the board container 2024-03-18 01:42:54 +01:00
Pavel Laptev
2587ab5ee7 styles: empty board 2024-03-18 01:33:33 +01:00
Pavel Laptev
a39029531e refactor: remove unused ImgThemed component 2024-03-18 01:32:07 +01:00
Pavel Laptev
dad4f843f4 refactor: empty board image and layout update 2024-03-18 01:32:07 +01:00
Pavel Laptev
dd29f558fd refactor: DecorativeSplitView, imgs, welcome view
- updated `DecorativeSplitView` in order to get raw SVG
- updated `DecorativeSplitView` layout
- replaced raster WebP images with SVG
- updated icons for the Welcome screen
2024-03-18 01:32:07 +01:00
Pavel Laptev
a58623197f fix: empty state didn't showed if filter branches 2024-03-18 01:32:07 +01:00
Pavel Laptev
5d2a5736a9 refactor: replace empty state images with SVG 2024-03-18 01:32:07 +01:00
Pavel Laptev
c11d19e1cd refactor: Remove unused file 2024-03-18 01:32:07 +01:00
Pavel Laptev
b02dacb539 refactor: "create new branch" images updated with svg files
Svelte components with SVG inside were replaced with `@html` rule in irder to paste SVG files directly without convert them into Svelte files.
2024-03-18 01:32:07 +01:00
Pavel Laptev
e009ccb667 refactor: support image replaced with SVG 2024-03-18 01:32:07 +01:00
Pavel Laptev
45aa3a9d0a refacor: old logo asset removed 2024-03-18 01:32:07 +01:00
Pavel Laptev
6f70d6eb69 style: width changed for some Modal
for modals with less content width changed to `small`
2024-03-18 01:32:07 +01:00
Pavel Laptev
e4839a6538 fix(ui): Change size of update button to medium 2024-03-18 01:27:48 +01:00
Pavel Laptev
351a672183 refactor: remove unused ImgThemed component 2024-03-18 01:15:17 +01:00