File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,11 @@ async function handleCodeDiffFromPipe(): Promise<void> {
86
86
return ;
87
87
}
88
88
89
- process . stdout . write (
90
- completion . content + "\n\nGenerated by " + completion . model + "\n" ,
91
- ) ;
89
+ if ( loz . attribution ) {
90
+ process . stdout . write (
91
+ completion . content + "\n\nGenerated by " + completion . model + "\n" ,
92
+ ) ;
93
+ }
92
94
} ) ;
93
95
}
94
96
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export class Loz {
37
37
configPath : string ;
38
38
config : Config = new Config ( ) ;
39
39
git : Git = new Git ( ) ;
40
+ attribution : boolean = false ;
40
41
41
42
constructor ( ) {
42
43
this . defaultSettings = {
@@ -106,6 +107,19 @@ export class Loz {
106
107
107
108
this . defaultSettings . model =
108
109
this . config . get ( "model" ) ?. value || DEFAULT_OPENAI_MODEL ;
110
+
111
+ // Check if the attribution is enabled
112
+ const attributionValue = this . config . get ( "attribution" ) ?. value ;
113
+ if ( ! attributionValue ) {
114
+ this . config . set ( "attribution" , "false" ) ;
115
+ this . attribution = false ;
116
+ } else {
117
+ if ( attributionValue === "true" ) {
118
+ this . attribution = true ;
119
+ } else {
120
+ this . attribution = false ;
121
+ }
122
+ }
109
123
}
110
124
111
125
private checkAPI ( ) : string | undefined {
@@ -149,9 +163,14 @@ export class Loz {
149
163
}
150
164
151
165
try {
152
- await this . git . commit (
153
- complete . content + "\n\nGenerated by " + complete . model ,
154
- ) ;
166
+ if ( this . attribution ) {
167
+ await this . git . commit (
168
+ complete . content + "\n\nGenerated by " + complete . model ,
169
+ ) ;
170
+ } else {
171
+ await this . git . commit ( complete . content ) ;
172
+ }
173
+
155
174
const commitHEAD = await this . git . showHEAD ( ) ;
156
175
console . log ( "\n# Generated commit message: \n" ) ;
157
176
console . log ( commitHEAD ) ;
You can’t perform that action at this time.
0 commit comments