From 636b0323075225c584b62719ed51e75521bb7ffb Mon Sep 17 00:00:00 2001
From: aura <nw@moneybot.cc>
Date: Tue, 17 Feb 2026 22:39:42 +0100
Subject: push source

---
 moneyjsx/src/support-api.tsx | 214 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 214 insertions(+)
 create mode 100644 moneyjsx/src/support-api.tsx

(limited to 'moneyjsx/src/support-api.tsx')

diff --git a/moneyjsx/src/support-api.tsx b/moneyjsx/src/support-api.tsx
new file mode 100644
index 0000000..abb4072
--- /dev/null
+++ b/moneyjsx/src/support-api.tsx
@@ -0,0 +1,214 @@
+import * as JSX from './jsx';
+
+import $ from 'jquery';
+
+import { Page, GroupBox } from './components';
+
+export default function Api() {
+  return <Page>
+    <GroupBox title="API" style="width: 85%">
+      <div id="support-container" style="text-align: left; width: 100%">
+
+        <h2>POST /update-settings</h2>
+        <p>Updates user settings based on the preferences provided.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre><code>{ `{
+  "token": "JWT token",
+  "prefs": {
+    "nickname": "string",
+    "prompt_data": { "system": "string" },
+    "site_prefs": { "model": "string" }
+  }
+}` }</code></pre>
+
+        <h3>Responses</h3>
+<pre>{ $( `<code>{
+  "status": "ok" | "error",
+  "msg": "settings updated" | "error message",
+  "userprefs": {
+    "uuid": "string", <span class="comment">/* the user uuid */</span>
+    "nickname": "string", <span class="comment">/* the user's set nickname */</span>
+    "prompt_data": { "system": "string" }, <span class="comment">/* the custom system prompt */</span>
+    "site_prefs": { "model": "string" },  <span class="comment">/* the user preferred model */</span>
+    "chat_files": { "files": [ { "id": "string", "name": "string" } ] }, <span class="comment">/* list of user's chat files */</span>
+  }
+}</code>` )[0] }</pre>
+        <ul>
+          <li><span class="status">200 OK</span>: Settings updated successfully</li>
+          <li><span class="status">400 Bad Request</span>: Invalid value or nickname out of allowed range</li>
+          <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+          <li><span class="status">500 Internal Server Error</span>: General server error</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /settings</h2>
+        <p>Fetches user settings.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre><code>{ `{
+  "token": "JWT token"
+}` }</code></pre>
+
+            <h3>Responses</h3>
+<pre>{ $( `<code>{
+  "uuid": "string", <span class="comment">/* the user uuid */</span>
+  "nickname": "string", <span class="comment">/* the user's set nickname */</span>
+  "prompt_data": { "system": "string" }, <span class="comment">/* the custom system prompt */</span>
+  "site_prefs": { "model": "string" },  <span class="comment">/* the user preferred model */</span>
+  "chat_files": { "files": [ { "id": "string", "name": "string" } ] }, <span class="comment">/* list of user's chat files */</span>
+}</code>` )[0] }</pre>
+        <ul>
+          <li><span class="status">200 OK</span>: Returns user preferences</li>
+          <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+          <li><span class="status">500 Internal Server Error</span>: No user data found</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /create-chat</h2>
+        <p>Creates a new chat file for the user.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre><code>{ `{
+  "token": "JWT token"
+}` }</code></pre>
+
+          <h3>Responses</h3>
+<pre>{ $( `<code>{
+  "status": "ok" | "nodata" | "error",
+  "msg": "chat created" | "error message",
+  "chatId": "string" <span class="comment">/* the uuid/filename of the newly created chat. */</span>
+}</code>` )[0] }</pre>
+        <ul>
+          <li><span class="status">200 OK</span>: Chat created with ID and topic name</li>
+          <li><span class="status">400 Bad Request</span>: Missing user data</li>
+          <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+          <li><span class="status">500 Internal Server Error</span>: Error creating chat file or updating database</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /get-chat</h2>
+        <p>Fetches the contents of a specified chat file.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre>{ $( `<code>{
+  "token": "JWT token",
+  "chatId": "string" <span class="comment">/* chat file uuid */</span>
+}</code>` )[0] }</pre>
+
+          <h3>Responses</h3>~
+<pre><code>{ `{
+  "status": "ok" | "error",
+  "msg": "chat not found" | "error message",
+  "contents": [ { }, ... ]
+}` }</code></pre>
+        <ul>
+          <li><span class="status">200 OK</span>: Returns chat file contents</li>
+          <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+          <li><span class="status">404 Not Found</span>: Chat does not exist</li>
+          <li><span class="status">500 Internal Server Error</span>: User data not found</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /models</h2>
+        <p>Lists available models for chat.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre><code>{ `{
+  "token": "JWT token"
+}` }</code></pre>
+
+        <h3>Responses</h3>
+        <ul>
+            <li><span class="status">200 OK</span>: Returns list of models with their attributes</li>
+            <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /generate</h2>
+        <p>Generates text based on the input prompt. Can optionally be used for in-the-middle generation.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre>{ $( `<code>{
+  "token": "JWT token",
+  "prompt": "string", <span class="comment">/* the text before the generated text */</span>
+  "suffix": "string", <span class="comment">/* optional - the text after the generated text */</span>
+  "model": "string",
+  "options": { "seed": Number, "temperature": Number } <span class="comment">/* optional */</span>
+}</code>` )[0] }</pre>
+
+        <h3>Response</h3>
+        <p><strong>Body:</strong></p>
+<pre>{ $( `<code>{
+  "status": "ok" | "error",
+  "response": "string",
+  "finalMsg": "string" <span class="comment">/* optional - only at the end of chunked transmission */</span>
+}</code>` )[0] }</pre>
+
+        <ul>
+            <li><span class="status">200 OK</span>: Returns streamed chat response</li>
+            <li><span class="status">400 Bad Request</span>: Missing required parameters</li>
+            <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+            <li><span class="status">429 Too Many Requests</span>: A request from this user is already being processed</li>
+            <li><span class="status">504 Gateway Timeout</span>: No chat instance available</li>
+            <li><span class="status">500 Internal Server Error</span>: Chat server error</li>
+        </ul>
+
+        <hr />
+
+        <h2>POST /chat</h2>
+        <p>Sends a message to the chat server and streams the response back to the user.</p>
+
+        <h3>Request</h3>
+        <p><strong>Body:</strong></p>
+<pre>{ $( `<code>{
+  "token": "JWT token",
+  "model": "string",
+  "messages": [ {
+    "role": "user" | "assistant" | "tool" | "system",
+    "content": "string",
+    timestamp: "string"
+  } ],
+  "system": "string",  <span class="comment">/* optional */</span>
+  "options": { "seed": Number, "temperature": Number }, <span class="comment">/* optional */</span>
+  "chatfile": "string" <span class="comment">/* optional - chat file uuid */</span>
+}</code>` )[0] }</pre>
+
+        <h3>Responses</h3>
+        <p><strong>Message:</strong></p>
+<pre><code>{ `{
+  "status": "ok" | "error",
+  "msg": "string",
+  "done": false,
+  "tool": "string"
+}` }</code></pre>
+            <p><strong>End:</strong></p>
+<pre><code>{ `{
+  "status": "ok" | "error",
+  "msg": "string",
+  "fullMsg": "full message returned by the model",
+  "done": true | false
+}` }</code></pre>
+        <ul>
+          <li><span class="status">200 OK</span>: Returns streamed chat response</li>
+          <li><span class="status">400 Bad Request</span>: Missing required parameters</li>
+          <li><span class="status">401 Unauthorized</span>: Invalid or expired token</li>
+          <li><span class="status">429 Too Many Requests</span>: A request from this user is already being processed</li>
+          <li><span class="status">504 Gateway Timeout</span>: No chat instance available</li>
+          <li><span class="status">500 Internal Server Error</span>: Chat server error</li>
+        </ul>
+      </div>
+    </GroupBox>
+  </Page>
+}
-- 
cgit v1.2.3

