Memory screen: list, remember, change and forget over /api/v2/memories
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
Drawer › Memory (server f7f2ff2): GET/POST/PATCH/DELETE /memories. Newest first, plain text (a model may have written it; marked with the Model icon), the data group shown when there is more than one and offered when remembering a new one. A refusal (the limit, an empty text) is the server's sentence. Every word from the server's catalogue. ContractTest reads memories.json and memory.json; shots 28-memory (normal, small phone at 1.5x, empty). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
19 files changed
+480
-2
No files matched your search
@@ -24,6 +24,9 @@ is in alpha and releases come off `main`.
|
||||
too), then the rest. A long press on a chat offers **Pin chat** and **Move to folder**; on a
|
||||
folder, **Rename folder** and **Delete folder** (its chats stay). **New folder** is beside New
|
||||
chat at the top of the drawer.
|
||||
- **Memory**, in the drawer: what models remember about you, as Settings › Memory on the web.
|
||||
A tap changes or forgets one; **Remember** adds one (in the data group you pick, when you have
|
||||
more than one). What a model wrote is marked, and shown as plain text.
|
||||
- **A scheduled task that watches a web page** says so on its page (*Only when this page
|
||||
changes*, and the address), and a run that found the page unchanged is shown as *Unchanged*.
|
||||
- **A scheduled task's notification shows its result.** Unlocked, it carries the task's name
|
||||
|
||||
@@ -44,6 +44,7 @@ import eu.llembas.android.ui.home.ArchivedScreen
|
||||
import eu.llembas.android.ui.home.ChatsViewModel
|
||||
import eu.llembas.android.ui.home.DrawerActions
|
||||
import eu.llembas.android.ui.home.DrawerContent
|
||||
import eu.llembas.android.ui.memory.MemoryScreen
|
||||
import eu.llembas.android.ui.scheduled.RunScreen
|
||||
import eu.llembas.android.ui.scheduled.ScheduleEditScreen
|
||||
import eu.llembas.android.ui.scheduled.ScheduleScreen
|
||||
@@ -223,6 +224,8 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
override fun archived() = over("archived")
|
||||
|
||||
override fun memory() = over("memory")
|
||||
|
||||
override fun settings() = over("settings")
|
||||
|
||||
override fun more() = chats.more()
|
||||
@@ -273,6 +276,7 @@ class MainActivity : ComponentActivity() {
|
||||
composable("archived") {
|
||||
ArchivedScreen(onBack = { nav.popBackStack() }, onOpen = { top("chat/$it") }, onRestored = { chats.load() })
|
||||
}
|
||||
composable("memory") { MemoryScreen(onBack = { nav.popBackStack() }) }
|
||||
composable("scheduled") {
|
||||
ScheduledScreen(
|
||||
onBack = { nav.popBackStack() },
|
||||
|
||||
@@ -171,6 +171,25 @@ class ApiClient(val base: String, private val token: String, val http: OkHttpCli
|
||||
/** The folder and the folders inside it; their chats fall back to no folder. */
|
||||
suspend fun deleteFolder(id: String) = empty(authed("$v2/folders/${segment(id)}").delete().build())
|
||||
|
||||
// --- Memory (`library.use`) -----------------------------------------------------------------
|
||||
|
||||
/** The person's memories, every data group, and the groups they may file one in. */
|
||||
suspend fun memories(): MemoryList = get("/memories")
|
||||
|
||||
suspend fun addMemory(content: String, groupId: String? = null): Memory = send<MemoryEnvelope>(
|
||||
"POST",
|
||||
"/memories",
|
||||
buildJsonObject {
|
||||
put("content", content)
|
||||
if (groupId != null) put("data_group_id", groupId)
|
||||
},
|
||||
).memory
|
||||
|
||||
suspend fun editMemory(id: String, content: String): Memory =
|
||||
send<MemoryEnvelope>("PATCH", "/memories/${segment(id)}", buildJsonObject { put("content", content) }).memory
|
||||
|
||||
suspend fun forgetMemory(id: String) = empty(authed("$v2/memories/${segment(id)}").delete().build())
|
||||
|
||||
suspend fun devices(): List<LinkedDevice> = get<DeviceList>("/devices").devices
|
||||
|
||||
/** The token revokes itself (`lembas logout`'s route). */
|
||||
|
||||
@@ -188,6 +188,32 @@ data class Folder(
|
||||
@Serializable
|
||||
data class FolderEnvelope(val folder: Folder)
|
||||
|
||||
/** A data group: whose records a memory is kept among. */
|
||||
@Serializable
|
||||
data class DataGroup(val id: String = "", val name: String = "")
|
||||
|
||||
/**
|
||||
* One memory (`/api/v2/memories`, Settings › Memory on the web): its text, who wrote it (`user`
|
||||
* or `model` -- a model's is model output, drawn as plain text), and its data group.
|
||||
*/
|
||||
@Serializable
|
||||
data class Memory(
|
||||
val id: String,
|
||||
val content: String = "",
|
||||
val author: String = "",
|
||||
@SerialName("data_group") val dataGroup: DataGroup = DataGroup(),
|
||||
@SerialName("created_at") val createdAt: String? = null,
|
||||
@SerialName("updated_at") val updatedAt: String? = null,
|
||||
) {
|
||||
val byModel: Boolean get() = author == "model"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MemoryList(val memories: List<Memory> = emptyList(), val groups: List<DataGroup> = emptyList())
|
||||
|
||||
@Serializable
|
||||
data class MemoryEnvelope(val memory: Memory)
|
||||
|
||||
@Serializable
|
||||
data class FolderList(val folders: List<Folder> = emptyList())
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.compose.material.icons.filled.ExpandLess
|
||||
import androidx.compose.material.icons.filled.ExpandMore
|
||||
import androidx.compose.material.icons.filled.Folder
|
||||
import androidx.compose.material.icons.filled.Inventory2
|
||||
import androidx.compose.material.icons.filled.Psychology
|
||||
import androidx.compose.material.icons.filled.PushPin
|
||||
import androidx.compose.material.icons.filled.Schedule
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
@@ -230,14 +231,15 @@ interface DrawerActions {
|
||||
fun files() {}
|
||||
fun scheduled() {}
|
||||
fun archived() {}
|
||||
fun memory() {}
|
||||
fun settings() {}
|
||||
fun more() {}
|
||||
fun retry() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* The navigation drawer: New chat (and New folder) at the top, search, Files, Scheduled and
|
||||
* Archived, then the chats -- the pinned ones, the folders as a tree with theirs, then today's,
|
||||
* The navigation drawer: New chat (and New folder) at the top, search, Files, Scheduled,
|
||||
* Archived and Memory, then the chats -- the pinned ones, the folders as a tree with theirs, then today's,
|
||||
* the earlier ones and the agent chats -- and Settings with the account at the foot. A long press
|
||||
* on a chat offers Pin, Move to folder and Archive; on a folder, Rename and Delete.
|
||||
*/
|
||||
@@ -296,6 +298,7 @@ fun DrawerContent(
|
||||
item { DrawerItem(Icons.Filled.Folder, stringResource(R.string.files), onClick = actions::files) }
|
||||
item { DrawerItem(Icons.Filled.Schedule, stringResource(R.string.scheduled), onClick = actions::scheduled) }
|
||||
item { DrawerItem(Icons.Filled.Inventory2, stringResource(R.string.archived), onClick = actions::archived) }
|
||||
item { DrawerItem(Icons.Filled.Psychology, stringResource(R.string.memory), onClick = actions::memory) }
|
||||
item { HorizontalDivider(color = palette.border, modifier = Modifier.padding(horizontal = 28.dp, vertical = 8.dp)) }
|
||||
state.error?.let { error ->
|
||||
item {
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
@file:OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)
|
||||
|
||||
package eu.llembas.android.ui.memory
|
||||
|
||||
import android.app.Application
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.SmartToy
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExtendedFloatingActionButton
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.ListItem
|
||||
import androidx.compose.material3.ListItemDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
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.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.api.DataGroup
|
||||
import eu.llembas.android.api.Memory
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.explain
|
||||
import eu.llembas.android.ui.theme.LocalPalette
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
data class MemoryState(
|
||||
val memories: List<Memory> = emptyList(),
|
||||
val groups: List<DataGroup> = emptyList(),
|
||||
val loading: Boolean = false,
|
||||
val error: String? = null,
|
||||
)
|
||||
|
||||
/** The person's memories (`/api/v2/memories`): read, added, changed and forgotten. */
|
||||
class MemoryViewModel(app: Application) : AndroidViewModel(app) {
|
||||
private val _state = MutableStateFlow(MemoryState(loading = true))
|
||||
val state = _state.asStateFlow()
|
||||
|
||||
fun load() {
|
||||
viewModelScope.launch {
|
||||
_state.update { it.copy(loading = true, error = null) }
|
||||
try {
|
||||
val api = getApplication<Application>().lembas.instances.client() ?: return@launch
|
||||
val list = api.memories()
|
||||
_state.value = MemoryState(memories = list.memories, groups = list.groups)
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(loading = false, error = getApplication<Application>().explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun add(content: String, groupId: String?) = act { api ->
|
||||
val made = api.addMemory(content, groupId)
|
||||
_state.update { it.copy(memories = listOf(made) + it.memories) }
|
||||
}
|
||||
|
||||
fun edit(memory: Memory, content: String) = act { api ->
|
||||
val changed = api.editMemory(memory.id, content)
|
||||
_state.update { s -> s.copy(memories = s.memories.map { if (it.id == changed.id) changed else it }) }
|
||||
}
|
||||
|
||||
fun forget(memory: Memory) = act { api ->
|
||||
api.forgetMemory(memory.id)
|
||||
_state.update { s -> s.copy(memories = s.memories.filterNot { it.id == memory.id }) }
|
||||
}
|
||||
|
||||
/** One change; a refusal (a limit, an empty text, one already gone) is the server's sentence. */
|
||||
private fun act(change: suspend (eu.llembas.android.api.ApiClient) -> Unit) {
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
val api = getApplication<Application>().lembas.instances.client() ?: return@launch
|
||||
_state.update { it.copy(error = null) }
|
||||
change(api)
|
||||
} catch (e: Exception) {
|
||||
_state.update { it.copy(error = getApplication<Application>().explain(e)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface MemoryActions {
|
||||
fun add(content: String, groupId: String?) {}
|
||||
fun edit(memory: Memory, content: String) {}
|
||||
fun forget(memory: Memory) {}
|
||||
fun reload() {}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MemoryScreen(onBack: () -> Unit, model: MemoryViewModel = viewModel()) {
|
||||
val state by model.state.collectAsStateWithLifecycle()
|
||||
LaunchedEffect(Unit) { model.load() }
|
||||
MemoryContent(
|
||||
state,
|
||||
object : MemoryActions {
|
||||
override fun add(content: String, groupId: String?) = model.add(content, groupId)
|
||||
|
||||
override fun edit(memory: Memory, content: String) = model.edit(memory, content)
|
||||
|
||||
override fun forget(memory: Memory) = model.forget(memory)
|
||||
|
||||
override fun reload() = model.load()
|
||||
},
|
||||
onBack,
|
||||
)
|
||||
}
|
||||
|
||||
/** What the dialog is for: a new memory ([memory] null), or changing one. */
|
||||
private data class Editing(val memory: Memory? = null)
|
||||
|
||||
/**
|
||||
* Memory, as Settings › Memory on the web: what models remember about you, newest first. A row
|
||||
* is the text (plain, never markdown: a model may have written it), with a mark when a model
|
||||
* did and the data group when there is more than one. A tap edits or forgets it; Add remembers
|
||||
* something new.
|
||||
*/
|
||||
@Composable
|
||||
fun MemoryContent(state: MemoryState, actions: MemoryActions, onBack: () -> Unit = {}) {
|
||||
val palette = LocalPalette.current
|
||||
var editing by remember { mutableStateOf<Editing?>(null) }
|
||||
val manyGroups = state.groups.size > 1
|
||||
Scaffold(
|
||||
containerColor = palette.bg,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = palette.bg, scrolledContainerColor = palette.bg),
|
||||
title = { Text(stringResource(R.string.memory)) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back)) }
|
||||
},
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
ExtendedFloatingActionButton(
|
||||
onClick = { editing = Editing() },
|
||||
icon = { Icon(Icons.Filled.Add, contentDescription = null) },
|
||||
text = { Text(stringResource(R.string.memory_remember)) },
|
||||
containerColor = palette.accent,
|
||||
contentColor = palette.accentInk,
|
||||
)
|
||||
},
|
||||
) { padding ->
|
||||
PullToRefreshBox(isRefreshing = state.loading && state.memories.isNotEmpty(), onRefresh = actions::reload, modifier = Modifier.padding(padding)) {
|
||||
LazyColumn(Modifier.fillMaxSize()) {
|
||||
item {
|
||||
Text(
|
||||
stringResource(R.string.memory_intro),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = palette.inkMuted,
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
)
|
||||
}
|
||||
state.error?.let { error ->
|
||||
item {
|
||||
ListItem(
|
||||
headlineContent = { Text(error, color = palette.danger, style = MaterialTheme.typography.bodyMedium) },
|
||||
trailingContent = { TextButton(onClick = actions::reload) { Text(stringResource(R.string.retry)) } },
|
||||
colors = ListItemDefaults.colors(containerColor = palette.bg),
|
||||
)
|
||||
}
|
||||
}
|
||||
if (state.memories.isEmpty() && !state.loading && state.error == null) {
|
||||
item {
|
||||
Box(Modifier.fillMaxWidth().padding(24.dp)) {
|
||||
Text(stringResource(R.string.memory_none), color = palette.inkMuted, style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
}
|
||||
}
|
||||
items(state.memories, key = { it.id }) { memory ->
|
||||
ListItem(
|
||||
headlineContent = { Text(memory.content, maxLines = 4, overflow = TextOverflow.Ellipsis) },
|
||||
supportingContent = if (manyGroups) {
|
||||
{ Text(memory.dataGroup.name, color = palette.inkFaint, maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
||||
} else {
|
||||
null
|
||||
},
|
||||
trailingContent = if (memory.byModel) {
|
||||
{ Icon(Icons.Filled.SmartToy, contentDescription = stringResource(R.string.memory_by_model), tint = palette.inkFaint) }
|
||||
} else {
|
||||
null
|
||||
},
|
||||
colors = ListItemDefaults.colors(containerColor = palette.bg),
|
||||
modifier = Modifier.clickable { editing = Editing(memory) }.heightIn(min = 48.dp),
|
||||
)
|
||||
HorizontalDivider(color = palette.border, modifier = Modifier.padding(start = 16.dp))
|
||||
}
|
||||
// Room under the last row for the button over it.
|
||||
item { Box(Modifier.heightIn(min = 88.dp)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
editing?.let { asked ->
|
||||
MemoryDialog(
|
||||
asked.memory,
|
||||
groups = if (manyGroups) state.groups else emptyList(),
|
||||
onSave = { content, group ->
|
||||
editing = null
|
||||
if (asked.memory != null) actions.edit(asked.memory, content) else actions.add(content, group)
|
||||
},
|
||||
onForget = {
|
||||
editing = null
|
||||
asked.memory?.let(actions::forget)
|
||||
},
|
||||
onDismiss = { editing = null },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A memory's text in one box. New: Remember, and the data group when there is a choice. An
|
||||
* existing one: Save and Forget.
|
||||
*/
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun MemoryDialog(memory: Memory?, groups: List<DataGroup>, onSave: (String, String?) -> Unit, onForget: () -> Unit, onDismiss: () -> Unit) {
|
||||
val palette = LocalPalette.current
|
||||
var text by remember { mutableStateOf(memory?.content.orEmpty()) }
|
||||
var group by remember { mutableStateOf(groups.firstOrNull()?.id) }
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(if (memory == null) R.string.memory_remember else R.string.memory)) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
OutlinedTextField(
|
||||
value = text,
|
||||
onValueChange = { text = it },
|
||||
label = { Text(stringResource(R.string.memory_label)) },
|
||||
placeholder = { Text(stringResource(R.string.memory_hint)) },
|
||||
minLines = 2,
|
||||
maxLines = 8,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
if (memory == null && groups.isNotEmpty()) {
|
||||
Text(stringResource(R.string.memory_group), style = MaterialTheme.typography.labelLarge, color = palette.inkMuted)
|
||||
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
groups.forEach { g ->
|
||||
FilterChip(selected = group == g.id, onClick = { group = g.id }, label = { Text(g.name) })
|
||||
}
|
||||
}
|
||||
}
|
||||
if (memory != null) {
|
||||
TextButton(onClick = onForget, modifier = Modifier.heightIn(min = 48.dp)) {
|
||||
Text(stringResource(R.string.memory_forget), color = palette.danger)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(onClick = { onSave(text.trim(), group) }, enabled = text.isNotBlank()) {
|
||||
Text(stringResource(if (memory == null) R.string.memory_remember else R.string.save))
|
||||
}
|
||||
},
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) } },
|
||||
)
|
||||
}
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archivované</string>
|
||||
<string name="archived_restore">Obnovit konverzaci</string>
|
||||
<string name="archived_none">Žádné archivované konverzace.</string>
|
||||
<string name="memory">Paměť</string>
|
||||
<string name="memory_intro">Co si o vás modely pamatují</string>
|
||||
<string name="memory_none">Zatím nic. Model, který má nástroj paměti, sem přidá záznam, když mu řeknete něco, co stojí za uchování.</string>
|
||||
<string name="memory_remember">Zapamatovat</string>
|
||||
<string name="memory_label">Co říká tento záznam v paměti</string>
|
||||
<string name="memory_hint">Něco, co stojí za zapamatování</string>
|
||||
<string name="memory_group">Datová skupina</string>
|
||||
<string name="memory_forget">Zapomenout</string>
|
||||
<string name="memory_by_model">Model</string>
|
||||
<string name="chats_pinned">Připnuté konverzace</string>
|
||||
<string name="chat_pin">Připnout konverzaci</string>
|
||||
<string name="chat_unpin">Odepnout konverzaci</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archiviert</string>
|
||||
<string name="archived_restore">Chat wiederherstellen</string>
|
||||
<string name="archived_none">Keine archivierten Chats.</string>
|
||||
<string name="memory">Gedächtnis</string>
|
||||
<string name="memory_intro">Was sich Modelle über Sie merken</string>
|
||||
<string name="memory_none">Noch nichts. Ein Modell mit dem Gedächtniswerkzeug ergänzt dies, wenn Sie ihm etwas Merkenswertes sagen.</string>
|
||||
<string name="memory_remember">Merken</string>
|
||||
<string name="memory_label">Was diese Erinnerung besagt</string>
|
||||
<string name="memory_hint">Etwas Merkenswertes</string>
|
||||
<string name="memory_group">Datengruppe</string>
|
||||
<string name="memory_forget">Vergessen</string>
|
||||
<string name="memory_by_model">Modell</string>
|
||||
<string name="chats_pinned">Angeheftete Chats</string>
|
||||
<string name="chat_pin">Chat anheften</string>
|
||||
<string name="chat_unpin">Chat loslösen</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archivados</string>
|
||||
<string name="archived_restore">Restaurar chat</string>
|
||||
<string name="archived_none">No hay chats archivados.</string>
|
||||
<string name="memory">Memoria</string>
|
||||
<string name="memory_intro">Lo que los modelos recuerdan de usted</string>
|
||||
<string name="memory_none">Todavía nada. Un modelo con la herramienta de memoria añade algo aquí cuando usted le cuenta algo que vale la pena conservar.</string>
|
||||
<string name="memory_remember">Recordar</string>
|
||||
<string name="memory_label">Qué dice esta memoria</string>
|
||||
<string name="memory_hint">Algo que vale la pena recordar</string>
|
||||
<string name="memory_group">Grupo de datos</string>
|
||||
<string name="memory_forget">Olvidar</string>
|
||||
<string name="memory_by_model">Modelo</string>
|
||||
<string name="chats_pinned">Chats fijados</string>
|
||||
<string name="chat_pin">Fijar chat</string>
|
||||
<string name="chat_unpin">Dejar de fijar el chat</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archivées</string>
|
||||
<string name="archived_restore">Restaurer la conversation</string>
|
||||
<string name="archived_none">Aucune conversation archivée.</string>
|
||||
<string name="memory">Mémoire</string>
|
||||
<string name="memory_intro">Ce que les modèles retiennent de vous</string>
|
||||
<string name="memory_none">Rien pour l\'instant. Un modèle disposant de l\'outil de mémoire ajoute ici ce que vous lui dites qui vaut la peine d\'être retenu.</string>
|
||||
<string name="memory_remember">Retenir</string>
|
||||
<string name="memory_label">Ce que dit ce souvenir</string>
|
||||
<string name="memory_hint">Quelque chose qui vaut la peine d\'être retenu</string>
|
||||
<string name="memory_group">Groupe de données</string>
|
||||
<string name="memory_forget">Oublier</string>
|
||||
<string name="memory_by_model">Modèle</string>
|
||||
<string name="chats_pinned">Discussions épinglées</string>
|
||||
<string name="chat_pin">Épingler la discussion</string>
|
||||
<string name="chat_unpin">Désépingler la discussion</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archivált</string>
|
||||
<string name="archived_restore">Csevegés visszaállítása</string>
|
||||
<string name="archived_none">Nincs archivált csevegés.</string>
|
||||
<string name="memory">Memória</string>
|
||||
<string name="memory_intro">Amit a modellek megjegyeztek Önről</string>
|
||||
<string name="memory_none">Még semmi. A memóriaeszközzel rendelkező modell akkor egészíti ki, amikor valami megjegyzésre érdemeset mond neki.</string>
|
||||
<string name="memory_remember">Megjegyzés</string>
|
||||
<string name="memory_label">Mit mond ez a memória</string>
|
||||
<string name="memory_hint">Valami, amit érdemes megjegyezni</string>
|
||||
<string name="memory_group">Adatcsoport</string>
|
||||
<string name="memory_forget">Elfelejtés</string>
|
||||
<string name="memory_by_model">Modell</string>
|
||||
<string name="chats_pinned">Kitűzött beszélgetések</string>
|
||||
<string name="chat_pin">Beszélgetés kitűzése</string>
|
||||
<string name="chat_unpin">Kitűzés megszüntetése</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archiviate</string>
|
||||
<string name="archived_restore">Ripristina chat</string>
|
||||
<string name="archived_none">Nessuna chat archiviata.</string>
|
||||
<string name="memory">Memoria</string>
|
||||
<string name="memory_intro">Cosa ricordano di te i modelli</string>
|
||||
<string name="memory_none">Ancora niente. Un modello con lo strumento memoria aggiunge qualcosa qui quando gli dici qualcosa che vale la pena ricordare.</string>
|
||||
<string name="memory_remember">Ricorda</string>
|
||||
<string name="memory_label">Cosa dice questa memoria</string>
|
||||
<string name="memory_hint">Qualcosa che vale la pena ricordare</string>
|
||||
<string name="memory_group">Gruppo di dati</string>
|
||||
<string name="memory_forget">Dimentica</string>
|
||||
<string name="memory_by_model">Modello</string>
|
||||
<string name="chats_pinned">Chat fissate</string>
|
||||
<string name="chat_pin">Fissa la chat</string>
|
||||
<string name="chat_unpin">Togli la chat dalle fissate</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Zarchiwizowane</string>
|
||||
<string name="archived_restore">Przywróć czat</string>
|
||||
<string name="archived_none">Brak zarchiwizowanych czatów.</string>
|
||||
<string name="memory">Pamięć</string>
|
||||
<string name="memory_intro">Co modele pamiętają o użytkowniku</string>
|
||||
<string name="memory_none">Jeszcze nic. Model z narzędziem pamięci dodaje tu wpis, gdy usłyszy coś, co warto zachować.</string>
|
||||
<string name="memory_remember">Zapamiętaj</string>
|
||||
<string name="memory_label">Treść tego wspomnienia</string>
|
||||
<string name="memory_hint">Coś, co warto zapamiętać</string>
|
||||
<string name="memory_group">Grupa danych</string>
|
||||
<string name="memory_forget">Zapomnij</string>
|
||||
<string name="memory_by_model">Model</string>
|
||||
<string name="chats_pinned">Przypięte czaty</string>
|
||||
<string name="chat_pin">Przypnij czat</string>
|
||||
<string name="chat_unpin">Odepnij czat</string>
|
||||
|
||||
@@ -26,6 +26,15 @@
|
||||
<string name="archived">Archivované</string>
|
||||
<string name="archived_restore">Obnoviť konverzáciu</string>
|
||||
<string name="archived_none">Žiadne archivované konverzácie.</string>
|
||||
<string name="memory">Pamäť</string>
|
||||
<string name="memory_intro">Čo si o vás modely pamätajú</string>
|
||||
<string name="memory_none">Zatiaľ nič. Model, ktorý má nástroj pamäti, tu pridá záznam, keď mu povieš niečo, čo sa vyplatí uchovať.</string>
|
||||
<string name="memory_remember">Zapamätať</string>
|
||||
<string name="memory_label">Čo si táto pamäť pamätá</string>
|
||||
<string name="memory_hint">Niečo, čo sa vyplatí zapamätať</string>
|
||||
<string name="memory_group">Dátová oblasť</string>
|
||||
<string name="memory_forget">Zabudnúť</string>
|
||||
<string name="memory_by_model">Model</string>
|
||||
<string name="chats_pinned">Pripnuté konverzácie</string>
|
||||
<string name="chat_pin">Pripnúť konverzáciu</string>
|
||||
<string name="chat_unpin">Odopnúť konverzáciu</string>
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
<string name="archived">Archived</string>
|
||||
<string name="archived_restore">Restore chat</string>
|
||||
<string name="archived_none">No archived chats.</string>
|
||||
<string name="memory">Memory</string>
|
||||
<string name="memory_intro">What models remember about you</string>
|
||||
<string name="memory_none">Nothing yet. A model with the memory tool adds to this when you tell it something worth keeping.</string>
|
||||
<string name="memory_remember">Remember</string>
|
||||
<string name="memory_label">What this memory says</string>
|
||||
<string name="memory_hint">Something worth remembering</string>
|
||||
<string name="memory_group">Data group</string>
|
||||
<string name="memory_forget">Forget</string>
|
||||
<string name="memory_by_model">Model</string>
|
||||
<string name="chats_pinned">Pinned chats</string>
|
||||
<string name="chat_pin">Pin chat</string>
|
||||
<string name="chat_unpin">Unpin chat</string>
|
||||
|
||||
@@ -15,6 +15,8 @@ import eu.llembas.android.api.JobsFrame
|
||||
import eu.llembas.android.api.LembasJson
|
||||
import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.Me
|
||||
import eu.llembas.android.api.MemoryEnvelope
|
||||
import eu.llembas.android.api.MemoryList
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.Metrics
|
||||
import eu.llembas.android.api.ModelList
|
||||
@@ -58,6 +60,17 @@ class ContractTest {
|
||||
assertEquals("Waybread", read("folder", FolderEnvelope.serializer()).folder.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theMemoriesAndOne() {
|
||||
val list = read("memories", MemoryList.serializer())
|
||||
val one = list.memories.single()
|
||||
assertEquals("Prefers lembas warm.", one.content)
|
||||
assertFalse(one.byModel)
|
||||
assertEquals("default", one.dataGroup.id)
|
||||
assertEquals(listOf("Default"), list.groups.map { it.name })
|
||||
assertEquals("mem1", read("memory", MemoryEnvelope.serializer()).memory.id)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theVersionIsOneThisAppReads() {
|
||||
val version = LembasJson.parseToJsonElement(text("version")).toString()
|
||||
|
||||
@@ -8,10 +8,12 @@ import eu.llembas.android.api.AgentsSetting
|
||||
import eu.llembas.android.api.Attachment
|
||||
import eu.llembas.android.api.Chat
|
||||
import eu.llembas.android.api.ContextPart
|
||||
import eu.llembas.android.api.DataGroup
|
||||
import eu.llembas.android.api.Folder
|
||||
import eu.llembas.android.api.LembasJson
|
||||
import eu.llembas.android.api.LinkedDevice
|
||||
import eu.llembas.android.api.LiveReply
|
||||
import eu.llembas.android.api.Memory
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.Metrics
|
||||
import eu.llembas.android.api.ModelList
|
||||
@@ -42,6 +44,7 @@ import eu.llembas.android.auth.Prefs
|
||||
import eu.llembas.android.ui.chat.ChatState
|
||||
import eu.llembas.android.ui.chat.Draft
|
||||
import eu.llembas.android.ui.home.ChatsState
|
||||
import eu.llembas.android.ui.memory.MemoryState
|
||||
import eu.llembas.android.ui.scheduled.EditState
|
||||
import eu.llembas.android.ui.scheduled.ModelsState
|
||||
import eu.llembas.android.ui.scheduled.RunState
|
||||
@@ -276,6 +279,21 @@ object Fakes {
|
||||
),
|
||||
)
|
||||
|
||||
// Memory: one the person wrote, two a model did, in two data groups.
|
||||
val memory = MemoryState(
|
||||
memories = listOf(
|
||||
Memory("m1", "Prefers lembas warm, with a little honey.", author = "user", dataGroup = DataGroup("default", "Default")),
|
||||
Memory(
|
||||
"m2",
|
||||
"Is walking to the mountain with three friends and asks for recipes that keep for weeks without spoiling on the road.",
|
||||
author = "model",
|
||||
dataGroup = DataGroup("default", "Default"),
|
||||
),
|
||||
Memory("m3", "Writes the garden's diary in Slovak.", author = "model", dataGroup = DataGroup("garden", "The garden")),
|
||||
),
|
||||
groups = listOf(DataGroup("default", "Default"), DataGroup("garden", "The garden")),
|
||||
)
|
||||
|
||||
private val home = Instance(id = "i1", base = "https://llm.example.org", name = "Home", email = "frodo@example.org", sealedToken = "")
|
||||
private val work = Instance(id = "i2", base = "https://ai.example.com", name = "Work", email = "f.baggins@example.com", sealedToken = "")
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ import eu.llembas.android.ui.home.ArchivedContent
|
||||
import eu.llembas.android.ui.home.ChatsState
|
||||
import eu.llembas.android.ui.home.DrawerActions
|
||||
import eu.llembas.android.ui.home.DrawerContent
|
||||
import eu.llembas.android.ui.memory.MemoryActions
|
||||
import eu.llembas.android.ui.memory.MemoryContent
|
||||
import eu.llembas.android.ui.memory.MemoryState
|
||||
import eu.llembas.android.ui.scheduled.RunContent
|
||||
import eu.llembas.android.ui.scheduled.ScheduleContent
|
||||
import eu.llembas.android.ui.scheduled.ScheduleEditContent
|
||||
@@ -55,6 +58,8 @@ private object NoDrawerActions : DrawerActions
|
||||
|
||||
private object NoArchivedActions : ArchivedActions
|
||||
|
||||
private object NoMemoryActions : MemoryActions
|
||||
|
||||
private object NoActivityActions : ActivityActions
|
||||
|
||||
private object NoSettingsActions : SettingsActions
|
||||
@@ -244,6 +249,13 @@ class ScreenShots {
|
||||
shoot("27-archived", Phone.Small, fontScale = 1.5f) { ArchivedContent(Fakes.chats, NoArchivedActions) }
|
||||
shoot("27-archived-none") { ArchivedContent(ChatsState(), NoArchivedActions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun memory() {
|
||||
shoot("28-memory") { MemoryContent(Fakes.memory, NoMemoryActions) }
|
||||
shoot("28-memory", Phone.Small, fontScale = 1.5f) { MemoryContent(Fakes.memory, NoMemoryActions) }
|
||||
shoot("28-memory-none") { MemoryContent(MemoryState(), NoMemoryActions) }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,15 @@ STRINGS: dict[str, str] = {
|
||||
"archived": "Archived",
|
||||
"archived_restore": "Restore chat",
|
||||
"archived_none": "No archived chats.",
|
||||
"memory": "Memory",
|
||||
"memory_intro": "What models remember about you",
|
||||
"memory_none": "Nothing yet. A model with the memory tool adds to this when you tell it something worth keeping.",
|
||||
"memory_remember": "Remember",
|
||||
"memory_label": "What this memory says",
|
||||
"memory_hint": "Something worth remembering",
|
||||
"memory_group": "Data group",
|
||||
"memory_forget": "Forget",
|
||||
"memory_by_model": "Model",
|
||||
"chats_pinned": "Pinned chats",
|
||||
"chat_pin": "Pin chat",
|
||||
"chat_unpin": "Unpin chat",
|
||||
|
||||
Reference in new issue
Block a user