File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change 3
3
import AiPromptSelect from ' $components/AIPromptSelect.svelte' ;
4
4
import Section from ' $components/Section.svelte' ;
5
5
import WelcomeSigninAction from ' $components/WelcomeSigninAction.svelte' ;
6
- import { projectAiGenEnabled } from ' $lib/config/config' ;
6
+ import { projectAiExperimentalFeaturesEnabled , projectAiGenEnabled } from ' $lib/config/config' ;
7
7
import { Project } from ' $lib/project/project' ;
8
8
import { UserService } from ' $lib/user/userService' ;
9
9
import { getContext } from ' @gitbutler/shared/context' ;
16
16
const project = getContext (Project );
17
17
const user = userService .user ;
18
18
19
- const aiGenEnabled = projectAiGenEnabled (project .id );
19
+ const aiGenEnabled = $derived (projectAiGenEnabled (project .id ));
20
+ const experimentalAiGenEnabled = $derived (projectAiExperimentalFeaturesEnabled (project .id ));
20
21
</script >
21
22
22
23
<Section >
54
55
</SectionCard >
55
56
</div >
56
57
58
+ {#if $aiGenEnabled }
59
+ <div class =" options" >
60
+ <SectionCard labelFor =" aiExperimental" orientation =" row" >
61
+ {#snippet title ()}
62
+ Enable experimental AI features
63
+ {/ snippet }
64
+ {#snippet caption ()}
65
+ If enabled, you will be able tu access the AI features currently in development.
66
+
67
+ <b
68
+ >This also requires you to use OpenAI through GitButler in order for the features to
69
+ work.</b
70
+ >
71
+ {/ snippet }
72
+ {#snippet actions ()}
73
+ <Toggle
74
+ id =" aiExperimental"
75
+ checked ={$experimentalAiGenEnabled }
76
+ onclick ={() => {
77
+ $experimentalAiGenEnabled = ! $experimentalAiGenEnabled ;
78
+ }}
79
+ />
80
+ {/ snippet }
81
+ </SectionCard >
82
+ </div >
83
+ {/if }
84
+
57
85
<SectionCard >
58
86
{#snippet title ()}
59
87
Custom prompts
Original file line number Diff line number Diff line change 4
4
import { AIService } from ' $lib/ai/service' ;
5
5
import { writeClipboard } from ' $lib/backend/clipboard' ;
6
6
import { changesToDiffSpec } from ' $lib/commits/utils' ;
7
- import { projectAiGenEnabled } from ' $lib/config/config' ;
7
+ import { projectAiExperimentalFeaturesEnabled , projectAiGenEnabled } from ' $lib/config/config' ;
8
8
import { isTreeChange , type TreeChange } from ' $lib/hunks/change' ;
9
9
import { showToast } from ' $lib/notifications/toasts' ;
10
10
import { Project } from ' $lib/project/project' ;
74
74
let aiConfigurationValid = $state (false );
75
75
76
76
const aiGenEnabled = $derived (projectAiGenEnabled (projectId ));
77
+ const experimentalFeaturesEnabled = $derived (projectAiExperimentalFeaturesEnabled (projectId ));
77
78
78
- const canUseGBAI = $derived (aiGenEnabled && aiConfigurationValid );
79
+ const canUseGBAI = $derived (
80
+ $aiGenEnabled && aiConfigurationValid && $experimentalFeaturesEnabled
81
+ );
79
82
80
83
function isDeleted(item : FileItem ): boolean {
81
84
return item .changes .some ((change ) => {
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ export function projectAiGenEnabled(projectId: string): Persisted<boolean> {
38
38
return persisted ( false , key + projectId ) ;
39
39
}
40
40
41
+ export function projectAiExperimentalFeaturesEnabled ( projectId : string ) : Persisted < boolean > {
42
+ const key = 'projectAiExperimentalFeaturesEnabled_' ;
43
+ return persisted ( false , key + projectId ) ;
44
+ }
45
+
41
46
export function projectRunCommitHooks ( projectId : string ) : Persisted < boolean > {
42
47
const key = 'projectRunCommitHooks_' ;
43
48
return persisted ( false , key + projectId ) ;
You can’t perform that action at this time.
0 commit comments