Chats as a daily driver: agent chats, photos, copy, rename, offline and recovery
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
- New agent chat (Agents tab FAB, route new-agent): GET /devices for the devices linked now; a device chip, an optional folder (empty = the device's first root, the server's rule) and the mode (manual/edit/auto/plan) go into POST /chats as kind/device/directory/mode. No device linked: a sentence saying how. An open agent chat's mode is a chip too. - Attach: Take a photo (TakePicture into a FileProvider cache file, deleted once uploaded; no CAMERA permission), Choose photos (PickMultipleVisualMedia), Choose files. - Copy under every reply (its text steps) and user message; Rename chat in the menu. - The new chat's effort is held until the first message and sent with it (EffortChip called PATCH, which needs a chat, so the choice was dropped). - Follow the reply while it streams, decided when the person's own scroll comes to rest; the first scroll goes to the real last item (the "older" row shifted the index by one). - ui/Errors.kt explain(): the server's sentence for a refusal, one "cannot be reached" sentence for UnknownHost/Connect/SocketTimeout/NoRouteToHost, used everywhere an error was shown raw. - A failed send hands its text and attachments back to the composer. A replaced follow's CancellationException is no longer shown as an error. A refused stream re-reads the chat. - The chat list reloads on resume (quietly if rows are shown) and offers Try again. - Strings: 15 new; Rename chat, Copy message, Copied., Save, Try again, Device and Auto from the server's catalogue, the rest translated in strings_own.json. "Plan" was the price plan in de/fr/hu (Tarif/Forfait/Csomag) and "Manual" untranslated: own entries fix both. - ClientTest: an agent chat's body, a plain chat's, and what counts as unreachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26 files changed
+736
-87
No files matched your search
@@ -7,6 +7,15 @@ is in alpha and releases come off `main`.
|
||||
|
||||
### Added
|
||||
|
||||
- **New agent chat**, on the Agents tab: pick one of the devices linked right now (a computer
|
||||
running `lembas service`), optionally a folder on it, and the mode (Manual, Edit, Auto, Plan),
|
||||
and the first message starts the chat there. With no device linked, the screen says how to
|
||||
link one. An open agent chat's mode can be changed from the same chip.
|
||||
- **Photos**: the attach button offers Take a photo (the camera app, no camera permission for
|
||||
LLeMbas itself), Choose photos (Android's photo picker) and Choose files.
|
||||
- **Copy** a reply or one of your messages with the copy button under it.
|
||||
- **Rename chat** in the chat's menu.
|
||||
- **Try again** beside an error on the chat list.
|
||||
- **Test builds for every change**: each push to `dev` leaves an installable APK on the CI run,
|
||||
signed with a public test key so a newer test build installs over an older one. The version
|
||||
in Settings › About carries the run's number.
|
||||
@@ -14,6 +23,25 @@ is in alpha and releases come off `main`.
|
||||
### Changed
|
||||
|
||||
- A beta (`vX.Y.Z-beta.N`) is published on GitHub as a pre-release by itself.
|
||||
- **The chat list is read again whenever you come back to it**, from a chat or another app, so a
|
||||
new chat, a new title or a finished reply shows without pulling to refresh.
|
||||
- **A reply being written stays in view**: the chat follows it to the end, unless you have
|
||||
scrolled up to read, and picks up again once you scroll back down.
|
||||
- **An instance that cannot be reached says so in one sentence** -- no network, an address that
|
||||
only resolves at home, a server that is down -- instead of a raw network error, everywhere:
|
||||
sign-in, the chats, a chat, Files, the viewer, the assistant and Share.
|
||||
- The effort chosen for a **new** chat is now sent with its first message (it was lost until the
|
||||
chat existed).
|
||||
- The agent mode "Manual" is translated, and "Plan" no longer reads as a price plan in German,
|
||||
French and Hungarian.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A message that could not be sent is not lost**: its words and attachments go back into the
|
||||
composer, with the reason.
|
||||
- Leaving a chat while a reply was streaming could show a "cancelled" error on the next one.
|
||||
- When the server refused the stream of a reply (the chat deleted elsewhere, the sign-in
|
||||
revoked), the half-drawn reply stayed on screen; the chat is now read again.
|
||||
|
||||
- **Pinned to LLeMbas server 2.0.0-beta.4**: the contract, the theme and the strings come from that
|
||||
release. Nothing a person sees changes; the server's API is the same as in beta.1.
|
||||
|
||||
@@ -123,5 +123,16 @@
|
||||
<receiver
|
||||
android:name=".push.CardActionReceiver"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- A photo for the composer: the camera app writes into one file in the cache. -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.files"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -89,6 +89,7 @@ class MainActivity : ComponentActivity() {
|
||||
ChatsScreen(
|
||||
onOpen = { nav.navigate("chat/$it") },
|
||||
onNew = { nav.navigate("new") },
|
||||
onNewAgent = { nav.navigate("new-agent") },
|
||||
onSettings = { nav.navigate("settings") },
|
||||
onFiles = { nav.navigate("files") },
|
||||
)
|
||||
@@ -102,6 +103,16 @@ class MainActivity : ComponentActivity() {
|
||||
},
|
||||
)
|
||||
}
|
||||
composable("new-agent") {
|
||||
ChatScreen(
|
||||
chatId = null,
|
||||
agent = true,
|
||||
onBack = { nav.popBackStack() },
|
||||
onOpened = { id ->
|
||||
nav.navigate("chat/$id") { popUpTo("new-agent") { inclusive = true } }
|
||||
},
|
||||
)
|
||||
}
|
||||
composable("chat/{id}") { entry ->
|
||||
ChatScreen(chatId = entry.arguments?.getString("id"), onBack = { nav.popBackStack() })
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import java.io.IOException
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.coroutines.resumeWithException
|
||||
|
||||
/** Where a new agent chat runs: a linked device ([LinkedDevice.id]) and a folder on it. */
|
||||
data class AgentTarget(val device: String, val directory: String = "")
|
||||
|
||||
/** A refusal from the server, in its own words (`{"detail": "…"}`). */
|
||||
class ApiException(val status: Int, message: String) : IOException(message)
|
||||
|
||||
@@ -168,6 +171,7 @@ class ApiClient(val base: String, private val token: String, val http: OkHttpCli
|
||||
temporary: Boolean = false,
|
||||
effort: String? = null,
|
||||
mode: String? = null,
|
||||
agent: AgentTarget? = null,
|
||||
): NewChat = send(
|
||||
"POST",
|
||||
"/chats",
|
||||
@@ -178,6 +182,14 @@ class ApiClient(val base: String, private val token: String, val http: OkHttpCli
|
||||
effort?.let { put("effort", it) }
|
||||
mode?.let { put("mode", it) }
|
||||
put("temporary", temporary)
|
||||
// An agent chat runs on a linked device; an empty directory is the device's first
|
||||
// allowed one. A device that is no longer linked makes it an ordinary chat on the
|
||||
// server, rather than losing the message.
|
||||
agent?.let {
|
||||
put("kind", "agent")
|
||||
put("device", it.device)
|
||||
if (it.directory.isNotBlank()) put("directory", it.directory.trim())
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.StreamClient
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.push.Notifications
|
||||
import eu.llembas.android.ui.explain
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -81,7 +82,7 @@ class AssistController(private val context: Context, private val scope: Coroutin
|
||||
_state.update { it.copy(busy = false) }
|
||||
if (text.isNotBlank()) ask(text, spoken = true)
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(busy = false, error = e.message) }
|
||||
_state.update { it.copy(busy = false, error = context.explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +116,7 @@ class AssistController(private val context: Context, private val scope: Coroutin
|
||||
if (words.isNotBlank()) speaker.play(api.speech(plain(words)))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(error = e.message ?: e.javaClass.simpleName) }
|
||||
_state.update { it.copy(error = context.explain(e)) }
|
||||
} finally {
|
||||
_state.update { it.copy(busy = false) }
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import eu.llembas.android.MainActivity
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.push.Notifications
|
||||
import eu.llembas.android.ui.explain
|
||||
import eu.llembas.android.ui.theme.LembasTheme
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -103,7 +104,7 @@ class ShareActivity : ComponentActivity() {
|
||||
)
|
||||
finish()
|
||||
} catch (e: Exception) {
|
||||
failure.value = e.message ?: e.javaClass.simpleName
|
||||
failure.value = explain(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package eu.llembas.android.ui
|
||||
|
||||
import android.content.Context
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.api.ApiException
|
||||
import java.net.ConnectException
|
||||
import java.net.NoRouteToHostException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
|
||||
/**
|
||||
* A failure in words a person can act on. The server's refusal is its own sentence; a phone
|
||||
* that cannot reach the instance at all -- no network, a name that does not resolve off the
|
||||
* home network, a server that is down -- is one sentence saying so, rather than
|
||||
* "Unable to resolve host" or "failed to connect to /…:443". A certificate the phone does not
|
||||
* trust keeps its own message: that one names what to fix.
|
||||
*/
|
||||
fun Context.explain(e: Throwable): String = when {
|
||||
e is ApiException -> e.message?.ifBlank { null } ?: getString(R.string.offline)
|
||||
unreachable(e) -> getString(R.string.offline)
|
||||
else -> e.message?.ifBlank { null } ?: e.javaClass.simpleName
|
||||
}
|
||||
|
||||
/** Whether a failure means "the instance cannot be reached" rather than "it said no". */
|
||||
fun unreachable(e: Throwable): Boolean = e is UnknownHostException || e is ConnectException || e is SocketTimeoutException || e is NoRouteToHostException
|
||||
@@ -4,10 +4,16 @@ package eu.llembas.android.ui.chat
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.PickVisualMediaRequest
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.gestures.scrollBy
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -21,6 +27,7 @@ import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -29,9 +36,12 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.automirrored.filled.Send
|
||||
import androidx.compose.material.icons.filled.AttachFile
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.ContentCopy
|
||||
import androidx.compose.material.icons.filled.Folder
|
||||
import androidx.compose.material.icons.filled.Mic
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.Stop
|
||||
import androidx.compose.material.icons.filled.Terminal
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.AssistChip
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
@@ -72,6 +82,8 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.api.AgentTarget
|
||||
import eu.llembas.android.api.LinkedDevice
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.ModelInfo
|
||||
import eu.llembas.android.api.ShowCard
|
||||
@@ -83,7 +95,13 @@ import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit = {}, model: ChatViewModel = viewModel(key = chatId ?: "new")) {
|
||||
fun ChatScreen(
|
||||
chatId: String?,
|
||||
onBack: () -> Unit,
|
||||
onOpened: (String) -> Unit = {},
|
||||
agent: Boolean = false,
|
||||
model: ChatViewModel = viewModel(key = chatId ?: if (agent) "new-agent" else "new"),
|
||||
) {
|
||||
val state by model.state.collectAsStateWithLifecycle()
|
||||
val palette = LocalPalette.current
|
||||
val list = rememberLazyListState()
|
||||
@@ -91,8 +109,16 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
var menu by remember { mutableStateOf(false) }
|
||||
var editing by remember { mutableStateOf<Message?>(null) }
|
||||
var showing by remember { mutableStateOf<ShowCard?>(null) }
|
||||
var renaming by remember { mutableStateOf(false) }
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
val copy: (String) -> Unit = { text ->
|
||||
context.getSystemService(ClipboardManager::class.java)?.setPrimaryClip(ClipData.newPlainText("LLeMbas", text))
|
||||
// Android 13 and newer say "Copied" themselves.
|
||||
if (Build.VERSION.SDK_INT < 33) scope.launch { snackbar.showSnackbar(context.getString(R.string.copied)) }
|
||||
}
|
||||
|
||||
LaunchedEffect(chatId) { model.open(chatId) }
|
||||
LaunchedEffect(chatId) { model.open(chatId, agent = agent && chatId == null) }
|
||||
// A new chat gets its id from its first message; the route follows, so Back and a
|
||||
// rotation land on the chat rather than on an empty composer.
|
||||
LaunchedEffect(state.chat?.id) { state.chat?.id?.let { if (it != chatId) onOpened(it) } }
|
||||
@@ -104,8 +130,20 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
}
|
||||
val live = state.live
|
||||
val rows = state.messages
|
||||
LaunchedEffect(rows.size, live?.shown?.size) {
|
||||
if (rows.isNotEmpty()) list.animateScrollToItem(rows.size - 1)
|
||||
// To the end when the transcript grows, and while a reply is being written -- but only if
|
||||
// the person is at the end already: reading back up is not interrupted by the next line.
|
||||
// Whether to follow is decided when the person's own scroll comes to rest, not when a
|
||||
// line arrives: by then the line has already made the list longer than the screen.
|
||||
var following by remember { mutableStateOf(true) }
|
||||
LaunchedEffect(list.isScrollInProgress) {
|
||||
if (!list.isScrollInProgress) following = !list.canScrollForward
|
||||
}
|
||||
LaunchedEffect(rows.size) {
|
||||
if (rows.isNotEmpty()) list.toEnd()
|
||||
}
|
||||
val growth = live?.let { it.shown.size * 100_000 + (it.tail.text.length + it.tail.thinking.length) } ?: 0
|
||||
LaunchedEffect(growth) {
|
||||
if (growth > 0 && following) list.toEnd()
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
@@ -119,7 +157,7 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
},
|
||||
title = {
|
||||
Text(
|
||||
state.chat?.title?.ifBlank { null } ?: stringResource(R.string.new_chat),
|
||||
state.chat?.title?.ifBlank { null } ?: stringResource(if (agent) R.string.new_agent_chat else R.string.new_chat),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
@@ -130,6 +168,10 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
Icon(Icons.Filled.MoreVert, contentDescription = stringResource(R.string.more))
|
||||
}
|
||||
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.rename_chat)) }, onClick = {
|
||||
menu = false
|
||||
renaming = true
|
||||
})
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.continue_reply)) }, onClick = {
|
||||
menu = false
|
||||
model.continueChat()
|
||||
@@ -173,7 +215,7 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
if (live != null && live.status.isNotBlank()) {
|
||||
Text(live.status, style = MaterialTheme.typography.labelSmall, color = palette.inkFaint, modifier = Modifier.padding(horizontal = 16.dp))
|
||||
}
|
||||
Composer(model, state)
|
||||
Composer(model, state, agent)
|
||||
}
|
||||
},
|
||||
) { padding ->
|
||||
@@ -197,9 +239,10 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
when {
|
||||
message.isUser -> Column {
|
||||
UserBubble(message)
|
||||
if (!message.machine && live == null) {
|
||||
TextButton(onClick = { editing = message }, modifier = Modifier.align(Alignment.End)) {
|
||||
Text(stringResource(R.string.edit))
|
||||
Row(Modifier.align(Alignment.End), verticalAlignment = Alignment.CenterVertically) {
|
||||
message.text?.takeIf { it.isNotBlank() }?.let { words -> CopyButton { copy(words) } }
|
||||
if (!message.machine && live == null) {
|
||||
TextButton(onClick = { editing = message }) { Text(stringResource(R.string.edit)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,8 +256,10 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
else -> Column {
|
||||
Steps(message.steps, onShow = { showing = it })
|
||||
ReplyFoot(message)
|
||||
if (live == null && message == rows.lastOrNull()) {
|
||||
Row {
|
||||
val words = replyText(message)
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
if (words.isNotBlank()) CopyButton { copy(words) }
|
||||
if (live == null && message == rows.lastOrNull()) {
|
||||
TextButton(onClick = { model.regenerate(message) }) { Text(stringResource(R.string.regenerate)) }
|
||||
}
|
||||
}
|
||||
@@ -243,6 +288,22 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
state.chat?.id?.let { id -> FileViewer(id, file, onClose = { showing = null }) }
|
||||
}
|
||||
|
||||
if (renaming) {
|
||||
var title by remember { mutableStateOf(state.chat?.title.orEmpty()) }
|
||||
AlertDialog(
|
||||
onDismissRequest = { renaming = false },
|
||||
title = { Text(stringResource(R.string.rename_chat)) },
|
||||
text = { OutlinedTextField(value = title, onValueChange = { title = it }, singleLine = true, modifier = Modifier.fillMaxWidth()) },
|
||||
confirmButton = {
|
||||
TextButton(enabled = title.isNotBlank(), onClick = {
|
||||
model.rename(title)
|
||||
renaming = false
|
||||
}) { Text(stringResource(R.string.save)) }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { renaming = false }) { Text(stringResource(R.string.cancel)) } },
|
||||
)
|
||||
}
|
||||
|
||||
editing?.let { message ->
|
||||
var text by remember(message.id) { mutableStateOf(message.text.orEmpty()) }
|
||||
AlertDialog(
|
||||
@@ -260,28 +321,93 @@ fun ChatScreen(chatId: String?, onBack: () -> Unit, onOpened: (String) -> Unit =
|
||||
}
|
||||
}
|
||||
|
||||
/** To the very end of the transcript: the last row, then down to its foot however tall it is. */
|
||||
private suspend fun LazyListState.toEnd() {
|
||||
val last = layoutInfo.totalItemsCount - 1
|
||||
if (last < 0) return
|
||||
scrollToItem(last)
|
||||
scrollBy(1_000_000f)
|
||||
}
|
||||
|
||||
/** A reply's own words, as the person would copy them: its text steps, in order. */
|
||||
private fun replyText(message: Message): String =
|
||||
message.steps.filter { it.kind == "text" }.mapNotNull { it.markdown }.joinToString("\n\n").ifBlank { message.text.orEmpty() }
|
||||
|
||||
@Composable
|
||||
private fun CopyButton(onClick: () -> Unit) {
|
||||
IconButton(onClick = onClick) {
|
||||
Icon(
|
||||
Icons.Filled.ContentCopy,
|
||||
contentDescription = stringResource(R.string.copy_message),
|
||||
tint = LocalPalette.current.inkFaint,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** The agent modes, as the web page offers them, in the order of how much the model may do. */
|
||||
private val AGENT_MODES = listOf("manual", "edit", "auto", "plan")
|
||||
|
||||
@Composable
|
||||
private fun modeName(mode: String): String = when (mode) {
|
||||
"manual" -> stringResource(R.string.mode_manual)
|
||||
"edit" -> stringResource(R.string.mode_edit)
|
||||
"auto" -> stringResource(R.string.mode_auto)
|
||||
"plan" -> stringResource(R.string.mode_plan)
|
||||
else -> mode.replaceFirstChar { it.uppercase() }
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Composable
|
||||
private fun Composer(model: ChatViewModel, state: ChatState) {
|
||||
private fun Composer(model: ChatViewModel, state: ChatState, agent: Boolean) {
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
var text by rememberSaveable { mutableStateOf("") }
|
||||
var chosenModel by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
var chosenEffort by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
var planMode by rememberSaveable { mutableStateOf(false) }
|
||||
var agentMode by rememberSaveable { mutableStateOf("edit") }
|
||||
var device by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
var directory by rememberSaveable { mutableStateOf("") }
|
||||
var askDirectory by remember { mutableStateOf(false) }
|
||||
var attachMenu by remember { mutableStateOf(false) }
|
||||
var listening by remember { mutableStateOf(false) }
|
||||
var photo by remember { mutableStateOf<Uri?>(null) }
|
||||
val recorder = remember { Recorder(scope) }
|
||||
val pick = rememberLauncherForActivityResult(ActivityResultContracts.GetMultipleContents()) { model.attach(it) }
|
||||
val pickFiles = rememberLauncherForActivityResult(ActivityResultContracts.GetMultipleContents()) { model.attach(it) }
|
||||
val pickPhotos = rememberLauncherForActivityResult(ActivityResultContracts.PickMultipleVisualMedia()) { model.attach(it) }
|
||||
val takePhoto = rememberLauncherForActivityResult(ActivityResultContracts.TakePicture()) { taken ->
|
||||
photo?.let { if (taken) model.attach(listOf(it)) }
|
||||
photo = null
|
||||
}
|
||||
val askMic = rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
|
||||
if (granted) {
|
||||
recorder.start()
|
||||
listening = true
|
||||
}
|
||||
}
|
||||
// A message the server did not take comes back here, so nothing typed is lost.
|
||||
LaunchedEffect(state.unsent) {
|
||||
state.unsent?.let {
|
||||
if (text.isBlank()) text = it
|
||||
model.clearUnsent()
|
||||
}
|
||||
}
|
||||
val chat = state.chat
|
||||
val current = chat?.model ?: chosenModel ?: state.models.firstOrNull { it.default }?.id
|
||||
val newAgent = agent && chat == null
|
||||
// The first linked device is the one a new agent chat runs on until another is chosen.
|
||||
val target: LinkedDevice? = state.devices.firstOrNull { it.id == device } ?: state.devices.firstOrNull()
|
||||
val current = chat?.model?.ifBlank { null } ?: chosenModel ?: state.models.firstOrNull { it.default }?.id
|
||||
val running = state.live != null && state.live.finished == null
|
||||
|
||||
Column(Modifier.fillMaxWidth().padding(8.dp)) {
|
||||
if (newAgent && state.devices.isEmpty() && !state.loading) {
|
||||
Text(
|
||||
stringResource(R.string.agent_no_device),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = LocalPalette.current.inkMuted,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp),
|
||||
)
|
||||
}
|
||||
if (state.pending.isNotEmpty()) {
|
||||
Row(Modifier.horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
state.pending.forEach { a ->
|
||||
@@ -295,28 +421,58 @@ private fun Composer(model: ChatViewModel, state: ChatState) {
|
||||
}
|
||||
}
|
||||
Row(Modifier.horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
if (newAgent && state.devices.isNotEmpty()) {
|
||||
DeviceChip(state.devices, target) { device = it }
|
||||
AssistChip(
|
||||
onClick = { askDirectory = true },
|
||||
leadingIcon = { Icon(Icons.Filled.Folder, contentDescription = null) },
|
||||
label = { Text(directory.ifBlank { stringResource(R.string.agent_directory) }, maxLines = 1) },
|
||||
)
|
||||
}
|
||||
ModelChip(state.models, current) { id ->
|
||||
if (chat == null) chosenModel = id else model.change("model", id)
|
||||
}
|
||||
val efforts = state.models.firstOrNull { it.id == current }?.efforts.orEmpty()
|
||||
if (efforts.isNotEmpty()) {
|
||||
EffortChip(efforts, chat?.effort) { model.change("effort", it ?: "off") }
|
||||
// A new chat keeps the choice until its first message makes it; an open one
|
||||
// changes at once, as the web page's control does.
|
||||
EffortChip(efforts, if (chat == null) chosenEffort else chat.effort?.ifBlank { null }) { picked ->
|
||||
if (chat == null) chosenEffort = picked else model.change("effort", picked ?: "off")
|
||||
}
|
||||
}
|
||||
if (chat == null || !chat.isAgent) {
|
||||
FilterChip(
|
||||
when {
|
||||
newAgent -> ModeChip(agentMode) { agentMode = it }
|
||||
|
||||
chat != null && chat.isAgent -> ModeChip(chat.mode.ifBlank { "edit" }) { model.change("mode", it) }
|
||||
|
||||
else -> FilterChip(
|
||||
selected = if (chat == null) planMode else chat.mode == "plan",
|
||||
onClick = {
|
||||
if (chat == null) planMode = !planMode else model.change("mode", if (chat.mode == "plan") "" else "plan")
|
||||
},
|
||||
label = { Text(stringResource(R.string.mode_plan)) },
|
||||
)
|
||||
} else {
|
||||
AssistChip(onClick = {}, label = { Text(chat.mode.replaceFirstChar { it.uppercase() }) })
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
IconButton(onClick = { pick.launch("*/*") }) {
|
||||
Icon(Icons.Filled.AttachFile, contentDescription = stringResource(R.string.attach))
|
||||
Box {
|
||||
IconButton(onClick = { attachMenu = true }) {
|
||||
Icon(Icons.Filled.AttachFile, contentDescription = stringResource(R.string.attach))
|
||||
}
|
||||
DropdownMenu(expanded = attachMenu, onDismissRequest = { attachMenu = false }) {
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.attach_take_photo)) }, onClick = {
|
||||
attachMenu = false
|
||||
model.photoTarget().also { photo = it }.let { takePhoto.launch(it) }
|
||||
})
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.attach_choose_photos)) }, onClick = {
|
||||
attachMenu = false
|
||||
pickPhotos.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
|
||||
})
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.attach_choose_files)) }, onClick = {
|
||||
attachMenu = false
|
||||
pickFiles.launch("*/*")
|
||||
})
|
||||
}
|
||||
}
|
||||
TextField(
|
||||
value = text,
|
||||
@@ -347,15 +503,90 @@ private fun Composer(model: ChatViewModel, state: ChatState) {
|
||||
IconButton(onClick = model::stop) { Icon(Icons.Filled.Stop, contentDescription = stringResource(R.string.stop)) }
|
||||
} else {
|
||||
IconButton(
|
||||
enabled = text.isNotBlank() || state.pending.isNotEmpty(),
|
||||
enabled = (text.isNotBlank() || state.pending.isNotEmpty()) && !state.uploading && (!newAgent || target != null),
|
||||
onClick = {
|
||||
model.send(text, model = chosenModel, mode = if (planMode) "plan" else null)
|
||||
model.send(
|
||||
text,
|
||||
model = chosenModel,
|
||||
mode = if (newAgent) {
|
||||
agentMode
|
||||
} else if (planMode) {
|
||||
"plan"
|
||||
} else {
|
||||
null
|
||||
},
|
||||
effort = chosenEffort,
|
||||
agent = if (newAgent) target?.let { AgentTarget(it.id, directory) } else null,
|
||||
)
|
||||
text = ""
|
||||
},
|
||||
) { Icon(Icons.AutoMirrored.Filled.Send, contentDescription = stringResource(R.string.send)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (askDirectory) {
|
||||
var typed by remember { mutableStateOf(directory) }
|
||||
AlertDialog(
|
||||
onDismissRequest = { askDirectory = false },
|
||||
title = { Text(stringResource(R.string.agent_directory)) },
|
||||
text = {
|
||||
OutlinedTextField(
|
||||
value = typed,
|
||||
onValueChange = { typed = it },
|
||||
singleLine = true,
|
||||
placeholder = { Text(stringResource(R.string.agent_directory_hint)) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
directory = typed.trim()
|
||||
askDirectory = false
|
||||
}) { Text(stringResource(R.string.save)) }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { askDirectory = false }) { Text(stringResource(R.string.cancel)) } },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DeviceChip(devices: List<LinkedDevice>, current: LinkedDevice?, onPick: (String) -> Unit) {
|
||||
var open by remember { mutableStateOf(false) }
|
||||
Box {
|
||||
AssistChip(
|
||||
onClick = { open = true },
|
||||
leadingIcon = { Icon(Icons.Filled.Terminal, contentDescription = stringResource(R.string.agent_device)) },
|
||||
label = { Text(current?.let { it.name.ifBlank { it.host } } ?: "—", maxLines = 1) },
|
||||
)
|
||||
DropdownMenu(expanded = open, onDismissRequest = { open = false }) {
|
||||
devices.forEach { d ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(listOf(d.name, d.host).filter { it.isNotBlank() }.distinct().joinToString(" · ")) },
|
||||
onClick = {
|
||||
open = false
|
||||
onPick(d.id)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ModeChip(current: String, onPick: (String) -> Unit) {
|
||||
var open by remember { mutableStateOf(false) }
|
||||
Box {
|
||||
AssistChip(onClick = { open = true }, label = { Text(modeName(current)) })
|
||||
DropdownMenu(expanded = open, onDismissRequest = { open = false }) {
|
||||
AGENT_MODES.forEach { m ->
|
||||
DropdownMenuItem(text = { Text(modeName(m)) }, onClick = {
|
||||
open = false
|
||||
onPick(m)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -3,20 +3,25 @@ package eu.llembas.android.ui.chat
|
||||
import android.app.Application
|
||||
import android.net.Uri
|
||||
import android.provider.OpenableColumns
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import eu.llembas.android.api.AgentTarget
|
||||
import eu.llembas.android.api.ApiClient
|
||||
import eu.llembas.android.api.ApiException
|
||||
import eu.llembas.android.api.Attachment
|
||||
import eu.llembas.android.api.Card
|
||||
import eu.llembas.android.api.CardAnswer
|
||||
import eu.llembas.android.api.Chat
|
||||
import eu.llembas.android.api.LinkedDevice
|
||||
import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.ModelInfo
|
||||
import eu.llembas.android.api.StreamClient
|
||||
import eu.llembas.android.api.Turn
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.explain
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -26,6 +31,7 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import java.io.File
|
||||
|
||||
data class ChatState(
|
||||
val chat: Chat? = null,
|
||||
@@ -33,10 +39,14 @@ data class ChatState(
|
||||
val more: Boolean = false,
|
||||
val live: LiveReply? = null,
|
||||
val models: List<ModelInfo> = emptyList(),
|
||||
/** For a new agent chat: the devices linked right now, which it can run on. */
|
||||
val devices: List<LinkedDevice> = emptyList(),
|
||||
val pending: List<Attachment> = emptyList(),
|
||||
val uploading: Boolean = false,
|
||||
val loading: Boolean = false,
|
||||
val error: String? = null,
|
||||
/** A message that could not be sent, handed back to the composer once. */
|
||||
val unsent: String? = null,
|
||||
/** A card somebody answered elsewhere first: said once, then cleared. */
|
||||
val notice: String? = null,
|
||||
)
|
||||
@@ -55,19 +65,27 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
?: throw ApiException(401, "Not signed in.")
|
||||
|
||||
private fun fail(e: Throwable) {
|
||||
_state.update { it.copy(error = e.message ?: e.javaClass.simpleName, loading = false, uploading = false) }
|
||||
// A follow that was replaced by a newer one is cancelled, not failed: nothing to say.
|
||||
if (e is CancellationException) return
|
||||
_state.update { it.copy(error = getApplication<Application>().explain(e), loading = false, uploading = false) }
|
||||
}
|
||||
|
||||
fun clearError() = _state.update { it.copy(error = null, notice = null) }
|
||||
|
||||
fun open(chatId: String?) {
|
||||
fun clearUnsent() = _state.update { it.copy(unsent = null) }
|
||||
|
||||
fun rename(title: String) = change("title", title.trim())
|
||||
|
||||
/** Open a chat, or (no id) get a new one ready: an agent chat also needs the linked devices. */
|
||||
fun open(chatId: String?, agent: Boolean = false) {
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
val client = api()
|
||||
_state.update { it.copy(loading = chatId != null) }
|
||||
_state.update { it.copy(loading = chatId != null || agent, error = null) }
|
||||
val models = runCatching { client.models(chatId) }.getOrDefault(emptyList())
|
||||
if (chatId == null) {
|
||||
_state.update { it.copy(models = models, loading = false) }
|
||||
val devices = if (agent) client.devices() else emptyList()
|
||||
_state.update { it.copy(models = models, devices = devices, loading = false) }
|
||||
return@launch
|
||||
}
|
||||
val detail = client.chat(chatId)
|
||||
@@ -101,8 +119,15 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
StreamClient(api()).follow(chat.id, messageId).collect { frame ->
|
||||
_state.update { s -> s.copy(live = (s.live ?: LiveReply(messageId)).apply(frame.event, frame.data)) }
|
||||
}
|
||||
} catch (e: CancellationException) {
|
||||
throw e
|
||||
} catch (e: Exception) {
|
||||
fail(e)
|
||||
// The reply goes on on the server; what it has written so far is read back
|
||||
// rather than left half-drawn.
|
||||
_state.update { it.copy(live = null) }
|
||||
refresh()
|
||||
return@launch
|
||||
}
|
||||
val ended = _state.value.live
|
||||
_state.update { s ->
|
||||
@@ -136,8 +161,9 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
turn.reply?.let { follow(it.id) }
|
||||
}
|
||||
|
||||
fun send(text: String, model: String? = null, mode: String? = null, effort: String? = null, temporary: Boolean = false) {
|
||||
val files = _state.value.pending.map { it.id }
|
||||
fun send(text: String, model: String? = null, mode: String? = null, effort: String? = null, temporary: Boolean = false, agent: AgentTarget? = null) {
|
||||
val attached = _state.value.pending
|
||||
val files = attached.map { it.id }
|
||||
if (text.isBlank() && files.isEmpty()) return
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
@@ -145,13 +171,15 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
val chat = _state.value.chat
|
||||
_state.update { it.copy(pending = emptyList()) }
|
||||
if (chat == null) {
|
||||
val made = client.createChat(text, files, model = model, temporary = temporary, effort = effort, mode = mode)
|
||||
val made = client.createChat(text, files, model = model, temporary = temporary, effort = effort, mode = mode, agent = agent)
|
||||
_state.update { it.copy(chat = made.chat, messages = listOfNotNull(made.message, made.reply)) }
|
||||
made.reply?.let { follow(it.id) }
|
||||
} else {
|
||||
took(client.sendMessage(chat.id, text, files))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// Nothing was sent: the words and the attachments go back to the composer.
|
||||
_state.update { it.copy(pending = attached + it.pending, unsent = text) }
|
||||
fail(e)
|
||||
}
|
||||
}
|
||||
@@ -221,6 +249,8 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
val mime = resolver.getType(uri) ?: "application/octet-stream"
|
||||
val stored = api().upload(name, mime, bytes, _state.value.chat?.id)
|
||||
_state.update { it.copy(pending = it.pending + stored) }
|
||||
// A photo the camera took for this message is the server's now.
|
||||
if (uri.authority == photoAuthority) runCatching { resolver.delete(uri, null, null) }
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
fail(e)
|
||||
@@ -229,6 +259,19 @@ class ChatViewModel(app: Application) : AndroidViewModel(app) {
|
||||
}
|
||||
}
|
||||
|
||||
private val photoAuthority get() = "${getApplication<Application>().packageName}.files"
|
||||
|
||||
/**
|
||||
* Where the camera writes a photo for the composer: a file in the app's cache, shared with
|
||||
* the camera app through the FileProvider for exactly this one capture.
|
||||
*/
|
||||
fun photoTarget(): Uri {
|
||||
val app = getApplication<Application>()
|
||||
val dir = File(app.cacheDir, "camera").apply { mkdirs() }
|
||||
val file = File(dir, "photo-${System.currentTimeMillis()}.jpg")
|
||||
return FileProvider.getUriForFile(app, photoAuthority, file)
|
||||
}
|
||||
|
||||
fun unattach(attachment: Attachment) {
|
||||
_state.update { s -> s.copy(pending = s.pending.filterNot { it.id == attachment.id }) }
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SwipeToDismissBox
|
||||
import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
||||
import androidx.compose.material3.rememberSwipeToDismissBoxState
|
||||
@@ -40,6 +41,8 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -49,6 +52,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.compose.LifecycleResumeEffect
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
@@ -57,6 +61,7 @@ import eu.llembas.android.api.Chat
|
||||
import eu.llembas.android.api.Doorstep
|
||||
import eu.llembas.android.api.fit
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.explain
|
||||
import eu.llembas.android.ui.signin.refusal
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@@ -76,10 +81,15 @@ class ChatsViewModel(app: Application) : AndroidViewModel(app) {
|
||||
private var refused: Int? = null
|
||||
private var checked = false
|
||||
|
||||
fun load(kind: String) {
|
||||
/**
|
||||
* Read the list. [quiet] is the reload on coming back to the screen: the rows already shown
|
||||
* stay without a spinner, and only a change replaces them.
|
||||
*/
|
||||
fun load(kind: String, quiet: Boolean = false) {
|
||||
val switched = kind != this.kind
|
||||
this.kind = kind
|
||||
viewModelScope.launch {
|
||||
_state.update { it.copy(loading = true, error = null) }
|
||||
_state.update { it.copy(loading = !quiet || switched, error = null, chats = if (switched) emptyList() else it.chats) }
|
||||
try {
|
||||
val api = getApplication<Application>().lembas.instances.client() ?: return@launch
|
||||
// An instance signed in to before it was downgraded, or by 0.1 against a 1.x
|
||||
@@ -98,7 +108,7 @@ class ChatsViewModel(app: Application) : AndroidViewModel(app) {
|
||||
val page = api.chats(kind = kind)
|
||||
_state.value = ChatsState(chats = page.chats, more = page.more)
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(loading = false, error = e.message) }
|
||||
_state.update { it.copy(loading = false, error = getApplication<Application>().explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +121,7 @@ class ChatsViewModel(app: Application) : AndroidViewModel(app) {
|
||||
val page = api.chats(kind = kind, before = last.id)
|
||||
_state.update { it.copy(chats = it.chats + page.chats, more = page.more) }
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(error = e.message) }
|
||||
_state.update { it.copy(error = getApplication<Application>().explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +134,7 @@ class ChatsViewModel(app: Application) : AndroidViewModel(app) {
|
||||
getApplication<Application>().lembas.instances.client()
|
||||
?.updateChat(chat.id, buildJsonObject { put("archived", true) })
|
||||
}.onFailure { e ->
|
||||
_state.update { it.copy(error = e.message) }
|
||||
_state.update { it.copy(error = getApplication<Application>().explain(e)) }
|
||||
load(kind)
|
||||
}
|
||||
}
|
||||
@@ -133,11 +143,25 @@ class ChatsViewModel(app: Application) : AndroidViewModel(app) {
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ChatsScreen(onOpen: (String) -> Unit, onNew: () -> Unit, onSettings: () -> Unit, onFiles: () -> Unit, model: ChatsViewModel = viewModel()) {
|
||||
fun ChatsScreen(
|
||||
onOpen: (String) -> Unit,
|
||||
onNew: () -> Unit,
|
||||
onNewAgent: () -> Unit,
|
||||
onSettings: () -> Unit,
|
||||
onFiles: () -> Unit,
|
||||
model: ChatsViewModel = viewModel(),
|
||||
) {
|
||||
val state by model.state.collectAsStateWithLifecycle()
|
||||
var tab by rememberSaveable { mutableIntStateOf(0) }
|
||||
val kind = if (tab == 0) "chat" else "agent"
|
||||
LaunchedEffect(kind) { model.load(kind) }
|
||||
// Read again each time the list comes back into view -- from a chat, from another app --
|
||||
// so a new chat, a new title or a finished reply's dot is there without a pull.
|
||||
var shown by remember { mutableStateOf(false) }
|
||||
LifecycleResumeEffect(kind) {
|
||||
model.load(kind, quiet = shown)
|
||||
shown = true
|
||||
onPauseOrDispose { }
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
@@ -154,13 +178,11 @@ fun ChatsScreen(onOpen: (String) -> Unit, onNew: () -> Unit, onSettings: () -> U
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
if (tab == 0) {
|
||||
ExtendedFloatingActionButton(
|
||||
onClick = onNew,
|
||||
icon = { Icon(Icons.Filled.Add, contentDescription = null) },
|
||||
text = { Text(stringResource(R.string.new_chat)) },
|
||||
)
|
||||
}
|
||||
ExtendedFloatingActionButton(
|
||||
onClick = if (tab == 0) onNew else onNewAgent,
|
||||
icon = { Icon(Icons.Filled.Add, contentDescription = null) },
|
||||
text = { Text(stringResource(if (tab == 0) R.string.new_chat else R.string.new_agent_chat)) },
|
||||
)
|
||||
},
|
||||
) { padding ->
|
||||
Column(Modifier.padding(padding).fillMaxSize()) {
|
||||
@@ -169,10 +191,14 @@ fun ChatsScreen(onOpen: (String) -> Unit, onNew: () -> Unit, onSettings: () -> U
|
||||
Tab(selected = tab == 1, onClick = { tab = 1 }, text = { Text(stringResource(R.string.tab_agents)) })
|
||||
}
|
||||
state.error?.let {
|
||||
Text(it, color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(16.dp))
|
||||
Row(Modifier.fillMaxWidth().padding(start = 16.dp, end = 8.dp, top = 8.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
// The sentence gives; the button keeps its size.
|
||||
Text(it, color = MaterialTheme.colorScheme.error, modifier = Modifier.weight(1f))
|
||||
TextButton(onClick = { model.load(kind) }) { Text(stringResource(R.string.retry)) }
|
||||
}
|
||||
}
|
||||
PullToRefreshBox(isRefreshing = state.loading, onRefresh = { model.load(kind) }, modifier = Modifier.fillMaxSize()) {
|
||||
if (state.chats.isEmpty() && !state.loading) {
|
||||
if (state.chats.isEmpty() && !state.loading && state.error == null) {
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Text(
|
||||
stringResource(if (tab == 0) R.string.empty_chats else R.string.empty_agents),
|
||||
|
||||
@@ -47,6 +47,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.api.FileEntry
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.explain
|
||||
import eu.llembas.android.ui.theme.LocalPalette
|
||||
import eu.llembas.android.ui.viewer.TreeFileViewer
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -91,7 +92,7 @@ class FilesViewModel(app: Application) : AndroidViewModel(app) {
|
||||
_state.value = FilesState(path = listing.path, parent = listing.parent, entries = listing.entries)
|
||||
} catch (e: Exception) {
|
||||
if (e is kotlinx.coroutines.CancellationException) throw e
|
||||
_state.update { it.copy(loading = false, error = e.message ?: e.javaClass.simpleName) }
|
||||
_state.update { it.copy(loading = false, error = getApplication<Application>().explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import eu.llembas.android.api.ServerFit
|
||||
import eu.llembas.android.api.fit
|
||||
import eu.llembas.android.api.normaliseBase
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.explain
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -124,7 +125,7 @@ class SignInViewModel(app: Application) : AndroidViewModel(app) {
|
||||
}
|
||||
_state.value = SignInState.Failed(getApplication<Application>().getString(R.string.signin_expired))
|
||||
} catch (e: Exception) {
|
||||
_state.value = SignInState.Failed(e.message ?: e.javaClass.simpleName)
|
||||
_state.value = SignInState.Failed(getApplication<Application>().explain(e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ import eu.llembas.android.api.ApiException
|
||||
import eu.llembas.android.api.ShowCard
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.MarkdownText
|
||||
import eu.llembas.android.ui.explain
|
||||
import eu.llembas.android.ui.theme.LocalPalette
|
||||
import java.io.IOException
|
||||
|
||||
@@ -159,7 +160,7 @@ private fun Viewer(file: Viewed, key: Any, webUrl: (ApiClient) -> String?, load:
|
||||
else -> Loaded.Failed(e.message ?: context.getString(R.string.viewer_unavailable))
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Loaded.Failed(e.message ?: e.javaClass.simpleName)
|
||||
Loaded.Failed(context.explain(e))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Konverzace</string>
|
||||
<string name="tab_agents">Agenti</string>
|
||||
<string name="empty_chats">Zatím žádné konverzace. Ne všichni, kdo bloudí, jsou ztraceni — založte jednu.</string>
|
||||
<string name="empty_agents">Žádné konverzace s agentem. Spusťte jednu z webového rozhraní na propojeném zařízení.</string>
|
||||
<string name="empty_agents">Zatím žádné konverzace s agentem. Spusťte jednu tlačítkem Nová konverzace s agentem na zařízení propojeném s touto instancí.</string>
|
||||
<string name="new_agent_chat">Nová konverzace s agentem</string>
|
||||
<string name="agent_device">Zařízení</string>
|
||||
<string name="agent_no_device">Právě není propojené žádné zařízení. Spusťte `lembas service` na počítači přihlášeném k této instanci a vraťte se.</string>
|
||||
<string name="agent_directory">Složka na zařízení</string>
|
||||
<string name="agent_directory_hint">Prázdné: první složka zařízení</string>
|
||||
<string name="empty_chat">O čem si promluvíme?</string>
|
||||
<string name="loading_line">Pečou se lembasy…</string>
|
||||
<string name="archive">Archivovat</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Odeslat</string>
|
||||
<string name="stop">Zastavit</string>
|
||||
<string name="attach">Přiložit soubor</string>
|
||||
<string name="attach_take_photo">Vyfotit</string>
|
||||
<string name="attach_choose_photos">Vybrat fotky</string>
|
||||
<string name="attach_choose_files">Vybrat soubory</string>
|
||||
<string name="copy_message">Zkopírovat zprávu</string>
|
||||
<string name="copied">Zkopírováno.</string>
|
||||
<string name="rename_chat">Přejmenovat konverzaci</string>
|
||||
<string name="save">Uložit</string>
|
||||
<string name="retry">Zkusit znovu</string>
|
||||
<string name="offline">Instance není dostupná. Zkontrolujte připojení telefonu a to, zda se dostane na adresu instance.</string>
|
||||
<string name="dictate">Diktovat</string>
|
||||
<string name="remove">Odebrat</string>
|
||||
<string name="more">Více</string>
|
||||
@@ -44,7 +58,8 @@
|
||||
<string name="effort_off">Úsilí: vypnuto</string>
|
||||
<string name="mode_plan">Plán</string>
|
||||
<string name="mode_edit">Upravit</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Ručně</string>
|
||||
<string name="mode_auto">Automaticky</string>
|
||||
<string name="card_approval">Povolit to?</string>
|
||||
<string name="card_allow_once">Povolit jednou</string>
|
||||
<string name="card_allow_always">Toto vždy povolit</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Chats</string>
|
||||
<string name="tab_agents">Agenten</string>
|
||||
<string name="empty_chats">Noch keine Chats. Nicht jeder, der wandert, ist verloren — fangen Sie einen an.</string>
|
||||
<string name="empty_agents">Keine Agent-Chats. Starten Sie einen über die Weboberfläche auf einem verknüpften Gerät.</string>
|
||||
<string name="empty_agents">Noch keine Agent-Chats. Starten Sie einen mit „Neuer Agent-Chat“ auf einem Gerät, das mit dieser Instanz verknüpft ist.</string>
|
||||
<string name="new_agent_chat">Neuer Agent-Chat</string>
|
||||
<string name="agent_device">Gerät</string>
|
||||
<string name="agent_no_device">Gerade ist kein Gerät verknüpft. Starten Sie `lembas service` auf einem Computer, der bei dieser Instanz angemeldet ist, und kommen Sie dann zurück.</string>
|
||||
<string name="agent_directory">Ordner auf dem Gerät</string>
|
||||
<string name="agent_directory_hint">Leer: der erste Ordner des Geräts</string>
|
||||
<string name="empty_chat">Worüber sprechen wir?</string>
|
||||
<string name="loading_line">Lembas wird gebacken…</string>
|
||||
<string name="archive">Archivieren</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Senden</string>
|
||||
<string name="stop">Stoppen</string>
|
||||
<string name="attach">Datei anhängen</string>
|
||||
<string name="attach_take_photo">Foto aufnehmen</string>
|
||||
<string name="attach_choose_photos">Fotos auswählen</string>
|
||||
<string name="attach_choose_files">Dateien auswählen</string>
|
||||
<string name="copy_message">Nachricht kopieren</string>
|
||||
<string name="copied">Kopiert.</string>
|
||||
<string name="rename_chat">Chat umbenennen</string>
|
||||
<string name="save">Speichern</string>
|
||||
<string name="retry">Erneut versuchen</string>
|
||||
<string name="offline">Die Instanz ist nicht erreichbar. Prüfen Sie die Verbindung des Telefons und ob es die Adresse der Instanz erreicht.</string>
|
||||
<string name="dictate">Diktieren</string>
|
||||
<string name="remove">Entfernen</string>
|
||||
<string name="more">Mehr</string>
|
||||
@@ -42,9 +56,10 @@
|
||||
<string name="cancel">Abbrechen</string>
|
||||
<string name="close">Schließen</string>
|
||||
<string name="effort_off">Aufwand: aus</string>
|
||||
<string name="mode_plan">Tarif</string>
|
||||
<string name="mode_plan">Plan</string>
|
||||
<string name="mode_edit">Bearbeiten</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Manuell</string>
|
||||
<string name="mode_auto">Automatisch</string>
|
||||
<string name="card_approval">Das erlauben?</string>
|
||||
<string name="card_allow_once">Einmal erlauben</string>
|
||||
<string name="card_allow_always">Dies immer erlauben</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Chats</string>
|
||||
<string name="tab_agents">Agentes</string>
|
||||
<string name="empty_chats">Aún no hay chats. No todos los que vagan están perdidos — empiece uno.</string>
|
||||
<string name="empty_agents">No hay chats de agente. Inicie uno desde la interfaz web en un dispositivo vinculado.</string>
|
||||
<string name="empty_agents">Aún no hay chats de agente. Inicie uno con Nuevo chat de agente, en un dispositivo vinculado a esta instancia.</string>
|
||||
<string name="new_agent_chat">Nuevo chat de agente</string>
|
||||
<string name="agent_device">Dispositivo</string>
|
||||
<string name="agent_no_device">Ahora no hay ningún dispositivo vinculado. Inicie `lembas service` en un ordenador con sesión iniciada en esta instancia y vuelva.</string>
|
||||
<string name="agent_directory">Carpeta en el dispositivo</string>
|
||||
<string name="agent_directory_hint">Vacío: la primera carpeta del dispositivo</string>
|
||||
<string name="empty_chat">¿De qué hablamos?</string>
|
||||
<string name="loading_line">Horneando lembas…</string>
|
||||
<string name="archive">Archivar</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Enviar</string>
|
||||
<string name="stop">Detener</string>
|
||||
<string name="attach">Adjuntar un archivo</string>
|
||||
<string name="attach_take_photo">Hacer una foto</string>
|
||||
<string name="attach_choose_photos">Elegir fotos</string>
|
||||
<string name="attach_choose_files">Elegir archivos</string>
|
||||
<string name="copy_message">Copiar mensaje</string>
|
||||
<string name="copied">Copiado.</string>
|
||||
<string name="rename_chat">Renombrar chat</string>
|
||||
<string name="save">Guardar</string>
|
||||
<string name="retry">Reintentar</string>
|
||||
<string name="offline">No se puede acceder a la instancia. Compruebe la conexión del teléfono y que llegue a la dirección de la instancia.</string>
|
||||
<string name="dictate">Dictar</string>
|
||||
<string name="remove">Quitar</string>
|
||||
<string name="more">Más</string>
|
||||
@@ -45,6 +59,7 @@
|
||||
<string name="mode_plan">Plan</string>
|
||||
<string name="mode_edit">Editar</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_auto">Automático</string>
|
||||
<string name="card_approval">¿Permitir esto?</string>
|
||||
<string name="card_allow_once">Permitir una vez</string>
|
||||
<string name="card_allow_always">Permitir siempre esto</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Conversations</string>
|
||||
<string name="tab_agents">Agents</string>
|
||||
<string name="empty_chats">Pas encore de conversation. Tous ceux qui errent ne sont pas perdus — commencez-en une.</string>
|
||||
<string name="empty_agents">Aucune conversation d\'agent. Démarrez-en une depuis l\'interface web sur un appareil associé.</string>
|
||||
<string name="empty_agents">Pas encore de conversation d\'agent. Démarrez-en une avec Nouvelle conversation d\'agent, sur un appareil associé à cette instance.</string>
|
||||
<string name="new_agent_chat">Nouvelle conversation d\'agent</string>
|
||||
<string name="agent_device">Appareil</string>
|
||||
<string name="agent_no_device">Aucun appareil n\'est associé pour l\'instant. Lancez `lembas service` sur un ordinateur connecté à cette instance, puis revenez.</string>
|
||||
<string name="agent_directory">Dossier sur l\'appareil</string>
|
||||
<string name="agent_directory_hint">Vide : le premier dossier de l\'appareil</string>
|
||||
<string name="empty_chat">De quoi allons-nous parler ?</string>
|
||||
<string name="loading_line">Cuisson des lembas…</string>
|
||||
<string name="archive">Archiver</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Envoyer</string>
|
||||
<string name="stop">Arrêter</string>
|
||||
<string name="attach">Joindre un fichier</string>
|
||||
<string name="attach_take_photo">Prendre une photo</string>
|
||||
<string name="attach_choose_photos">Choisir des photos</string>
|
||||
<string name="attach_choose_files">Choisir des fichiers</string>
|
||||
<string name="copy_message">Copier le message</string>
|
||||
<string name="copied">Copié.</string>
|
||||
<string name="rename_chat">Renommer la conversation</string>
|
||||
<string name="save">Enregistrer</string>
|
||||
<string name="retry">Réessayer</string>
|
||||
<string name="offline">L\'instance est injoignable. Vérifiez la connexion du téléphone et qu\'il atteint bien l\'adresse de l\'instance.</string>
|
||||
<string name="dictate">Dicter</string>
|
||||
<string name="remove">Retirer</string>
|
||||
<string name="more">Plus</string>
|
||||
@@ -42,9 +56,10 @@
|
||||
<string name="cancel">Annuler</string>
|
||||
<string name="close">Fermer</string>
|
||||
<string name="effort_off">Effort : désactivé</string>
|
||||
<string name="mode_plan">Forfait</string>
|
||||
<string name="mode_plan">Plan</string>
|
||||
<string name="mode_edit">Modifier</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Manuel</string>
|
||||
<string name="mode_auto">Automatique</string>
|
||||
<string name="card_approval">Autoriser ceci ?</string>
|
||||
<string name="card_allow_once">Autoriser une fois</string>
|
||||
<string name="card_allow_always">Toujours autoriser ceci</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Csevegések</string>
|
||||
<string name="tab_agents">Ügynökök</string>
|
||||
<string name="empty_chats">Még nincs csevegés. Nem mindenki van elveszve, aki bolyong — kezdjen el egyet.</string>
|
||||
<string name="empty_agents">Nincs ügynök-csevegés. Indítson el egyet a webes felületen egy összekapcsolt eszközön.</string>
|
||||
<string name="empty_agents">Még nincs ügynök-csevegés. Indítson egyet az Új ügynök-csevegés gombbal, egy ehhez a példányhoz kapcsolt eszközön.</string>
|
||||
<string name="new_agent_chat">Új ügynök-csevegés</string>
|
||||
<string name="agent_device">Eszköz</string>
|
||||
<string name="agent_no_device">Jelenleg nincs összekapcsolt eszköz. Indítsa el a `lembas service` parancsot egy ebbe a példányba bejelentkezett számítógépen, majd térjen vissza.</string>
|
||||
<string name="agent_directory">Mappa az eszközön</string>
|
||||
<string name="agent_directory_hint">Üres: az eszköz első mappája</string>
|
||||
<string name="empty_chat">Miről beszéljünk?</string>
|
||||
<string name="loading_line">Lembas sül…</string>
|
||||
<string name="archive">Archiválás</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Küldés</string>
|
||||
<string name="stop">Leállítás</string>
|
||||
<string name="attach">Fájl csatolása</string>
|
||||
<string name="attach_take_photo">Fénykép készítése</string>
|
||||
<string name="attach_choose_photos">Fényképek kiválasztása</string>
|
||||
<string name="attach_choose_files">Fájlok kiválasztása</string>
|
||||
<string name="copy_message">Üzenet másolása</string>
|
||||
<string name="copied">Másolva.</string>
|
||||
<string name="rename_chat">Csevegés átnevezése</string>
|
||||
<string name="save">Mentés</string>
|
||||
<string name="retry">Újrapróbálás</string>
|
||||
<string name="offline">A példány nem érhető el. Ellenőrizze a telefon kapcsolatát, és hogy eléri-e a példány címét.</string>
|
||||
<string name="dictate">Diktálás</string>
|
||||
<string name="remove">Eltávolítás</string>
|
||||
<string name="more">Továbbiak</string>
|
||||
@@ -42,9 +56,10 @@
|
||||
<string name="cancel">Mégse</string>
|
||||
<string name="close">Bezárás</string>
|
||||
<string name="effort_off">Erőfeszítés: kikapcsolva</string>
|
||||
<string name="mode_plan">Csomag</string>
|
||||
<string name="mode_plan">Terv</string>
|
||||
<string name="mode_edit">Szerkesztés</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Kézi</string>
|
||||
<string name="mode_auto">Automatikus</string>
|
||||
<string name="card_approval">Engedélyezzük ezt?</string>
|
||||
<string name="card_allow_once">Engedélyezés egyszer</string>
|
||||
<string name="card_allow_always">Ennek mindig engedélyezése</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Chat</string>
|
||||
<string name="tab_agents">Agenti</string>
|
||||
<string name="empty_chats">Ancora nessuna chat. Non tutti quelli che vagano sono perduti — iniziane una.</string>
|
||||
<string name="empty_agents">Nessuna chat agente. Avviane una dall\'interfaccia web su un dispositivo collegato.</string>
|
||||
<string name="empty_agents">Ancora nessuna chat agente. Avviane una con Nuova chat agente, su un dispositivo collegato a questa istanza.</string>
|
||||
<string name="new_agent_chat">Nuova chat agente</string>
|
||||
<string name="agent_device">Dispositivo</string>
|
||||
<string name="agent_no_device">Nessun dispositivo è collegato ora. Avvia `lembas service` su un computer connesso a questa istanza, poi torna qui.</string>
|
||||
<string name="agent_directory">Cartella sul dispositivo</string>
|
||||
<string name="agent_directory_hint">Vuoto: la prima cartella del dispositivo</string>
|
||||
<string name="empty_chat">Di cosa parliamo?</string>
|
||||
<string name="loading_line">I lembas stanno cuocendo…</string>
|
||||
<string name="archive">Archivia</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Invia</string>
|
||||
<string name="stop">Ferma</string>
|
||||
<string name="attach">Allega un file</string>
|
||||
<string name="attach_take_photo">Scatta una foto</string>
|
||||
<string name="attach_choose_photos">Scegli foto</string>
|
||||
<string name="attach_choose_files">Scegli file</string>
|
||||
<string name="copy_message">Copia messaggio</string>
|
||||
<string name="copied">Copiato.</string>
|
||||
<string name="rename_chat">Rinomina chat</string>
|
||||
<string name="save">Salva</string>
|
||||
<string name="retry">Riprova</string>
|
||||
<string name="offline">L\'istanza non è raggiungibile. Controlla la connessione del telefono e che raggiunga l\'indirizzo dell\'istanza.</string>
|
||||
<string name="dictate">Detta</string>
|
||||
<string name="remove">Rimuovi</string>
|
||||
<string name="more">Altro</string>
|
||||
@@ -44,7 +58,8 @@
|
||||
<string name="effort_off">Impegno: disattivato</string>
|
||||
<string name="mode_plan">Piano</string>
|
||||
<string name="mode_edit">Modifica</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Manuale</string>
|
||||
<string name="mode_auto">Automatico</string>
|
||||
<string name="card_approval">Consentire questo?</string>
|
||||
<string name="card_allow_once">Consenti una volta</string>
|
||||
<string name="card_allow_always">Consenti sempre questo</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Czaty</string>
|
||||
<string name="tab_agents">Agenci</string>
|
||||
<string name="empty_chats">Nie ma jeszcze czatów. Nie każdy, kto błądzi, jest zgubiony — zacznij jeden.</string>
|
||||
<string name="empty_agents">Brak czatów agenta. Zacznij jeden z interfejsu webowego na połączonym urządzeniu.</string>
|
||||
<string name="empty_agents">Brak czatów agenta. Zacznij jeden przyciskiem Nowy czat agenta, na urządzeniu połączonym z tą instancją.</string>
|
||||
<string name="new_agent_chat">Nowy czat agenta</string>
|
||||
<string name="agent_device">Urządzenie</string>
|
||||
<string name="agent_no_device">Żadne urządzenie nie jest teraz połączone. Uruchom `lembas service` na komputerze zalogowanym do tej instancji i wróć.</string>
|
||||
<string name="agent_directory">Folder na urządzeniu</string>
|
||||
<string name="agent_directory_hint">Puste: pierwszy folder urządzenia</string>
|
||||
<string name="empty_chat">O czym porozmawiamy?</string>
|
||||
<string name="loading_line">Lembasy się pieczą…</string>
|
||||
<string name="archive">Archiwizuj</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Wyślij</string>
|
||||
<string name="stop">Zatrzymać</string>
|
||||
<string name="attach">Załącz plik</string>
|
||||
<string name="attach_take_photo">Zrób zdjęcie</string>
|
||||
<string name="attach_choose_photos">Wybierz zdjęcia</string>
|
||||
<string name="attach_choose_files">Wybierz pliki</string>
|
||||
<string name="copy_message">Kopiuj wiadomość</string>
|
||||
<string name="copied">Skopiowano.</string>
|
||||
<string name="rename_chat">Zmień nazwę czatu</string>
|
||||
<string name="save">Zapisz</string>
|
||||
<string name="retry">Spróbuj ponownie</string>
|
||||
<string name="offline">Instancja jest nieosiągalna. Sprawdź połączenie telefonu i czy dociera on do adresu instancji.</string>
|
||||
<string name="dictate">Dyktuj</string>
|
||||
<string name="remove">Usuń</string>
|
||||
<string name="more">Więcej</string>
|
||||
@@ -44,7 +58,8 @@
|
||||
<string name="effort_off">Wysiłek: wyłączony</string>
|
||||
<string name="mode_plan">Plan</string>
|
||||
<string name="mode_edit">Edytuj</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Ręcznie</string>
|
||||
<string name="mode_auto">Automatycznie</string>
|
||||
<string name="card_approval">Zezwolić na to?</string>
|
||||
<string name="card_allow_once">Zezwól raz</string>
|
||||
<string name="card_allow_always">Zawsze na to zezwalaj</string>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
<string name="tab_chats">Konverzácie</string>
|
||||
<string name="tab_agents">Agenti</string>
|
||||
<string name="empty_chats">Zatiaľ žiadne konverzácie. Nie všetci, čo blúdia, sú stratení — začnite jednu.</string>
|
||||
<string name="empty_agents">Žiadne konverzácie s agentom. Spustite jednu z webového rozhrania na prepojenom zariadení.</string>
|
||||
<string name="empty_agents">Zatiaľ žiadne konverzácie s agentom. Spustite jednu tlačidlom Nová konverzácia s agentom na zariadení prepojenom s touto inštanciou.</string>
|
||||
<string name="new_agent_chat">Nová konverzácia s agentom</string>
|
||||
<string name="agent_device">Zariadenie</string>
|
||||
<string name="agent_no_device">Práve nie je prepojené žiadne zariadenie. Spustite `lembas service` na počítači prihlásenom do tejto inštancie a vráťte sa.</string>
|
||||
<string name="agent_directory">Zložka v zariadení</string>
|
||||
<string name="agent_directory_hint">Prázdne: prvá zložka zariadenia</string>
|
||||
<string name="empty_chat">O čom sa pozhovárame?</string>
|
||||
<string name="loading_line">Pečú sa lembasy…</string>
|
||||
<string name="archive">Archivovať</string>
|
||||
@@ -35,6 +40,15 @@
|
||||
<string name="send">Poslať</string>
|
||||
<string name="stop">Zastaviť</string>
|
||||
<string name="attach">Priložiť súbor</string>
|
||||
<string name="attach_take_photo">Odfotiť</string>
|
||||
<string name="attach_choose_photos">Vybrať fotky</string>
|
||||
<string name="attach_choose_files">Vybrať súbory</string>
|
||||
<string name="copy_message">Skopírovať správu</string>
|
||||
<string name="copied">Skopírované.</string>
|
||||
<string name="rename_chat">Premenovať konverzáciu</string>
|
||||
<string name="save">Uložiť</string>
|
||||
<string name="retry">Skúsiť znova</string>
|
||||
<string name="offline">Inštancia nie je dostupná. Skontrolujte pripojenie telefónu a či sa dostane na adresu inštancie.</string>
|
||||
<string name="dictate">Diktovať</string>
|
||||
<string name="remove">Odstrániť</string>
|
||||
<string name="more">Viac</string>
|
||||
@@ -44,7 +58,8 @@
|
||||
<string name="effort_off">Úsilie: vypnuté</string>
|
||||
<string name="mode_plan">Plán</string>
|
||||
<string name="mode_edit">Upraviť</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_manual">Ručne</string>
|
||||
<string name="mode_auto">Automaticky</string>
|
||||
<string name="card_approval">Povoliť to?</string>
|
||||
<string name="card_allow_once">Povoliť raz</string>
|
||||
<string name="card_allow_always">Toto vždy povoliť</string>
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
<string name="tab_chats">Chats</string>
|
||||
<string name="tab_agents">Agents</string>
|
||||
<string name="empty_chats">No chats yet. Not all those who wander are lost — start one.</string>
|
||||
<string name="empty_agents">No agent chats. Start one from the web interface on a linked device.</string>
|
||||
<string name="empty_agents">No agent chats yet. Start one with New agent chat, on a device linked to this instance.</string>
|
||||
<string name="new_agent_chat">New agent chat</string>
|
||||
<string name="agent_device">Device</string>
|
||||
<string name="agent_no_device">No device is linked right now. Start `lembas service` on a computer signed in to this instance, then come back.</string>
|
||||
<string name="agent_directory">Folder on the device</string>
|
||||
<string name="agent_directory_hint">Empty: the device\'s first folder</string>
|
||||
<string name="empty_chat">What shall we talk about?</string>
|
||||
<string name="loading_line">Baking lembas…</string>
|
||||
<string name="archive">Archive</string>
|
||||
@@ -36,6 +41,15 @@
|
||||
<string name="send">Send</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="attach">Attach a file</string>
|
||||
<string name="attach_take_photo">Take a photo</string>
|
||||
<string name="attach_choose_photos">Choose photos</string>
|
||||
<string name="attach_choose_files">Choose files</string>
|
||||
<string name="copy_message">Copy message</string>
|
||||
<string name="copied">Copied.</string>
|
||||
<string name="rename_chat">Rename chat</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="retry">Try again</string>
|
||||
<string name="offline">The instance cannot be reached. Check the phone\'s connection, and that it can reach the instance\'s address.</string>
|
||||
<string name="dictate">Dictate</string>
|
||||
<string name="remove">Remove</string>
|
||||
<string name="more">More</string>
|
||||
@@ -46,6 +60,7 @@
|
||||
<string name="mode_plan">Plan</string>
|
||||
<string name="mode_edit">Edit</string>
|
||||
<string name="mode_manual">Manual</string>
|
||||
<string name="mode_auto">Auto</string>
|
||||
<string name="card_approval">Allow this?</string>
|
||||
<string name="card_allow_once">Allow once</string>
|
||||
<string name="card_allow_always">Always allow this</string>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- The one folder the app shares with another app: the cache folder a photo for the composer
|
||||
is taken into. The camera app may write the one file it was given, and nothing else. -->
|
||||
<paths>
|
||||
<cache-path name="camera" path="camera/" />
|
||||
</paths>
|
||||
@@ -1,19 +1,24 @@
|
||||
package eu.llembas.android
|
||||
|
||||
import eu.llembas.android.api.AgentTarget
|
||||
import eu.llembas.android.api.ApiClient
|
||||
import eu.llembas.android.api.ApiException
|
||||
import eu.llembas.android.api.CardAnswer
|
||||
import eu.llembas.android.api.ShowCard
|
||||
import eu.llembas.android.api.normaliseBase
|
||||
import eu.llembas.android.ui.unreachable
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import okhttp3.mockwebserver.MockResponse
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Assert.fail
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.net.ConnectException
|
||||
import java.net.UnknownHostException
|
||||
|
||||
class ClientTest {
|
||||
private lateinit var server: MockWebServer
|
||||
@@ -34,6 +39,35 @@ class ClientTest {
|
||||
assertEquals("http://10.1.2.3:8080", normaliseBase("http://10.1.2.3:8080"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAgentChatNamesItsDeviceAndFolder() = runTest {
|
||||
server.enqueue(MockResponse().setResponseCode(201).setBody("""{"chat":{"id":"c1","kind":"agent"}}"""))
|
||||
val made = client().createChat("Look around", mode = "edit", agent = AgentTarget("tok1", " ~/src/shire "))
|
||||
assertEquals("agent", made.chat.kind)
|
||||
val body = server.takeRequest().body.readUtf8()
|
||||
assertTrue(body, body.contains("\"kind\":\"agent\""))
|
||||
assertTrue(body, body.contains("\"device\":\"tok1\""))
|
||||
assertTrue(body, body.contains("\"directory\":\"~/src/shire\""))
|
||||
assertTrue(body, body.contains("\"mode\":\"edit\""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aPlainChatSaysNothingOfDevices() = runTest {
|
||||
server.enqueue(MockResponse().setResponseCode(201).setBody("""{"chat":{"id":"c2"}}"""))
|
||||
client().createChat("Hello", effort = "low")
|
||||
val body = server.takeRequest().body.readUtf8()
|
||||
assertFalse(body, body.contains("device"))
|
||||
assertFalse(body, body.contains("kind"))
|
||||
assertTrue(body, body.contains("\"effort\":\"low\""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun unreachableIsNotARefusal() {
|
||||
assertTrue(unreachable(UnknownHostException("llm.example.org")))
|
||||
assertTrue(unreachable(ConnectException("refused")))
|
||||
assertFalse(unreachable(ApiException(403, "No.")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun everyCallCarriesTheToken() = runTest {
|
||||
server.enqueue(MockResponse().setBody("""{"api":1,"account":{"name":"Frodo","email":"f@shire.test"}}"""))
|
||||
|
||||
+16
-1
@@ -30,7 +30,12 @@ STRINGS: dict[str, str] = {
|
||||
"tab_chats": "Chats",
|
||||
"tab_agents": "Agents",
|
||||
"empty_chats": "No chats yet. Not all those who wander are lost — start one.",
|
||||
"empty_agents": "No agent chats. Start one from the web interface on a linked device.",
|
||||
"empty_agents": "No agent chats yet. Start one with New agent chat, on a device linked to this instance.",
|
||||
"new_agent_chat": "New agent chat",
|
||||
"agent_device": "Device",
|
||||
"agent_no_device": "No device is linked right now. Start `lembas service` on a computer signed in to this instance, then come back.",
|
||||
"agent_directory": "Folder on the device",
|
||||
"agent_directory_hint": "Empty: the device's first folder",
|
||||
"empty_chat": "What shall we talk about?",
|
||||
"loading_line": "Baking lembas…",
|
||||
"archive": "Archive",
|
||||
@@ -48,6 +53,15 @@ STRINGS: dict[str, str] = {
|
||||
"send": "Send",
|
||||
"stop": "Stop",
|
||||
"attach": "Attach a file",
|
||||
"attach_take_photo": "Take a photo",
|
||||
"attach_choose_photos": "Choose photos",
|
||||
"attach_choose_files": "Choose files",
|
||||
"copy_message": "Copy message",
|
||||
"copied": "Copied.",
|
||||
"rename_chat": "Rename chat",
|
||||
"save": "Save",
|
||||
"retry": "Try again",
|
||||
"offline": "The instance cannot be reached. Check the phone's connection, and that it can reach the instance's address.",
|
||||
"dictate": "Dictate",
|
||||
"remove": "Remove",
|
||||
"more": "More",
|
||||
@@ -58,6 +72,7 @@ STRINGS: dict[str, str] = {
|
||||
"mode_plan": "Plan",
|
||||
"mode_edit": "Edit",
|
||||
"mode_manual": "Manual",
|
||||
"mode_auto": "Auto",
|
||||
# Cards
|
||||
"card_approval": "Allow this?",
|
||||
"card_allow_once": "Allow once",
|
||||
|
||||
+82
-15
@@ -2,6 +2,9 @@
|
||||
"cs": {
|
||||
"about_version": "LLeMbas pro Android %1$s",
|
||||
"add_instance": "Přidat instanci",
|
||||
"agent_directory": "Složka na zařízení",
|
||||
"agent_directory_hint": "Prázdné: první složka zařízení",
|
||||
"agent_no_device": "Právě není propojené žádné zařízení. Spusťte `lembas service` na počítači přihlášeném k této instanci a vraťte se.",
|
||||
"archive": "Archivovat",
|
||||
"assist_hint": "Zeptejte se na cokoli",
|
||||
"assist_include_screen": "Zahrnout obrazovku",
|
||||
@@ -14,6 +17,9 @@
|
||||
"assistant_samsung": "Na telefonech Samsung: Nastavení › Pokročilé funkce › Boční tlačítko › Stisknutí a podržení › Digitální asistent.",
|
||||
"assistant_temporary": "Konverzace s asistentem jsou dočasné",
|
||||
"attach": "Přiložit soubor",
|
||||
"attach_choose_files": "Vybrat soubory",
|
||||
"attach_choose_photos": "Vybrat fotky",
|
||||
"attach_take_photo": "Vyfotit",
|
||||
"card_allow_once": "Povolit jednou",
|
||||
"card_answer": "Vaše odpověď",
|
||||
"card_approval": "Povolit to?",
|
||||
@@ -21,13 +27,15 @@
|
||||
"channel_asks": "Otázky a schválení",
|
||||
"device_name": "LLeMbas pro Android",
|
||||
"effort_off": "Úsilí: vypnuto",
|
||||
"empty_agents": "Žádné konverzace s agentem. Spusťte jednu z webového rozhraní na propojeném zařízení.",
|
||||
"empty_agents": "Zatím žádné konverzace s agentem. Spusťte jednu tlačítkem Nová konverzace s agentem na zařízení propojeném s touto instancí.",
|
||||
"empty_chat": "O čem si promluvíme?",
|
||||
"empty_chats": "Zatím žádné konverzace. Ne všichni, kdo bloudí, jsou ztraceni — založte jednu.",
|
||||
"listening": "Naslouchám…",
|
||||
"loading_line": "Pečou se lembasy…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Ručně",
|
||||
"more": "Více",
|
||||
"new_agent_chat": "Nová konverzace s agentem",
|
||||
"offline": "Instance není dostupná. Zkontrolujte připojení telefonu a to, zda se dostane na adresu instance.",
|
||||
"older": "Starší zprávy",
|
||||
"output_cut": "Výstup je zde zkrácen. Celý ho najdete na webové stránce.",
|
||||
"plan_approve": "Schválit plán",
|
||||
@@ -73,6 +81,9 @@
|
||||
"de": {
|
||||
"about_version": "LLeMbas für Android %1$s",
|
||||
"add_instance": "Instanz hinzufügen",
|
||||
"agent_directory": "Ordner auf dem Gerät",
|
||||
"agent_directory_hint": "Leer: der erste Ordner des Geräts",
|
||||
"agent_no_device": "Gerade ist kein Gerät verknüpft. Starten Sie `lembas service` auf einem Computer, der bei dieser Instanz angemeldet ist, und kommen Sie dann zurück.",
|
||||
"archive": "Archivieren",
|
||||
"assist_hint": "Fragen Sie irgendetwas",
|
||||
"assist_include_screen": "Bildschirm einbeziehen",
|
||||
@@ -85,6 +96,9 @@
|
||||
"assistant_samsung": "Auf Samsung-Telefonen: Einstellungen › Erweiterte Funktionen › Seitentaste › Gedrückt halten › Digitaler Assistent.",
|
||||
"assistant_temporary": "Assistenten-Chats sind temporär",
|
||||
"attach": "Datei anhängen",
|
||||
"attach_choose_files": "Dateien auswählen",
|
||||
"attach_choose_photos": "Fotos auswählen",
|
||||
"attach_take_photo": "Foto aufnehmen",
|
||||
"card_allow_once": "Einmal erlauben",
|
||||
"card_answer": "Ihre Antwort",
|
||||
"card_approval": "Das erlauben?",
|
||||
@@ -92,13 +106,16 @@
|
||||
"channel_asks": "Fragen und Bestätigungen",
|
||||
"device_name": "LLeMbas für Android",
|
||||
"effort_off": "Aufwand: aus",
|
||||
"empty_agents": "Keine Agent-Chats. Starten Sie einen über die Weboberfläche auf einem verknüpften Gerät.",
|
||||
"empty_agents": "Noch keine Agent-Chats. Starten Sie einen mit „Neuer Agent-Chat“ auf einem Gerät, das mit dieser Instanz verknüpft ist.",
|
||||
"empty_chat": "Worüber sprechen wir?",
|
||||
"empty_chats": "Noch keine Chats. Nicht jeder, der wandert, ist verloren — fangen Sie einen an.",
|
||||
"listening": "Hört zu…",
|
||||
"loading_line": "Lembas wird gebacken…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Manuell",
|
||||
"mode_plan": "Plan",
|
||||
"more": "Mehr",
|
||||
"new_agent_chat": "Neuer Agent-Chat",
|
||||
"offline": "Die Instanz ist nicht erreichbar. Prüfen Sie die Verbindung des Telefons und ob es die Adresse der Instanz erreicht.",
|
||||
"older": "Frühere Nachrichten",
|
||||
"output_cut": "Die Ausgabe ist hier verkürzt. Vollständig finden Sie sie auf der Webseite.",
|
||||
"plan_approve": "Plan bestätigen",
|
||||
@@ -144,6 +161,9 @@
|
||||
"es": {
|
||||
"about_version": "LLeMbas para Android %1$s",
|
||||
"add_instance": "Añadir una instancia",
|
||||
"agent_directory": "Carpeta en el dispositivo",
|
||||
"agent_directory_hint": "Vacío: la primera carpeta del dispositivo",
|
||||
"agent_no_device": "Ahora no hay ningún dispositivo vinculado. Inicie `lembas service` en un ordenador con sesión iniciada en esta instancia y vuelva.",
|
||||
"archive": "Archivar",
|
||||
"assist_hint": "Pregunte lo que quiera",
|
||||
"assist_include_screen": "Incluir pantalla",
|
||||
@@ -156,6 +176,9 @@
|
||||
"assistant_samsung": "En los teléfonos Samsung: Ajustes › Funciones avanzadas › Botón lateral › Mantener pulsado › Asistente digital.",
|
||||
"assistant_temporary": "Los chats del asistente son temporales",
|
||||
"attach": "Adjuntar un archivo",
|
||||
"attach_choose_files": "Elegir archivos",
|
||||
"attach_choose_photos": "Elegir fotos",
|
||||
"attach_take_photo": "Hacer una foto",
|
||||
"card_allow_once": "Permitir una vez",
|
||||
"card_answer": "Su respuesta",
|
||||
"card_approval": "¿Permitir esto?",
|
||||
@@ -163,13 +186,15 @@
|
||||
"channel_asks": "Preguntas y aprobaciones",
|
||||
"device_name": "LLeMbas para Android",
|
||||
"effort_off": "Esfuerzo: desactivado",
|
||||
"empty_agents": "No hay chats de agente. Inicie uno desde la interfaz web en un dispositivo vinculado.",
|
||||
"empty_agents": "Aún no hay chats de agente. Inicie uno con Nuevo chat de agente, en un dispositivo vinculado a esta instancia.",
|
||||
"empty_chat": "¿De qué hablamos?",
|
||||
"empty_chats": "Aún no hay chats. No todos los que vagan están perdidos — empiece uno.",
|
||||
"listening": "Escuchando…",
|
||||
"loading_line": "Horneando lembas…",
|
||||
"mode_manual": "Manual",
|
||||
"more": "Más",
|
||||
"new_agent_chat": "Nuevo chat de agente",
|
||||
"offline": "No se puede acceder a la instancia. Compruebe la conexión del teléfono y que llegue a la dirección de la instancia.",
|
||||
"older": "Mensajes anteriores",
|
||||
"output_cut": "La salida está acortada aquí. La tiene completa en la página web.",
|
||||
"plan_approve": "Aprobar el plan",
|
||||
@@ -215,6 +240,9 @@
|
||||
"fr": {
|
||||
"about_version": "LLeMbas pour Android %1$s",
|
||||
"add_instance": "Ajouter une instance",
|
||||
"agent_directory": "Dossier sur l'appareil",
|
||||
"agent_directory_hint": "Vide : le premier dossier de l'appareil",
|
||||
"agent_no_device": "Aucun appareil n'est associé pour l'instant. Lancez `lembas service` sur un ordinateur connecté à cette instance, puis revenez.",
|
||||
"archive": "Archiver",
|
||||
"assist_hint": "Demandez n'importe quoi",
|
||||
"assist_include_screen": "Inclure l'écran",
|
||||
@@ -227,6 +255,9 @@
|
||||
"assistant_samsung": "Sur les téléphones Samsung : Paramètres › Fonctions avancées › Bouton latéral › Maintenir enfoncé › Assistant numérique.",
|
||||
"assistant_temporary": "Les conversations de l'assistant sont temporaires",
|
||||
"attach": "Joindre un fichier",
|
||||
"attach_choose_files": "Choisir des fichiers",
|
||||
"attach_choose_photos": "Choisir des photos",
|
||||
"attach_take_photo": "Prendre une photo",
|
||||
"card_allow_once": "Autoriser une fois",
|
||||
"card_answer": "Votre réponse",
|
||||
"card_approval": "Autoriser ceci ?",
|
||||
@@ -234,13 +265,16 @@
|
||||
"channel_asks": "Questions et approbations",
|
||||
"device_name": "LLeMbas pour Android",
|
||||
"effort_off": "Effort : désactivé",
|
||||
"empty_agents": "Aucune conversation d'agent. Démarrez-en une depuis l'interface web sur un appareil associé.",
|
||||
"empty_agents": "Pas encore de conversation d'agent. Démarrez-en une avec Nouvelle conversation d'agent, sur un appareil associé à cette instance.",
|
||||
"empty_chat": "De quoi allons-nous parler ?",
|
||||
"empty_chats": "Pas encore de conversation. Tous ceux qui errent ne sont pas perdus — commencez-en une.",
|
||||
"listening": "Écoute…",
|
||||
"loading_line": "Cuisson des lembas…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Manuel",
|
||||
"mode_plan": "Plan",
|
||||
"more": "Plus",
|
||||
"new_agent_chat": "Nouvelle conversation d'agent",
|
||||
"offline": "L'instance est injoignable. Vérifiez la connexion du téléphone et qu'il atteint bien l'adresse de l'instance.",
|
||||
"older": "Messages précédents",
|
||||
"output_cut": "La sortie est raccourcie ici. Vous la trouverez en entier sur la page web.",
|
||||
"plan_approve": "Approuver le plan",
|
||||
@@ -286,6 +320,9 @@
|
||||
"hu": {
|
||||
"about_version": "LLeMbas Androidra %1$s",
|
||||
"add_instance": "Példány hozzáadása",
|
||||
"agent_directory": "Mappa az eszközön",
|
||||
"agent_directory_hint": "Üres: az eszköz első mappája",
|
||||
"agent_no_device": "Jelenleg nincs összekapcsolt eszköz. Indítsa el a `lembas service` parancsot egy ebbe a példányba bejelentkezett számítógépen, majd térjen vissza.",
|
||||
"archive": "Archiválás",
|
||||
"assist_hint": "Kérdezzen bármit",
|
||||
"assist_include_screen": "Képernyő hozzáadása",
|
||||
@@ -298,6 +335,9 @@
|
||||
"assistant_samsung": "Samsung telefonokon: Beállítások › Speciális funkciók › Oldalgomb › Nyomva tartás › Digitális asszisztens.",
|
||||
"assistant_temporary": "Az asszisztenses csevegések ideiglenesek",
|
||||
"attach": "Fájl csatolása",
|
||||
"attach_choose_files": "Fájlok kiválasztása",
|
||||
"attach_choose_photos": "Fényképek kiválasztása",
|
||||
"attach_take_photo": "Fénykép készítése",
|
||||
"card_allow_once": "Engedélyezés egyszer",
|
||||
"card_answer": "Az Ön válasza",
|
||||
"card_approval": "Engedélyezzük ezt?",
|
||||
@@ -305,13 +345,16 @@
|
||||
"channel_asks": "Kérdések és jóváhagyások",
|
||||
"device_name": "LLeMbas Androidra",
|
||||
"effort_off": "Erőfeszítés: kikapcsolva",
|
||||
"empty_agents": "Nincs ügynök-csevegés. Indítson el egyet a webes felületen egy összekapcsolt eszközön.",
|
||||
"empty_agents": "Még nincs ügynök-csevegés. Indítson egyet az Új ügynök-csevegés gombbal, egy ehhez a példányhoz kapcsolt eszközön.",
|
||||
"empty_chat": "Miről beszéljünk?",
|
||||
"empty_chats": "Még nincs csevegés. Nem mindenki van elveszve, aki bolyong — kezdjen el egyet.",
|
||||
"listening": "Hallgatja…",
|
||||
"loading_line": "Lembas sül…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Kézi",
|
||||
"mode_plan": "Terv",
|
||||
"more": "Továbbiak",
|
||||
"new_agent_chat": "Új ügynök-csevegés",
|
||||
"offline": "A példány nem érhető el. Ellenőrizze a telefon kapcsolatát, és hogy eléri-e a példány címét.",
|
||||
"older": "Korábbi üzenetek",
|
||||
"output_cut": "A kimenet itt lerövidítve jelenik meg. A teljes szöveg a weblapon található.",
|
||||
"plan_approve": "Terv jóváhagyása",
|
||||
@@ -357,6 +400,9 @@
|
||||
"it": {
|
||||
"about_version": "LLeMbas per Android %1$s",
|
||||
"add_instance": "Aggiungi un'istanza",
|
||||
"agent_directory": "Cartella sul dispositivo",
|
||||
"agent_directory_hint": "Vuoto: la prima cartella del dispositivo",
|
||||
"agent_no_device": "Nessun dispositivo è collegato ora. Avvia `lembas service` su un computer connesso a questa istanza, poi torna qui.",
|
||||
"archive": "Archivia",
|
||||
"assist_hint": "Chiedi qualsiasi cosa",
|
||||
"assist_include_screen": "Includi lo schermo",
|
||||
@@ -369,6 +415,9 @@
|
||||
"assistant_samsung": "Sui telefoni Samsung: Impostazioni › Funzioni avanzate › Tasto laterale › Pressione prolungata › Assistente digitale.",
|
||||
"assistant_temporary": "Le chat dell'assistente sono temporanee",
|
||||
"attach": "Allega un file",
|
||||
"attach_choose_files": "Scegli file",
|
||||
"attach_choose_photos": "Scegli foto",
|
||||
"attach_take_photo": "Scatta una foto",
|
||||
"card_allow_once": "Consenti una volta",
|
||||
"card_answer": "La tua risposta",
|
||||
"card_approval": "Consentire questo?",
|
||||
@@ -376,13 +425,15 @@
|
||||
"channel_asks": "Domande e approvazioni",
|
||||
"device_name": "LLeMbas per Android",
|
||||
"effort_off": "Impegno: disattivato",
|
||||
"empty_agents": "Nessuna chat agente. Avviane una dall'interfaccia web su un dispositivo collegato.",
|
||||
"empty_agents": "Ancora nessuna chat agente. Avviane una con Nuova chat agente, su un dispositivo collegato a questa istanza.",
|
||||
"empty_chat": "Di cosa parliamo?",
|
||||
"empty_chats": "Ancora nessuna chat. Non tutti quelli che vagano sono perduti — iniziane una.",
|
||||
"listening": "In ascolto…",
|
||||
"loading_line": "I lembas stanno cuocendo…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Manuale",
|
||||
"more": "Altro",
|
||||
"new_agent_chat": "Nuova chat agente",
|
||||
"offline": "L'istanza non è raggiungibile. Controlla la connessione del telefono e che raggiunga l'indirizzo dell'istanza.",
|
||||
"older": "Messaggi precedenti",
|
||||
"output_cut": "L'output qui è abbreviato. Lo trovi per intero sulla pagina web.",
|
||||
"plan_approve": "Approva il piano",
|
||||
@@ -428,6 +479,9 @@
|
||||
"pl": {
|
||||
"about_version": "LLeMbas na Androida %1$s",
|
||||
"add_instance": "Dodaj instancję",
|
||||
"agent_directory": "Folder na urządzeniu",
|
||||
"agent_directory_hint": "Puste: pierwszy folder urządzenia",
|
||||
"agent_no_device": "Żadne urządzenie nie jest teraz połączone. Uruchom `lembas service` na komputerze zalogowanym do tej instancji i wróć.",
|
||||
"archive": "Archiwizuj",
|
||||
"assist_hint": "Zapytaj o cokolwiek",
|
||||
"assist_include_screen": "Dołącz ekran",
|
||||
@@ -440,6 +494,9 @@
|
||||
"assistant_samsung": "W telefonach Samsung: Ustawienia › Funkcje zaawansowane › Przycisk boczny › Naciśnięcie i przytrzymanie › Asystent cyfrowy.",
|
||||
"assistant_temporary": "Czaty asystenta są tymczasowe",
|
||||
"attach": "Załącz plik",
|
||||
"attach_choose_files": "Wybierz pliki",
|
||||
"attach_choose_photos": "Wybierz zdjęcia",
|
||||
"attach_take_photo": "Zrób zdjęcie",
|
||||
"card_allow_once": "Zezwól raz",
|
||||
"card_answer": "Twoja odpowiedź",
|
||||
"card_approval": "Zezwolić na to?",
|
||||
@@ -447,13 +504,15 @@
|
||||
"channel_asks": "Pytania i zatwierdzenia",
|
||||
"device_name": "LLeMbas na Androida",
|
||||
"effort_off": "Wysiłek: wyłączony",
|
||||
"empty_agents": "Brak czatów agenta. Zacznij jeden z interfejsu webowego na połączonym urządzeniu.",
|
||||
"empty_agents": "Brak czatów agenta. Zacznij jeden przyciskiem Nowy czat agenta, na urządzeniu połączonym z tą instancją.",
|
||||
"empty_chat": "O czym porozmawiamy?",
|
||||
"empty_chats": "Nie ma jeszcze czatów. Nie każdy, kto błądzi, jest zgubiony — zacznij jeden.",
|
||||
"listening": "Słucham…",
|
||||
"loading_line": "Lembasy się pieczą…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Ręcznie",
|
||||
"more": "Więcej",
|
||||
"new_agent_chat": "Nowy czat agenta",
|
||||
"offline": "Instancja jest nieosiągalna. Sprawdź połączenie telefonu i czy dociera on do adresu instancji.",
|
||||
"older": "Wcześniejsze wiadomości",
|
||||
"output_cut": "Wynik jest tu skrócony. Cały znajduje się na stronie internetowej.",
|
||||
"plan_approve": "Zatwierdź plan",
|
||||
@@ -499,6 +558,9 @@
|
||||
"sk": {
|
||||
"about_version": "LLeMbas pre Android %1$s",
|
||||
"add_instance": "Pridať inštanciu",
|
||||
"agent_directory": "Zložka v zariadení",
|
||||
"agent_directory_hint": "Prázdne: prvá zložka zariadenia",
|
||||
"agent_no_device": "Práve nie je prepojené žiadne zariadenie. Spustite `lembas service` na počítači prihlásenom do tejto inštancie a vráťte sa.",
|
||||
"archive": "Archivovať",
|
||||
"assist_hint": "Spýtajte sa na čokoľvek",
|
||||
"assist_include_screen": "Zahrnúť obrazovku",
|
||||
@@ -511,6 +573,9 @@
|
||||
"assistant_samsung": "Na telefónoch Samsung: Nastavenia › Rozšírené funkcie › Tlačidlo na boku › Stlačenie a podržanie › Digitálny asistent.",
|
||||
"assistant_temporary": "Konverzácie s asistentom sú dočasné",
|
||||
"attach": "Priložiť súbor",
|
||||
"attach_choose_files": "Vybrať súbory",
|
||||
"attach_choose_photos": "Vybrať fotky",
|
||||
"attach_take_photo": "Odfotiť",
|
||||
"card_allow_once": "Povoliť raz",
|
||||
"card_answer": "Vaša odpoveď",
|
||||
"card_approval": "Povoliť to?",
|
||||
@@ -518,13 +583,15 @@
|
||||
"channel_asks": "Otázky a schválenia",
|
||||
"device_name": "LLeMbas pre Android",
|
||||
"effort_off": "Úsilie: vypnuté",
|
||||
"empty_agents": "Žiadne konverzácie s agentom. Spustite jednu z webového rozhrania na prepojenom zariadení.",
|
||||
"empty_agents": "Zatiaľ žiadne konverzácie s agentom. Spustite jednu tlačidlom Nová konverzácia s agentom na zariadení prepojenom s touto inštanciou.",
|
||||
"empty_chat": "O čom sa pozhovárame?",
|
||||
"empty_chats": "Zatiaľ žiadne konverzácie. Nie všetci, čo blúdia, sú stratení — začnite jednu.",
|
||||
"listening": "Počúvam…",
|
||||
"loading_line": "Pečú sa lembasy…",
|
||||
"mode_manual": "Manual",
|
||||
"mode_manual": "Ručne",
|
||||
"more": "Viac",
|
||||
"new_agent_chat": "Nová konverzácia s agentom",
|
||||
"offline": "Inštancia nie je dostupná. Skontrolujte pripojenie telefónu a či sa dostane na adresu inštancie.",
|
||||
"older": "Staršie správy",
|
||||
"output_cut": "Výstup je tu skrátený. Celý nájdete na webovej stránke.",
|
||||
"plan_approve": "Schváliť plán",
|
||||
|
||||
Reference in new issue
Block a user