|
SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (MTB & µPython)
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Macros | |
| #define | CLAW_SESSION_MAX_MSGS (10) |
| #define | CLAW_MSG_MAX_LEN (256) |
| #define | CLAW_MEM_KEY_MAX (32) |
| #define | CLAW_MEM_VAL_MAX (128) |
Enumerations | |
| enum | claw_role_t { CLAW_ROLE_USER = 0 , CLAW_ROLE_ASSISTANT = 1 , CLAW_ROLE_SYSTEM = 2 , CLAW_ROLE_TOOL = 3 } |
Functions | |
| void | claw_session_init (void) |
| เริ่มต้นระบบย่อยเซสชัน; ถูกเรียกเพียงครั้งเดียวผ่าน bentoclaw_ensure_init() | |
| bool | claw_session_add (claw_role_t role, const char *content) |
| ผนวกข้อความหนึ่งรายการและตัด ring ให้เหลือเท่ากับ CLAW_SESSION_MAX_MSGS | |
| uint16_t | claw_session_count (void) |
| จำนวนข้อความที่อยู่ใน ring ขณะนั้น | |
| void | claw_session_clear (void) |
| ลบ /.bentoclaw_session และล้าง ring ให้ว่าง; ที่เก็บ memory ไม่ถูกแตะ | |
| bool | claw_session_flush (void) |
| เขียน ring ที่ยังค้างอยู่ลงหน่วยความจำแฟลช จาก MicroPython task context เท่านั้น ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอบ | |
| bool | claw_session_dirty (void) |
| predicate ที่ต้นทุนต่ำ: ring ใน RAM มีการเปลี่ยนแปลงที่ยังไม่ได้เขียนลงจริงหรือไม่ ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอบ | |
| bool | claw_memory_set (const char *key, const char *value) |
| เก็บคู่คีย์/ค่าแบบถาวรที่อยู่รอดทั้งการล้างเซสชันและ soft reset | |
| bool | claw_memory_get (const char *key, char *out_value, size_t out_max) |
| ค้นหาคีย์ใน /.bentoclaw_memory; คืน false เมื่อไม่พบ ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอบ | |
| size_t | claw_session_build_context (char *out_buf, size_t out_max) |
| เรนเดอร์รอบสนทนาล่าสุดพร้อม memory ลงในบัฟเฟอร์ที่ผู้เรียกจัดหามาให้; ยังไม่ผ่านการ escape แบบ JSON | |
| #define CLAW_SESSION_MAX_MSGS (10) |
| #define CLAW_MSG_MAX_LEN (256) |
| #define CLAW_MEM_KEY_MAX (32) |
| #define CLAW_MEM_VAL_MAX (128) |
| enum claw_role_t |