Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - TaskProcessingAPI #1624

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package com.owncloud.android.lib.resources.assistant.v2

import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.assistant.v2.model.Shape
import com.owncloud.android.lib.resources.assistant.v2.model.TaskInputShape
import com.owncloud.android.lib.resources.assistant.v2.model.TaskOutputShape
import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData
Expand All @@ -29,20 +30,24 @@ class AssistantV2Tests : AbstractIT() {
"core:text2text",
"Free text to text prompt",
"Runs an arbitrary prompt through a language model that returns a reply",
listOf(
inputShape =
TaskInputShape(
"Prompt",
"Describe a task that you want the assistant to do or ask a question",
"Text"
)
),
listOf(
input =
Shape(
"Prompt",
"Describe a task that you want the assistant to do or ask a question",
"Text"
)
),
outputShape =
TaskOutputShape(
"Generated reply",
"The generated text from the assistant",
"Text"
output =
Shape(
"Generated reply",
"The generated text from the assistant",
"Text"
)
)
)
)

private fun getSelectedTaskType(): String = "core:text2text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ class GetTaskTypesRemoteOperationV2 : OCSRemoteOperation<List<TaskTypeData>>() {

val supportedTaskTypeList =
taskTypeList?.filter { taskType ->
taskType.inputShape?.any { inputShape ->
inputShape.type == supportedTaskType
} == true &&
taskType.outputShape?.any { outputShape ->
outputShape.type == supportedTaskType
} == true
taskType.inputShape?.input?.type == supportedTaskType &&
taskType.outputShape?.output?.type == supportedTaskType
}

result = RemoteOperationResult(true, getMethod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ data class TaskTypeData(
val id: String?,
val name: String?,
val description: String?,
val inputShape: List<TaskInputShape>?,
val outputShape: List<TaskOutputShape>?
val inputShape: TaskInputShape?,
val outputShape: TaskOutputShape?
)

data class TaskInputShape(
val name: String?,
val description: String?,
val type: String?
val input: Shape?
)

data class TaskOutputShape(
val name: String?,
val description: String?,
val type: String?
val output: Shape?
)

data class Shape(
val name: String,
val description: String,
val type: String
)
Loading