From 636b0323075225c584b62719ed51e75521bb7ffb Mon Sep 17 00:00:00 2001 From: aura 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 + +
+ +

POST /update-settings

+

Updates user settings based on the preferences provided.

+ +

Request

+

Body:

+
{ `{
+  "token": "JWT token",
+  "prefs": {
+    "nickname": "string",
+    "prompt_data": { "system": "string" },
+    "site_prefs": { "model": "string" }
+  }
+}` }
+ +

Responses

+
{ $( `{
+  "status": "ok" | "error",
+  "msg": "settings updated" | "error message",
+  "userprefs": {
+    "uuid": "string", /* the user uuid */
+    "nickname": "string", /* the user's set nickname */
+    "prompt_data": { "system": "string" }, /* the custom system prompt */
+    "site_prefs": { "model": "string" },  /* the user preferred model */
+    "chat_files": { "files": [ { "id": "string", "name": "string" } ] }, /* list of user's chat files */
+  }
+}` )[0] }
+
    +
  • 200 OK: Settings updated successfully
  • +
  • 400 Bad Request: Invalid value or nickname out of allowed range
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 500 Internal Server Error: General server error
  • +
+ +
+ +

POST /settings

+

Fetches user settings.

+ +

Request

+

Body:

+
{ `{
+  "token": "JWT token"
+}` }
+ +

Responses

+
{ $( `{
+  "uuid": "string", /* the user uuid */
+  "nickname": "string", /* the user's set nickname */
+  "prompt_data": { "system": "string" }, /* the custom system prompt */
+  "site_prefs": { "model": "string" },  /* the user preferred model */
+  "chat_files": { "files": [ { "id": "string", "name": "string" } ] }, /* list of user's chat files */
+}` )[0] }
+
    +
  • 200 OK: Returns user preferences
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 500 Internal Server Error: No user data found
  • +
+ +
+ +

POST /create-chat

+

Creates a new chat file for the user.

+ +

Request

+

Body:

+
{ `{
+  "token": "JWT token"
+}` }
+ +

Responses

+
{ $( `{
+  "status": "ok" | "nodata" | "error",
+  "msg": "chat created" | "error message",
+  "chatId": "string" /* the uuid/filename of the newly created chat. */
+}` )[0] }
+
    +
  • 200 OK: Chat created with ID and topic name
  • +
  • 400 Bad Request: Missing user data
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 500 Internal Server Error: Error creating chat file or updating database
  • +
+ +
+ +

POST /get-chat

+

Fetches the contents of a specified chat file.

+ +

Request

+

Body:

+
{ $( `{
+  "token": "JWT token",
+  "chatId": "string" /* chat file uuid */
+}` )[0] }
+ +

Responses

~ +
{ `{
+  "status": "ok" | "error",
+  "msg": "chat not found" | "error message",
+  "contents": [ { }, ... ]
+}` }
+
    +
  • 200 OK: Returns chat file contents
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 404 Not Found: Chat does not exist
  • +
  • 500 Internal Server Error: User data not found
  • +
+ +
+ +

POST /models

+

Lists available models for chat.

+ +

Request

+

Body:

+
{ `{
+  "token": "JWT token"
+}` }
+ +

Responses

+
    +
  • 200 OK: Returns list of models with their attributes
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
+ +
+ +

POST /generate

+

Generates text based on the input prompt. Can optionally be used for in-the-middle generation.

+ +

Request

+

Body:

+
{ $( `{
+  "token": "JWT token",
+  "prompt": "string", /* the text before the generated text */
+  "suffix": "string", /* optional - the text after the generated text */
+  "model": "string",
+  "options": { "seed": Number, "temperature": Number } /* optional */
+}` )[0] }
+ +

Response

+

Body:

+
{ $( `{
+  "status": "ok" | "error",
+  "response": "string",
+  "finalMsg": "string" /* optional - only at the end of chunked transmission */
+}` )[0] }
+ +
    +
  • 200 OK: Returns streamed chat response
  • +
  • 400 Bad Request: Missing required parameters
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 429 Too Many Requests: A request from this user is already being processed
  • +
  • 504 Gateway Timeout: No chat instance available
  • +
  • 500 Internal Server Error: Chat server error
  • +
+ +
+ +

POST /chat

+

Sends a message to the chat server and streams the response back to the user.

+ +

Request

+

Body:

+
{ $( `{
+  "token": "JWT token",
+  "model": "string",
+  "messages": [ {
+    "role": "user" | "assistant" | "tool" | "system",
+    "content": "string",
+    timestamp: "string"
+  } ],
+  "system": "string",  /* optional */
+  "options": { "seed": Number, "temperature": Number }, /* optional */
+  "chatfile": "string" /* optional - chat file uuid */
+}` )[0] }
+ +

Responses

+

Message:

+
{ `{
+  "status": "ok" | "error",
+  "msg": "string",
+  "done": false,
+  "tool": "string"
+}` }
+

End:

+
{ `{
+  "status": "ok" | "error",
+  "msg": "string",
+  "fullMsg": "full message returned by the model",
+  "done": true | false
+}` }
+
    +
  • 200 OK: Returns streamed chat response
  • +
  • 400 Bad Request: Missing required parameters
  • +
  • 401 Unauthorized: Invalid or expired token
  • +
  • 429 Too Many Requests: A request from this user is already being processed
  • +
  • 504 Gateway Timeout: No chat instance available
  • +
  • 500 Internal Server Error: Chat server error
  • +
+
+
+
+} -- cgit v1.2.3