File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
ychat/src/commonMain/kotlin/co/yml/ychat Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import co.yml.ychat.data.dto.ImageGenerationsParamsDto
55import co.yml.ychat.domain.model.ImageGenerated
66import co.yml.ychat.domain.model.ImageGenerationsParams
77
8- internal fun ImageGenerationsDto.toImageGenerated (): List <ImageGenerated > {
8+ internal fun ImageGenerationsDto.toImageGenerated (): List <String > {
99 return this .data.map {
10- ImageGenerated ( it.url)
10+ it.url
1111 }
1212}
1313
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import co.yml.ychat.domain.model.ImageGenerationsParams
88
99internal data class ImageGenerationsUseCase (private val chatGptApi : ChatGptApi ) {
1010
11- suspend fun requestImageGenerations (params : ImageGenerationsParams ): List <ImageGenerated > {
11+ suspend fun requestImageGenerations (params : ImageGenerationsParams ): List <String > {
1212 val requestDto = params.toImageGenerationsParamsDto()
1313 val response = chatGptApi.imageGenerations(requestDto)
1414 return response.getBodyOrThrow().toImageGenerated()
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ interface ImageGenerations {
1414 fun setResponseFormat (responseFormat : String ): ImageGenerations
1515
1616 @Throws(CancellationException ::class , ChatGptException ::class )
17- suspend fun execute (prompt : String ): List <ImageGenerated >
17+ suspend fun execute (prompt : String ): List <String >
1818
1919 fun execute (prompt : String , callback : YChat .Callback <List <String >>)
2020}
Original file line number Diff line number Diff line change @@ -34,15 +34,15 @@ internal class ImageGenerationsImpl(
3434 return this
3535 }
3636
37- override suspend fun execute (prompt : String ): List <ImageGenerated > {
37+ override suspend fun execute (prompt : String ): List <String > {
3838 params.prompt = prompt
3939 return imageGenerationsUseCase.requestImageGenerations(params)
4040 }
4141
4242 override fun execute (prompt : String , callback : YChat .Callback <List <String >>) {
4343 scope.launch {
4444 kotlin.runCatching { execute(prompt) }
45- .onSuccess { callback.onSuccess(it.map { it.url } ) }
45+ .onSuccess { callback.onSuccess(it) }
4646 .onFailure { callback.onError(it) }
4747 }
4848 }
You can’t perform that action at this time.
0 commit comments