add the supporting to machine translation
This commit is contained in:
parent
749d0fe47f
commit
cc194be0d6
@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<div class="input_containter">
|
||||
<input type="text" v-model="input_text">
|
||||
<input type="text" v-model="input_text" @keyup.enter="translate($event)">
|
||||
<p>{{ translated_text }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { LabApi } from '../../../utils/index'
|
||||
export default {
|
||||
name: 'TranslationHome',
|
||||
components: {},
|
||||
@ -11,13 +13,20 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
translate(text) {
|
||||
this.mnx_navToLink((directory.path))
|
||||
translate($event) {
|
||||
LabApi.translate_text(this.input_text)
|
||||
.then((response) => {
|
||||
this.translated_text = response.data
|
||||
})
|
||||
.catch((error) => {
|
||||
this.mnx_backendErrorHandler(error)
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
input_text: null
|
||||
input_text: null,
|
||||
translated_text: null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,3 +6,4 @@ export { ProviderHubApi } from './providerHub'
|
||||
export { MessageHubApi } from './messageHub'
|
||||
export { HistoryApi } from './history'
|
||||
export { ContentApi } from './content'
|
||||
export { LabApi } from './lab'
|
||||
16
frontend/src/utils/backend/lab.js
Normal file
16
frontend/src/utils/backend/lab.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { backendAxios } from './axios'
|
||||
import { userUtils } from '../store/index'
|
||||
class LabApi {
|
||||
static translate_text(input_text) {
|
||||
let jwt = userUtils.getJwtToken()
|
||||
const request = backendAxios.post('/api/lab/translate_text',
|
||||
{
|
||||
input_text: input_text
|
||||
},
|
||||
{
|
||||
headers: { Authorization: `Bearer ${jwt}` }
|
||||
})
|
||||
return request
|
||||
}
|
||||
}
|
||||
export { LabApi }
|
||||
@ -6,7 +6,8 @@ export {
|
||||
ProviderHubApi,
|
||||
MessageHubApi,
|
||||
HistoryApi,
|
||||
ContentApi
|
||||
ContentApi,
|
||||
LabApi
|
||||
} from './backend/index'
|
||||
|
||||
export { userUtils, userProfileUtils, requestIssueUtils, requestHubUtils } from './store/index'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user