@@ -347,19 +347,6 @@ export default {
347
347
fileId,
348
348
})
349
349
},
350
-
351
- async getLastTargetLanguage () {
352
- const { default: axios } = await import (' @nextcloud/axios' )
353
- const { generateUrl } = await import (' @nextcloud/router' )
354
-
355
- const req = {
356
- params: {
357
- key: ' last_target_language' ,
358
- },
359
- }
360
- const url = generateUrl (' /apps/assistant/config' )
361
- return axios .get (url, req)
362
- },
363
350
getTaskTypes () {
364
351
this .loadingTaskTypes = true
365
352
axios .get (generateOcsUrl (' /apps/assistant/api/v1/task-types' ))
@@ -379,37 +366,33 @@ export default {
379
366
this .parseTextFileInputs (taskType)
380
367
}
381
368
382
- this .getLastTargetLanguage ()
383
- .then ((response ) => {
384
- const defaultTargetLanguage = response .data
385
- // add placeholders
386
- taskTypes .forEach (tt => {
387
- if (tt .id === TEXT2TEXT_TASK_TYPE_ID && tt .inputShape .input ) {
388
- tt .inputShape .input .placeholder = t (' assistant' , ' Generate a first draft for a blog post about privacy' )
389
- } else if (tt .id === ' context_chat:context_chat' && tt .inputShape .prompt ) {
390
- tt .inputShape .prompt .placeholder = t (' assistant' , ' What is the venue for the team retreat this quarter?' )
391
- } else if (tt .id === ' core:text2text:summary' && tt .inputShape .input ) {
392
- tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to summarize' )
393
- } else if (tt .id === ' core:text2text:headline' && tt .inputShape .input ) {
394
- tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to generate a headline for' )
395
- } else if (tt .id === ' core:text2text:topics' && tt .inputShape .input ) {
396
- tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to extract the topics from' )
397
- } else if (tt .id === ' core:text2image' && tt .inputShape .input && tt .inputShape .numberOfImages ) {
398
- tt .inputShape .input .placeholder = t (' assistant' , ' landscape trees forest peaceful' )
399
- tt .inputShape .numberOfImages .placeholder = t (' assistant' , ' a number' )
400
- } else if (tt .id === ' core:contextwrite' && tt .inputShape .source_input && tt .inputShape .style_input ) {
401
- tt .inputShape .style_input .placeholder = t (' assistant' , ' Shakespeare or an example of the style' )
402
- tt .inputShape .source_input .placeholder = t (' assistant' , ' A description of what you need or some original content' )
403
- // set defaults for translate
404
- } else if (tt .id === ' core:text2text:translate' ) {
405
- if (defaultTargetLanguage) {
406
- tt .inputShapeDefaults .target_language = defaultTargetLanguage
407
- }
408
- tt .inputShapeDefaults .origin_language = ' detect_language'
409
- }
410
- })
411
- this .taskTypes = taskTypes
412
- })
369
+ // add placeholders
370
+ taskTypes .forEach (tt => {
371
+ if (tt .id === TEXT2TEXT_TASK_TYPE_ID && tt .inputShape .input ) {
372
+ tt .inputShape .input .placeholder = t (' assistant' , ' Generate a first draft for a blog post about privacy' )
373
+ } else if (tt .id === ' context_chat:context_chat' && tt .inputShape .prompt ) {
374
+ tt .inputShape .prompt .placeholder = t (' assistant' , ' What is the venue for the team retreat this quarter?' )
375
+ } else if (tt .id === ' core:text2text:summary' && tt .inputShape .input ) {
376
+ tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to summarize' )
377
+ } else if (tt .id === ' core:text2text:headline' && tt .inputShape .input ) {
378
+ tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to generate a headline for' )
379
+ } else if (tt .id === ' core:text2text:topics' && tt .inputShape .input ) {
380
+ tt .inputShape .input .placeholder = t (' assistant' , ' Type or paste the text to extract the topics from' )
381
+ } else if (tt .id === ' core:text2image' && tt .inputShape .input && tt .inputShape .numberOfImages ) {
382
+ tt .inputShape .input .placeholder = t (' assistant' , ' landscape trees forest peaceful' )
383
+ tt .inputShape .numberOfImages .placeholder = t (' assistant' , ' a number' )
384
+ } else if (tt .id === ' core:contextwrite' && tt .inputShape .source_input && tt .inputShape .style_input ) {
385
+ tt .inputShape .style_input .placeholder = t (' assistant' , ' Shakespeare or an example of the style' )
386
+ tt .inputShape .source_input .placeholder = t (' assistant' , ' A description of what you need or some original content' )
387
+ } else if (tt .id === ' core:text2text:translate' ) {
388
+ tt .inputShapeDefaults .origin_language = ' detect_language'
389
+ const defaultTargetLanguage = OCA .Assistant .last_target_language
390
+ if (defaultTargetLanguage) {
391
+ tt .inputShapeDefaults .target_language = defaultTargetLanguage
392
+ }
393
+ }
394
+ })
395
+ this .taskTypes = taskTypes
413
396
})
414
397
.catch ((error ) => {
415
398
console .error (error)
0 commit comments