Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。
refactor(core): move ToolSchemas into the shared module
booboosuie3d5dba2bfb1
diff --git a/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt b/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.ktindex 5b80b8e..1cb5199 100644--- a/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt+++ b/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt@@ -344,7 +344,7 @@ object ChatHistory {// ---- topics: finished stretches of conversation ----/** How much of a folded conversation `get_topic` hands over in one go. */- const val TOPIC_TEXT_MAX = 40_000+ const val TOPIC_TEXT_MAX = ScrollbackLimits.TOPIC_TEXT_MAX/** How many folded conversations are kept. Oldest files go first. */private const val MAX_TOPICS = 60@@ -564,7 +564,7 @@ object ChatHistory {* KB, which is most of a context window for a picture the brain already* drew and cannot usefully redraw from text.*/- const val ARTIFACT_SOURCE_MAX = 60_000+ const val ARTIFACT_SOURCE_MAX = ScrollbackLimits.ARTIFACT_SOURCE_MAX/*** Delete one artifact — every revision of it — and keep one row behind indiff --git a/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt b/core/src/main/kotlin/net/kuafuai/andee/net/ToolSchemas.ktsimilarity index 99%rename from app/src/main/java/net/kuafuai/andee/net/ToolSchemas.ktrename to core/src/main/kotlin/net/kuafuai/andee/net/ToolSchemas.ktindex 062f772..52ca5b3 100644--- a/app/src/main/java/net/kuafuai/andee/net/ToolSchemas.kt+++ b/core/src/main/kotlin/net/kuafuai/andee/net/ToolSchemas.kt@@ -1043,7 +1043,7 @@ object ToolSchemas {The source comes back raw, the same bytes the tablet renders. It is longby nature (inline CSS and JS, sometimes a base64 image); past- ${net.kuafuai.andee.ui.ChatHistory.ARTIFACT_SOURCE_MAX} characters it is+ ${net.kuafuai.andee.ui.ScrollbackLimits.ARTIFACT_SOURCE_MAX} characters it iscut and `truncated` says so, and the missing tail has to be rebuilt inthe same style rather than dropped.@@ -1684,7 +1684,7 @@ object ToolSchemas {rather than telling them it is no longer available.The whole back-and-forth comes back as plain text, which may be long. Past- ${net.kuafuai.andee.ui.ChatHistory.TOPIC_TEXT_MAX} characters it is cut and `truncated` says so.+ ${net.kuafuai.andee.ui.ScrollbackLimits.TOPIC_TEXT_MAX} characters it is cut and `truncated` says so.Reading is not showing: nothing appears on screen. If the user should see the conversation,write it into a page with `show_html`.@@ -1787,6 +1787,18 @@ object ToolSchemas {fun methodOf(toolName: String): String? =TOOLS.firstOrNull { it.getString("name") == toolName }?.optString("method")?.ifEmpty { null }+ /**+ * The entries whose internal method [keep] accepts, for a body that only+ * has some of these hands — the desktop has no SMS and no step counter, and+ * a tool listed but not implemented is a promise the model will make to+ * the user. The descriptions are the same text, not a copy.+ */+ fun subset(keep: (method: String) -> Boolean): JSONArray {+ val arr = JSONArray()+ for (t in TOOLS) if (keep(t.optString("method"))) arr.put(t)+ return arr+ }+// ---- builders ----/**diff --git a/core/src/main/kotlin/net/kuafuai/andee/ui/ScrollbackLimits.kt b/core/src/main/kotlin/net/kuafuai/andee/ui/ScrollbackLimits.ktnew file mode 100644index 0000000..6e6e268--- /dev/null+++ b/core/src/main/kotlin/net/kuafuai/andee/ui/ScrollbackLimits.kt@@ -0,0 +1,14 @@+package net.kuafuai.andee.ui++/**+ * Two caps that both the scrollback and the tool text quote, so they must be+ * one number. A tool description that promises 60 000 characters while the+ * store cuts at 50 000 would have the model trust a page that was truncated.+ */+object ScrollbackLimits {+ /** Longest folded-topic text `get_topic` returns before cutting. */+ const val TOPIC_TEXT_MAX = 40_000++ /** Longest page source `get_page` returns before cutting. */+ const val ARTIFACT_SOURCE_MAX = 60_000+}