@@ -44,21 +44,15 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
44
44
dispatchActivity
45
45
} ) => {
46
46
return (
47
- < div
48
- className = "prompt-area d-flex flex-column gap-2 p-2 mx-2"
49
- style = { {
50
- background : 'rgba(255,255,255,0.04)' , // same dark tone as input row
51
- borderRadius : '4px'
52
- } }
53
- >
47
+ < >
54
48
{ showContextOptions && (
55
49
< div
56
- className = "rounded p-3 mb-2 "
50
+ className = " w-100 bg-dark p-2 border border-text border-bottom-0 rounded "
57
51
>
58
- < h6 className = "text-uppercase small mb-3 " > Add Context Files</ h6 >
59
- < div className = "form-check mb-2 " >
52
+ < div className = "text-uppercase ml-2 mb-2 " > Add Context Files</ div >
53
+ < div className = "d-flex ml-2 custom-control custom-radio " >
60
54
< input
61
- className = "form-check -input"
55
+ className = "custom-control -input"
62
56
type = "radio"
63
57
id = "ctx-none"
64
58
checked = { contextChoice === 'none' }
@@ -68,13 +62,13 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
68
62
setShowContextOptions ( false )
69
63
} }
70
64
/>
71
- < label className = "form-check-label" htmlFor = "ctx-none" >
65
+ < label className = "form-check-label custom-control-label " htmlFor = "ctx-none" >
72
66
None
73
67
</ label >
74
68
</ div >
75
- < div className = "form-check mb-2 " >
69
+ < div className = "d-flex ml-2 custom-control custom-radio " >
76
70
< input
77
- className = "form-check -input"
71
+ className = "custom-control -input"
78
72
type = "radio"
79
73
id = "ctx-current"
80
74
data-id = "currentFile-context-option"
@@ -84,13 +78,13 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
84
78
setShowContextOptions ( false )
85
79
} }
86
80
/>
87
- < label className = "form-check-label" htmlFor = "ctx-current" >
81
+ < label className = "form-check-label custom-control-label " htmlFor = "ctx-current" >
88
82
Current file
89
83
</ label >
90
84
</ div >
91
- < div className = "form-check mb-2 " >
85
+ < div className = "d-flex ml-2 custom-control custom-radio " >
92
86
< input
93
- className = "form-check -input"
87
+ className = "custom-control -input"
94
88
type = "radio"
95
89
id = "ctx-opened"
96
90
data-id = "allOpenedFiles-context-option"
@@ -100,13 +94,13 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
100
94
setShowContextOptions ( false )
101
95
} }
102
96
/>
103
- < label className = "form-check-label" htmlFor = "ctx-opened" >
97
+ < label className = "form-check-label custom-control-label " htmlFor = "ctx-opened" >
104
98
All opened files
105
99
</ label >
106
100
</ div >
107
- < div className = "form-check " >
101
+ < div className = "d-flex ml-2 custom-control custom-radio " >
108
102
< input
109
- className = "form-check -input"
103
+ className = "custom-control -input"
110
104
type = "radio"
111
105
id = "ctx-workspace"
112
106
data-id = "workspace-context-option"
@@ -116,110 +110,140 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
116
110
setShowContextOptions ( false )
117
111
} }
118
112
/>
119
- < label className = "form-check-label" htmlFor = "ctx-workspace" >
113
+ < label className = "form-check-label custom-control-label " htmlFor = "ctx-workspace" >
120
114
Workspace
121
115
</ label >
122
116
</ div >
123
117
</ div >
124
118
) }
125
- { showAssistantOptions && (
126
- < div
127
- className = "rounded p-3 mb-2"
128
- >
129
- < h6 className = "text-uppercase small mb-3" > Choose Assistant Model</ h6 >
130
119
131
- { [ 'openai' , 'mistralai' , 'anthropic' ] . map ( val => (
132
- < div className = "form-check mb-2" key = { val } >
133
- < input
134
- className = "form-check-input"
135
- type = "radio"
136
- id = { `assistant-${ val } ` }
137
- checked = { assistantChoice === val }
138
- onChange = { ( ) => {
139
- setAssistantChoice ( val as any )
140
- setShowAssistantOptions ( false )
141
- } }
142
- />
143
- < label className = "form-check-label" htmlFor = { `assistant-${ val } ` } >
144
- { val }
145
- </ label >
146
- </ div >
147
- ) ) }
148
- </ div >
149
- ) }
150
- < div className = "d-flex gap-2 mb-2" >
151
- < button
152
- onClick = { handleAddContext }
153
- data-id = "composer-ai-add-context"
154
- className = { `btn mr-2 ${ showContextOptions ? 'btn-dark' : 'btn-text' } ` }
155
- >
120
+ < div
121
+ className = "prompt-area d-flex flex-column gap-2 w-100 p-3"
122
+ >
123
+ < div className = "d-flex justify-content-between mb-2" >
124
+ < button
125
+ onClick = { handleAddContext }
126
+ data-id = "composer-ai-add-context"
127
+ className = "btn btn-dark btn-sm text-secondary"
128
+ >
156
129
Add context
157
- { /* <i className={`fa fa-caret-${showContextOptions ? 'down' : 'up'}`}></i> */ }
158
- </ button >
130
+ </ button >
159
131
160
- < button
161
- onClick = { handleSetAssistant }
162
- className = { `btn mr-2 ${ showAssistantOptions ? 'btn-dark' : 'btn-text' } ` }
163
- >
164
- @Set assistant
165
- { /* <i className={`fa fa-caret-${showAssistantOptions ? 'down' : 'up'}`}></i> */ }
166
- </ button >
167
-
168
- < button
169
- onClick = { handleGenerateWorkspace }
170
- className = "btn btn-dark"
171
- data-id = "composer-ai-workspace-generate"
172
- >
132
+ < button
133
+ onClick = { handleGenerateWorkspace }
134
+ className = "btn btn-dark btn-sm text-secondary"
135
+ data-id = "composer-ai-workspace-generate"
136
+ >
173
137
@Generate Workspace
174
- </ button >
175
- </ div >
176
- < div className = "ai-chat-input" >
177
- < input
178
- style = { { flexGrow : 1 } }
179
- type = "text"
180
- className = "form-control"
181
- value = { input }
182
- disabled = { isStreaming }
183
- onFocus = { ( ) => {
184
- dispatchActivity ( 'typing' , input )
185
- } }
186
- onChange = { e => {
187
- dispatchActivity ( 'typing' , e . target . value )
188
- setInput ( e . target . value )
189
- } }
190
- onKeyDown = { e => {
191
- if ( e . key === 'Enter' && ! isStreaming ) handleSend ( )
192
- } }
193
- placeholder = "Ask me anything, use button to add context..."
194
- />
195
- </ div >
196
- { contextChoice !== 'none' && contextFiles . length > 0 && (
197
- < div className = "mt-2 d-flex flex-wrap gap-1" style = { { maxHeight : '110px' , overflowY : 'auto' } } >
198
- { contextFiles . slice ( 0 , 6 ) . map ( f => {
199
- const name = f . split ( '/' ) . pop ( )
200
- return (
138
+ </ button >
139
+ </ div >
140
+ < div className = "ai-chat-input d-flex flex-column" >
141
+ < input
142
+ style = { { flexGrow : 1 } }
143
+ type = "text"
144
+ className = "form-control bg-light"
145
+ value = { input }
146
+ disabled = { isStreaming }
147
+ onFocus = { ( ) => {
148
+ dispatchActivity ( 'typing' , input )
149
+ } }
150
+ onChange = { e => {
151
+ dispatchActivity ( 'typing' , e . target . value )
152
+ setInput ( e . target . value )
153
+ } }
154
+ onKeyDown = { e => {
155
+ if ( e . key === 'Enter' && ! isStreaming ) handleSend ( )
156
+ } }
157
+ placeholder = "Ask me anything, add workspace files..."
158
+ />
159
+ { showAssistantOptions && (
160
+ < div
161
+ className = "p-3 mb-2 z-3 bg-dark border border-text position-absolute"
162
+ style = { { top : '79dvh' , left : '85dvw' , right : '0px' , bottom : '15px' , height : '125px' , width : '220px' , borderRadius : '15px' } }
163
+ >
164
+ < div className = "text-uppercase ml-2 mb-2" > Choose Assistant Model</ div >
165
+ < div className = "d-flex ml-2 custom-control custom-radio" key = { 'openai' } >
166
+ < input
167
+ className = "custom-control-input"
168
+ type = "radio"
169
+ id = { `assistant-openai` }
170
+ checked = { assistantChoice === 'openai' }
171
+ onChange = { ( ) => {
172
+ setAssistantChoice ( 'openai' )
173
+ setShowAssistantOptions ( false )
174
+ } }
175
+ />
176
+ < label className = "form-check-label custom-control-label" htmlFor = { `assistant-openai` } >
177
+ OpenAI
178
+ </ label >
179
+ </ div >
180
+ < div className = "d-flex ml-2 custom-control custom-radio" key = { 'mistralai' } >
181
+ < input
182
+ className = "custom-control-input"
183
+ type = "radio"
184
+ id = { `assistant-mistralai` }
185
+ checked = { assistantChoice === 'mistralai' }
186
+ onChange = { ( ) => {
187
+ setAssistantChoice ( 'mistralai' )
188
+ setShowAssistantOptions ( false )
189
+ } }
190
+ />
191
+ < label className = "form-check-label custom-control-label" htmlFor = { `assistant-mistralai` } >
192
+ MistralAI
193
+ </ label >
194
+ </ div >
195
+ < div className = "d-flex ml-2 custom-control custom-radio" key = { 'anthropic' } >
196
+ < input
197
+ className = "custom-control-input"
198
+ type = "radio"
199
+ id = { `assistant-anthropic` }
200
+ checked = { assistantChoice === 'anthropic' }
201
+ onChange = { ( ) => {
202
+ setAssistantChoice ( 'anthropic' )
203
+ setShowAssistantOptions ( false )
204
+ } }
205
+ />
206
+ < label className = "form-check-label custom-control-label" htmlFor = { `assistant-anthropic` } >
207
+ Anthropic
208
+ </ label >
209
+ </ div >
210
+ </ div >
211
+ ) }
212
+ < button
213
+ onClick = { handleSetAssistant }
214
+ className = "btn btn-dark btn-sm text-secondary mt-2 align-self-end"
215
+ >
216
+ Set assistant
217
+ </ button >
218
+ </ div >
219
+ { contextChoice !== 'none' && contextFiles . length > 0 && (
220
+ < div className = "mt-2 d-flex flex-wrap gap-1 overflow-y-auto" style = { { maxHeight : '110px' } } >
221
+ { contextFiles . slice ( 0 , 6 ) . map ( f => {
222
+ const name = f . split ( '/' ) . pop ( )
223
+ return (
224
+ < span
225
+ key = { f }
226
+ className = "badge badge-info mr-1 aiContext-file text-success"
227
+ style = { { cursor : 'pointer' } }
228
+ onClick = { clearContext }
229
+ >
230
+ { name }
231
+ < i className = "fa fa-times ms-1 ml-1" style = { { cursor : 'pointer' } } > </ i >
232
+ </ span >
233
+ )
234
+ } ) }
235
+ { contextFiles . length > 6 && (
201
236
< span
202
- key = { f }
203
- className = "badge badge-info mr-1 aiContext-file text-success"
237
+ className = "badge badge-info"
204
238
style = { { cursor : 'pointer' } }
205
239
onClick = { clearContext }
206
240
>
207
- { name }
208
- < i className = "fa fa-times ms-1 ml-1" style = { { cursor : 'pointer' } } > </ i >
209
- </ span >
210
- )
211
- } ) }
212
- { contextFiles . length > 6 && (
213
- < span
214
- className = "badge badge-info"
215
- style = { { cursor : 'pointer' } }
216
- onClick = { clearContext }
217
- >
218
241
… { contextFiles . length - 6 } more < i className = "fa fa-times ms-1" style = { { cursor : 'pointer' } } > </ i >
219
- </ span >
220
- ) }
221
- </ div >
222
- ) }
223
- </ div >
242
+ </ span >
243
+ ) }
244
+ </ div >
245
+ ) }
246
+ </ div >
247
+ </ >
224
248
)
225
249
}
0 commit comments