Commit Graph

5957 Commits

Author SHA1 Message Date
Josh Junon
d88ff925d9
Merge pull request #3207 from gitbutlerapp/refactor-gitbutler-git-to-be-cli-only
refactor gitbutler-git to be cli-only and allow prompt handlers
2024-03-19 08:38:25 +01:00
Josh Junon
bd288f92ca refactor gitbutler-git to be cli-only and allow prompt handlers 2024-03-19 08:25:57 +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
Kiril Videlov
106697e3f6 feat(virtual_branches): remove unnecessary synchronization 2024-03-18 23:22:58 +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
Kiril Videlov
8b06269c2a refactor: Removed unnecessary unwrap in setting default target in VirtualBranchesHandle. 2024-03-18 19:31:13 +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
2774b81381 feat: Skip instrumenting _handle parameter in git_set_global_config and git_get_global_config
This commit skips instrumenting the _handle parameter in the functions git_set_global_config and git_get_global_config for cleaner logs and improved clarity in the code.
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
5cd2368236 Fix JSON formatting 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