Skip to content

Commit

Permalink
fix form validation for enums, fix style for enums, set sort order fo…
Browse files Browse the repository at this point in the history
…r the new translate task type

Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Jul 25, 2024
1 parent 366ad61 commit d98f014
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/Service/AssistantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\TaskProcessing\TaskTypes\TextToTextHeadline;
use OCP\TaskProcessing\TaskTypes\TextToTextSummary;
use OCP\TaskProcessing\TaskTypes\TextToTextTopics;
use OCP\TaskProcessing\TaskTypes\TextToTextTranslate;
use Parsedown;
use PhpOffice\PhpWord\IOFactory;
use Psr\Log\LoggerInterface;
Expand All @@ -56,7 +57,7 @@ class AssistantService {
'context_chat:context_chat' => 3,
'legacy:TextProcessing:OCA\ContextChat\TextProcessing\ContextChatTaskType' => 3,
AudioToText::ID => 4,
// TODO translate: 5 (translate is not migrated to taskProcessing yet)
TextToTextTranslate::ID => 5,

Check failure on line 60 in lib/Service/AssistantService.php

View workflow job for this annotation

GitHub Actions / Psalm check

UndefinedClass

lib/Service/AssistantService.php:60:3: UndefinedClass: Class, interface or enum named OCP\TaskProcessing\TaskTypes\TextToTextTranslate does not exist (see https://psalm.dev/019)
ContextWrite::ID => 6,
TextToImage::ID => 7,
TextToTextSummary::ID => 8,
Expand Down
2 changes: 1 addition & 1 deletion src/components/AssistantTextProcessingForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default {
}
const fieldType = taskType.inputShape[k].type
const value = this.myInputs[k]
return (fieldType === SHAPE_TYPE_NAMES.Text && typeof value === 'string' && !!value?.trim())
return ([SHAPE_TYPE_NAMES.Text, SHAPE_TYPE_NAMES.Enum].includes(fieldType) && typeof value === 'string' && !!value?.trim())
|| ([
SHAPE_TYPE_NAMES.Number,
SHAPE_TYPE_NAMES.File,
Expand Down
10 changes: 5 additions & 5 deletions src/components/fields/EnumField.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="number-field">
<div class="enum-field">
<label :for="'input-' + fieldKey">
{{ field.description }}
</label>
<NcSelect
:id="'input-' + fieldKey"
class="enum-field"
class="enum-field-input"
:value="selectValue"
:options="options"
:clearable="true"
Expand Down Expand Up @@ -84,13 +84,13 @@ export default {
</script>
<style lang="scss">
.number-field {
.enum-field {
display: flex;
flex-direction: column;
align-items: start;
.number-input-field {
width: 300px !important;
&-input {
min-width: 300px !important;
margin-top: 0 !important;
}
}
Expand Down

0 comments on commit d98f014

Please sign in to comment.