Skip to content

Commit ce0f466

Browse files
Merge pull request #15079 from nextcloud/bugfix/filter-chat-type-assistant
BugFix - Filter Only One TextInput and one TextOutput Task Types
2 parents 477ee2f + bfafd7f commit ce0f466

7 files changed

Lines changed: 52 additions & 30 deletions

File tree

app/src/androidTest/java/com/nextcloud/client/assistant/AssistantRepositoryTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class AssistantRepositoryTests : AbstractOnServerIT() {
6262
"core:text2text",
6363
"Free text to text prompt",
6464
"Runs an arbitrary prompt through a language model that returns a reply",
65-
null,
66-
null
65+
emptyMap(),
66+
emptyMap()
6767
)
6868
val result = sut?.createTask(input, taskType)
6969
assertTrue(result?.isSuccess == true)

app/src/main/java/com/nextcloud/client/assistant/component/AddTaskAlertDialog.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import com.owncloud.android.R
2323

2424
@Composable
2525
fun AddTaskAlertDialog(
26-
title: String?,
26+
title: String,
2727
description: String?,
2828
defaultInput: String = "",
2929
addTask: (String) -> Unit,
@@ -34,7 +34,7 @@ fun AddTaskAlertDialog(
3434
}
3535

3636
SimpleAlertDialog(
37-
title = title ?: "",
37+
title = title,
3838
description = description ?: "",
3939
dismiss = { dismiss() },
4040
onComplete = {

app/src/main/java/com/nextcloud/client/assistant/model/ScreenOverlayState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ sealed class ScreenOverlayState {
5050
task.type,
5151
activity.getString(R.string.assistant_screen_add_task_alert_dialog_title),
5252
null,
53-
null,
54-
null
53+
emptyMap(),
54+
emptyMap()
5555
)
5656
val newState = AddTask(taskType, getInput() ?: "")
5757
onComplete(newState)

app/src/main/java/com/nextcloud/client/assistant/repository/AssistantMockRepository.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,29 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult
1212
import com.owncloud.android.lib.resources.assistant.v2.model.Shape
1313
import com.owncloud.android.lib.resources.assistant.v2.model.Task
1414
import com.owncloud.android.lib.resources.assistant.v2.model.TaskInput
15-
import com.owncloud.android.lib.resources.assistant.v2.model.TaskInputShape
1615
import com.owncloud.android.lib.resources.assistant.v2.model.TaskOutput
17-
import com.owncloud.android.lib.resources.assistant.v2.model.TaskOutputShape
1816
import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData
1917

2018
@Suppress("MagicNumber")
2119
class AssistantMockRepository(private val giveEmptyTasks: Boolean = false) : AssistantRepositoryType {
2220
override fun getTaskTypes(): List<TaskTypeData> {
2321
return listOf(
2422
TaskTypeData(
25-
"core:text2text",
26-
"Free text to text prompt",
27-
"Runs an arbitrary prompt through a language model that returns a reply",
28-
inputShape = TaskInputShape(
29-
input = Shape(
30-
"Prompt",
31-
"Describe a task that you want the assistant to do or ask a question",
32-
"Text"
23+
id = "core:text2text",
24+
name = "Free text to text prompt",
25+
description = "Runs an arbitrary prompt through a language model that returns a reply",
26+
inputShape = mapOf(
27+
"input" to Shape(
28+
name = "Prompt",
29+
description = "Describe a task that you want the assistant to do or ask a question",
30+
type = "Text"
3331
)
3432
),
35-
outputShape = TaskOutputShape(
36-
output = Shape(
37-
"Generated reply",
38-
"The generated text from the assistant",
39-
"Text"
33+
outputShape = mapOf(
34+
"output" to Shape(
35+
name = "Generated reply",
36+
description = "The generated text from the assistant",
37+
type = "Text"
4038
)
4139
)
4240
)

app/src/main/java/com/nextcloud/client/assistant/taskTypes/TaskTypesRow.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ fun TaskTypesRow(selectedTaskType: TaskTypeData?, data: List<TaskTypeData>, sele
3838
}
3939
) {
4040
data.forEach { taskType ->
41-
taskType.name?.let { taskTypeName ->
41+
if (taskType.name.isNotEmpty()) {
4242
Tab(
4343
selected = selectedTaskType?.id == taskType.id,
4444
onClick = { selectTaskType(taskType) },
4545
selectedContentColor = colorResource(R.color.text_color),
4646
unselectedContentColor = colorResource(R.color.disabled_text),
47-
text = { Text(text = taskTypeName) }
47+
text = { Text(text = taskType.name) }
4848
)
4949
}
5050
}
@@ -54,12 +54,12 @@ fun TaskTypesRow(selectedTaskType: TaskTypeData?, data: List<TaskTypeData>, sele
5454
@Composable
5555
@Preview
5656
private fun TaskTypesRowPreview() {
57-
val selectedTaskType = TaskTypeData("1", "Free text to text prompt", "", null, null)
57+
val selectedTaskType = TaskTypeData("1", "Free text to text prompt", "", emptyMap(), emptyMap())
5858
val taskTypes = listOf(
59-
TaskTypeData("1", "Free text to text prompt", "", null, null),
60-
TaskTypeData("2", "Extract topics", "", null, null),
61-
TaskTypeData("3", "Generate Headline", "", null, null),
62-
TaskTypeData("4", "Summarize", "", null, null)
59+
TaskTypeData("1", "Free text to text prompt", "", emptyMap(), emptyMap()),
60+
TaskTypeData("2", "Extract topics", "", emptyMap(), emptyMap()),
61+
TaskTypeData("3", "Generate Headline", "", emptyMap(), emptyMap()),
62+
TaskTypeData("4", "Summarize", "", emptyMap(), emptyMap())
6363
)
6464

6565
TaskTypesRow(selectedTaskType, taskTypes) { }

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
buildscript {
1212
ext {
13-
androidLibraryVersion ="8c14b444c709e91462fd503af87608a7fa40e90b"
13+
androidLibraryVersion ="0edf15760b8a086ab9969e103c7229dad973efbd"
1414
androidCommonLibraryVersion = "0.26.0"
1515
androidPluginVersion = "8.9.2"
1616
androidxMediaVersion = "1.5.1"

gradle/verification-metadata.xml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4835,7 +4835,7 @@
48354835
</component>
48364836
<component group="androidx.lifecycle" name="lifecycle-viewmodel" version="2.3.1">
48374837
<artifact name="lifecycle-viewmodel-2.3.1.aar">
4838-
<sha256 value="b6db4c274a12ff85a4747e1e6669c7e98aefa2571ace9d1f1a6fa6be417ce838" origin="Generated by Gradle"/>
4838+
<sha256 value="b6db4c274a12ff85a4747e1e6669c7e98aefa2571ace9d1f1a6fa6be417ce838" origin="Generated by Gradle" reason="Artifact is not signed"/>
48394839
</artifact>
48404840
<artifact name="lifecycle-viewmodel-2.3.1.module">
48414841
<sha256 value="a531853dfe316c90b7466d24be94dbe60a60ef54a52c904c86381986202e51f4" origin="Generated by Gradle" reason="Artifact is not signed"/>
@@ -12309,6 +12309,14 @@
1230912309
<sha256 value="c29795ee883fc3364b2f16be5b9246b927271b961214f1a661b2caa2f42459a8" origin="Generated by Gradle" reason="Artifact is not signed"/>
1231012310
</artifact>
1231112311
</component>
12312+
<component group="com.github.nextcloud" name="android-library" version="0edf15760b8a086ab9969e103c7229dad973efbd">
12313+
<artifact name="android-library-0edf15760b8a086ab9969e103c7229dad973efbd.aar">
12314+
<sha256 value="37176d4d4a54d4176436355c5f948a4558c91458a03a20d874ae6da0739e7411" origin="Generated by Gradle" reason="Artifact is not signed"/>
12315+
</artifact>
12316+
<artifact name="android-library-0edf15760b8a086ab9969e103c7229dad973efbd.module">
12317+
<sha256 value="c58a8d03f5dd0801523612b0012983ae3cfe45d6d323d35d9fa018484f54af89" origin="Generated by Gradle" reason="Artifact is not signed"/>
12318+
</artifact>
12319+
</component>
1231212320
<component group="com.github.nextcloud" name="android-library" version="18f01f7cdffa09bbddbcb610d222fb6df46dae47">
1231312321
<artifact name="android-library-18f01f7cdffa09bbddbcb610d222fb6df46dae47.aar">
1231412322
<sha256 value="c6c70775d49d935e7691f43fee0ff51c2c0df03c041fd75da92cf1f0df1385a7" origin="Generated by Gradle" reason="Artifact is not signed"/>
@@ -12637,6 +12645,14 @@
1263712645
<sha256 value="ed3adfc1e8120360bdaa26c4d0337c54d288cbb2ca215cf07c38d034ae853fcc" origin="Generated by Gradle" reason="Artifact is not signed"/>
1263812646
</artifact>
1263912647
</component>
12648+
<component group="com.github.nextcloud" name="android-library" version="8fc329be4d">
12649+
<artifact name="android-library-8fc329be4d.aar">
12650+
<sha256 value="37176d4d4a54d4176436355c5f948a4558c91458a03a20d874ae6da0739e7411" origin="Generated by Gradle" reason="Artifact is not signed"/>
12651+
</artifact>
12652+
<artifact name="android-library-8fc329be4d.module">
12653+
<sha256 value="0243c635c4b81c057040bcb23ff7df3bfab222b7d8a895174cdc501299cd40d6" origin="Generated by Gradle" reason="Artifact is not signed"/>
12654+
</artifact>
12655+
</component>
1264012656
<component group="com.github.nextcloud" name="android-library" version="9e3c0046d242d8395855772d1105cb0b9fdd9f1f">
1264112657
<artifact name="android-library-9e3c0046d242d8395855772d1105cb0b9fdd9f1f.aar">
1264212658
<sha256 value="8f6337f2494d67ae9732c57850172588b9bf87f4f2ca4aa74e5f8f79f1192928" origin="Generated by Gradle" reason="Artifact is not signed"/>
@@ -12765,6 +12781,14 @@
1276512781
<sha256 value="23be4020754cbb39a6d197281a0d55f84e8851b13afa204081e29132d785a340" origin="Generated by Gradle" reason="Artifact is not signed"/>
1276612782
</artifact>
1276712783
</component>
12784+
<component group="com.github.nextcloud" name="android-library" version="d0e6fa5c8b">
12785+
<artifact name="android-library-d0e6fa5c8b.aar">
12786+
<sha256 value="a6ed682f5e0c651759519963e8470fdd3aabcf0104868e8455811d7b7dfa1405" origin="Generated by Gradle" reason="Artifact is not signed"/>
12787+
</artifact>
12788+
<artifact name="android-library-d0e6fa5c8b.module">
12789+
<sha256 value="b29d8928cba81c13d016ac2e0b7a7d40f1b2e71f8229d65efcffb871a27576de" origin="Generated by Gradle" reason="Artifact is not signed"/>
12790+
</artifact>
12791+
</component>
1276812792
<component group="com.github.nextcloud" name="android-library" version="d5f21fa1ec5b67c564983b0c8a07bc3acd96f695">
1276912793
<artifact name="android-library-d5f21fa1ec5b67c564983b0c8a07bc3acd96f695.aar">
1277012794
<sha256 value="95c86f501a4c1a2e055ba2d1fe68f5ffeed3613492bdaf0594abbae4b21b9227" origin="Generated by Gradle" reason="Artifact is not signed"/>

0 commit comments

Comments
 (0)