3737
3838 <div class =" input-footer" >
3939 <div class =" footer-left" >
40+ <el-tooltip :content =" dialectTooltip" placement =" top" >
41+ <el-select
42+ v-model =" dialectModel"
43+ class =" dialect-select"
44+ size =" small"
45+ :disabled =" props.loading"
46+ >
47+ <el-option
48+ v-for =" option in props.dialectOptions"
49+ :key =" option.value"
50+ :label =" option.label"
51+ :value =" option.value"
52+ />
53+ </el-select >
54+ </el-tooltip >
4055 <el-tooltip :content =" configureTooltip" placement =" top" >
4156 <el-button
4257 class =" footer-btn configure-btn"
4358 type =" default"
44- :disabled =" props.disabled "
59+ :disabled =" props.loading "
4560 @click =" emit('open-settings')"
4661 >
4762 <el-icon ><Setting /></el-icon >
6681</template >
6782
6883<script setup lang="ts">
69- import { ref , inject , computed } from ' vue'
84+ import { ref , inject , computed , withDefaults } from ' vue'
7085import { Promotion , Setting , WarningFilled , InfoFilled } from ' @element-plus/icons-vue'
71- import type { AppContext } from ' ../types'
86+ import type { AppContext , DatabaseDialect } from ' ../types'
7287
7388interface Props {
7489 loading: boolean
7590 includeExplanation: boolean
7691 provider: string
7792 status: ' connected' | ' disconnected' | ' connecting' | ' setup'
7893 disabled: boolean
79- }
80- const props = defineProps <Props >()
94+ databaseDialect: DatabaseDialect
95+ dialectOptions: Array <{ value: DatabaseDialect ; label: string }>
96+ }
97+ const props = withDefaults (defineProps <Props >(), {
98+ dialectOptions : () => [
99+ { value: ' mysql' as DatabaseDialect , label: ' MySQL' },
100+ { value: ' postgresql' as DatabaseDialect , label: ' PostgreSQL' },
101+ { value: ' sqlite' as DatabaseDialect , label: ' SQLite' }
102+ ]
103+ })
81104
82105interface Emits {
83- (e : ' submit' , prompt : string , options : { includeExplanation: boolean }): void
106+ (e : ' submit' , prompt : string , options : { includeExplanation: boolean ; databaseDialect : DatabaseDialect }): void
84107 (e : ' open-settings' ): void
108+ (e : ' update:databaseDialect' , dialect : DatabaseDialect ): void
85109}
86110const emit = defineEmits <Emits >()
87111
@@ -94,6 +118,7 @@ const prompt = ref('')
94118
95119const configureTooltip = computed (() => t (' ai.tooltip.configure' ))
96120const generateTooltip = computed (() => (props .loading ? t (' ai.message.generating' ) : t (' ai.tooltip.generate' )))
121+ const dialectTooltip = computed (() => t (' ai.tooltip.dialect' ))
97122
98123const providerKey = computed (() => (props .provider === ' local' ? ' ollama' : props .provider ))
99124const providerLabel = computed (() => {
@@ -131,11 +156,17 @@ const statusIcon = computed(() => {
131156const showStatusBanner = computed (() => props .status === ' disconnected' || props .status === ' setup' )
132157const showConfigureLink = showStatusBanner
133158
159+ const dialectModel = computed ({
160+ get : () => props .databaseDialect ,
161+ set : (value : DatabaseDialect ) => emit (' update:databaseDialect' , value )
162+ })
163+
134164function handleSubmit() {
135165 if (! prompt .value .trim () || props .loading || props .disabled ) return
136166
137167 emit (' submit' , prompt .value , {
138- includeExplanation: props .includeExplanation
168+ includeExplanation: props .includeExplanation ,
169+ databaseDialect: props .databaseDialect
139170 })
140171
141172 // Clear input after submit
@@ -205,6 +236,7 @@ function handleSubmit() {
205236.footer-right {
206237 display : flex ;
207238 align-items : center ;
239+ gap : var (--atest-spacing-xs );
208240}
209241
210242.footer-left {
@@ -215,6 +247,15 @@ function handleSubmit() {
215247 justify-content : flex-end ;
216248}
217249
250+ .dialect-select {
251+ min-width : 170px ;
252+ }
253+
254+ .dialect-select :deep(.el-select__wrapper ),
255+ .dialect-select :deep(.el-input__wrapper ) {
256+ border-radius : 10px ;
257+ }
258+
218259.footer-btn {
219260 display : inline-flex ;
220261 justify-content : center ;
@@ -306,6 +347,20 @@ function handleSubmit() {
306347 min-height : 112px ;
307348 }
308349
350+ .input-footer {
351+ grid-template-columns : 1fr ;
352+ }
353+
354+ .footer-left ,
355+ .footer-right {
356+ justify-content : space-between ;
357+ }
358+
359+ .dialect-select {
360+ flex : 1 ;
361+ min-width : 0 ;
362+ }
363+
309364 .footer-btn {
310365 width : 44px ;
311366 height : 44px ;
0 commit comments