Jump to content

TuCloudAPI aichat: Difference between revisions

From Wiki 7Kas
TuCloudAPI reference: pbx param help -> FuturePBX (API surface unchanged)
TuCloudAPI reference (generated from func=help): aichat history bounds
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
''TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: '''SuperRoot, Operator, Client'''.''
''TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: '''SuperRoot, Operator, Client'''.''
{{Note|1=Requires the <code>pbx</code> parameter (the PBX '''name''', e.g. <code>tucall</code>). The server verifies that your <code>ukey</code>'s own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns <code>{"ok":false,"code":"forbidden"}</code>.}}


== Description ==
== Description ==
AI assistant for this PBX (Spanish). Agentic loop over DeepSeek that uses a curated subset of this API's own endpoints as tools (each executed through the (ukey,pbx) tenant binding). READ tools auto-run; create/edit/delete are PROPOSED (needs_confirmation) and executed only on a confirm={tool,args} re-post. v1 non-streaming. POST the message (+ optional history/confirm).
AI assistant for this PBX (Spanish). Agentic loop over DeepSeek whose tools are SKILLS (business-term operations run by a server-side runner), never this API's functions; the runner resolves names to ids, applies the session's PBX pin and section gate, proposes every write (needs_confirmation) and executes it only on a confirm={tool,args} re-post, pre-fills updates from the current record and shapes every result. A portal session is offered only the skills of its sections; the prompt names who is talking. Widgets: simflow, entity, list, chart (bar/line/donut/columns), page, audio_target. v1 non-streaming. POST the message (+ optional history/confirm).


== Call ==
== Call ==
GET https://tucloudapi.7kas.com:9087/tucloud?func=aichat&ukey=YOUR_KEY
  https://tucloudapi.7kas.com:9087/tucloud?func=aichat&ukey=YOUR_KEY&pbx=PBX_NAME
Requires the <code>ukey</code> parameter.
GET, or POST with the parameters form-urlencoded in the body. Requires the <code>ukey</code> parameter. Always HTTP 200; the response is a JSON envelope.


== Parameters ==
== Parameters ==
Line 16: Line 18:
| <code>message</code> || string || Yes || — || The user's message (POST body).
| <code>message</code> || string || Yes || — || The user's message (POST body).
|-
|-
| <code>history</code> || string || No || — || JSON array of prior turns [{role,content}] (the client keeps state).
| <code>history</code> || string || No || — || JSON array of prior turns [{role,content}] (the client keeps state). Only role user|assistant with string content is taken; anything else is skipped. The newest 40 turns, each cut at 8000 characters, 100000 characters in all (oldest dropped first). The turns kept are the ones echoed back in history.
|-
|-
| <code>confirm</code> || string || No || — || JSON {tool,args} of a proposed write the user has confirmed.
| <code>confirm</code> || string || No || — || JSON {tool,args[,summary]} of a proposed write the user has confirmed.
|}
|}
== Example ==
== Example ==
Line 24: Line 26:


== Response ==
== Response ==
{ok, text, tools_used:[{tool,ok,error?}], widgets:[{type:"simflow",data:{...simulatecall...}}], needs_confirmation:{tool,args,summary}|null, history:[...]}.
{ok, text, tools_used:[{tool,ok}], widgets:[{type:"simflow"|"entity"|"list"|"chart"|"page"|"audio_target",...}], needs_confirmation:{tool,args,summary}|null, history:[...]}.
 
== Errors ==
Always HTTP 200. On failure the body is <code>{"ok":false,"code":"...","message":"..."}</code>. Common codes: <code>missing_pbx</code>, <code>forbidden</code>, <code>invalid_param</code>, <code>not_found</code>, <code>conflict</code>, <code>in_use</code>, <code>db_error</code>, <code>server_busy</code>; the Response section above lists any specific to this function.


----
----
Back to [[TuCloudAPI]]
Back to [[TuCloudAPI]]
[[Category:TuCloudAPI SuperRoot]][[Category:TuCloudAPI Operator]][[Category:TuCloudAPI Client]][[Category:TuCloudAPI]]
[[Category:TuCloudAPI SuperRoot]][[Category:TuCloudAPI Operator]][[Category:TuCloudAPI Client]][[Category:TuCloudAPI]]

Latest revision as of 10:55, 2 November 2026

TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: SuperRoot, Operator, Client.

ℹ Requires the pbx parameter (the PBX name, e.g. tucall). The server verifies that your ukey's own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns {"ok":false,"code":"forbidden"}.

Description

AI assistant for this PBX (Spanish). Agentic loop over DeepSeek whose tools are SKILLS (business-term operations run by a server-side runner), never this API's functions; the runner resolves names to ids, applies the session's PBX pin and section gate, proposes every write (needs_confirmation) and executes it only on a confirm={tool,args} re-post, pre-fills updates from the current record and shapes every result. A portal session is offered only the skills of its sections; the prompt names who is talking. Widgets: simflow, entity, list, chart (bar/line/donut/columns), page, audio_target. v1 non-streaming. POST the message (+ optional history/confirm).

Call

https://tucloudapi.7kas.com:9087/tucloud?func=aichat&ukey=YOUR_KEY&pbx=PBX_NAME

GET, or POST with the parameters form-urlencoded in the body. Requires the ukey parameter. Always HTTP 200; the response is a JSON envelope.

Parameters

Parameter Type Required Default Meaning
pbx string Yes — FuturePBX name (tenant boundary; the assistant only touches this PBX).
message string Yes — The user's message (POST body).
history string No — assistant with string content is taken; anything else is skipped. The newest 40 turns, each cut at 8000 characters, 100000 characters in all (oldest dropped first). The turns kept are the ones echoed back in history.
confirm string No — JSON {tool,args[,summary]} of a proposed write the user has confirmed.

Example

https://tucloudapi.7kas.com:9087/tucloud?func=aichat&ukey=KEY&pbx=tucall  (message in POST body)

Response

{ok, text, tools_used:[{tool,ok}], widgets:[{type:"simflow"|"entity"|"list"|"chart"|"page"|"audio_target",...}], needs_confirmation:{tool,args,summary}|null, history:[...]}.

Errors

Always HTTP 200. On failure the body is {"ok":false,"code":"...","message":"..."}. Common codes: missing_pbx, forbidden, invalid_param, not_found, conflict, in_use, db_error, server_busy; the Response section above lists any specific to this function.


Back to TuCloudAPI