palbaseDocs

Palbase ai · API

POST/ai/chats/{chat_id}/fork

Fork a chat before a message

Forks the chat before one of its messages — what a person's "edit this message" makes: a new chat that begins where this one was, without that message and what came after it, for the edited message to be sent into. The project's server's alone, as starting a chat is. The fork talks to the same agent, carries the chat's labels and — unless members says otherwise — its members. What it begins with is the chat's messages and its agent's answers before that message, in the journal's order — its subagents' work left out, a member's message with the context the model read with it: the engine is given them with the fork's first turn, and its pipe writes them first (history parts). A fork of a chat that works in a workspace works in the same one, the files as they are now, on a session of its own; the workspace goes once no chat that works in it is left. A chat whose agent is at work is not forked (409 turn_running); a message that is not one of the chat's, or that its agent was not given, is 400; what came before past 512 KiB is 409 fork_too_large; past the history the project keeps, 409 history_full.

Called by a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.

Path

chat_idstring · requiredThe chat's id.

Request body

before_messagestring · requiredThe message the fork is cut before (a message's id): it, and all that came after it, are not the fork's.
membersobject[] · optionalWho is in the fork (64 at most; left out or null: the chat's members, as they are).
titlestring · optionalThe fork's title (256 bytes at most; left out: the chat's).
curl
curl -X POST "https://<your-ref>.palbase.studio/ai/chats/<chat_id>/fork" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"before_message":"string"}'

Responses

201The fork

400The request is malformed, or names what this module does not offer (the error names which)

401No valid credential

403A publishable key or a user's session: everything here is the project's server's, called with the secret key

404No such response, job or provider in this project

409The response's state refuses it

413The body is larger than the route takes

503The model service or the database did not answer; retry shortly

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation ForkChat of ai's contract.