PostApiV3AgentTracesRequest.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. <?php
  2. /**
  3. * PostApiV3AgentTracesRequest
  4. *
  5. * PHP version 8.1
  6. *
  7. * @category Class
  8. * @package WikipaliApi
  9. * @author OpenAPI Generator team
  10. * @link https://openapi-generator.tech
  11. */
  12. /**
  13. * MINT API
  14. *
  15. * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
  16. *
  17. * The version of the OpenAPI document: 1.0.0
  18. * Generated by: https://openapi-generator.tech
  19. * Generator version: 7.25.0
  20. */
  21. /**
  22. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  23. * https://openapi-generator.tech
  24. * Do not edit the class manually.
  25. */
  26. namespace WikipaliApi\Model;
  27. use \ArrayAccess;
  28. use \WikipaliApi\ObjectSerializer;
  29. /**
  30. * PostApiV3AgentTracesRequest Class Doc Comment
  31. *
  32. * @category Class
  33. * @package WikipaliApi
  34. * @author OpenAPI Generator team
  35. * @link https://openapi-generator.tech
  36. * @implements \ArrayAccess<string, mixed>
  37. */
  38. class PostApiV3AgentTracesRequest implements ModelInterface, ArrayAccess, \JsonSerializable
  39. {
  40. public const DISCRIMINATOR = null;
  41. /**
  42. * The original name of the model.
  43. *
  44. * @var string
  45. */
  46. protected static $openAPIModelName = 'post_api_v3_agent_traces_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'run_id' => 'string',
  54. 'thread_id' => 'string',
  55. 'device_id' => 'string',
  56. 'client_ip' => 'string',
  57. 'client' => 'string',
  58. 'question' => 'string',
  59. 'status' => 'string',
  60. 'improve' => 'bool',
  61. 'steps' => 'string[]'
  62. ];
  63. /**
  64. * Array of property to format mappings. Used for (de)serialization
  65. *
  66. * @var string[]
  67. * @phpstan-var array<string, string|null>
  68. * @psalm-var array<string, string|null>
  69. */
  70. protected static $openAPIFormats = [
  71. 'run_id' => null,
  72. 'thread_id' => null,
  73. 'device_id' => null,
  74. 'client_ip' => null,
  75. 'client' => null,
  76. 'question' => null,
  77. 'status' => null,
  78. 'improve' => null,
  79. 'steps' => null
  80. ];
  81. /**
  82. * Array of nullable properties. Used for (de)serialization
  83. *
  84. * @var boolean[]
  85. */
  86. protected static array $openAPINullables = [
  87. 'run_id' => false,
  88. 'thread_id' => false,
  89. 'device_id' => false,
  90. 'client_ip' => false,
  91. 'client' => false,
  92. 'question' => false,
  93. 'status' => false,
  94. 'improve' => false,
  95. 'steps' => false
  96. ];
  97. /**
  98. * If a nullable field gets set to null, insert it here
  99. *
  100. * @var boolean[]
  101. */
  102. protected array $openAPINullablesSetToNull = [];
  103. /**
  104. * Array of property to type mappings. Used for (de)serialization
  105. *
  106. * @return array
  107. */
  108. public static function openAPITypes()
  109. {
  110. return self::$openAPITypes;
  111. }
  112. /**
  113. * Array of property to format mappings. Used for (de)serialization
  114. *
  115. * @return array
  116. */
  117. public static function openAPIFormats()
  118. {
  119. return self::$openAPIFormats;
  120. }
  121. /**
  122. * Array of nullable properties
  123. *
  124. * @return array
  125. */
  126. protected static function openAPINullables(): array
  127. {
  128. return self::$openAPINullables;
  129. }
  130. /**
  131. * Array of nullable field names deliberately set to null
  132. *
  133. * @return boolean[]
  134. */
  135. private function getOpenAPINullablesSetToNull(): array
  136. {
  137. return $this->openAPINullablesSetToNull;
  138. }
  139. /**
  140. * Setter - Array of nullable field names deliberately set to null
  141. *
  142. * @param boolean[] $openAPINullablesSetToNull
  143. */
  144. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  145. {
  146. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  147. }
  148. /**
  149. * Checks if a property is nullable
  150. *
  151. * @param string $property
  152. * @return bool
  153. */
  154. public static function isNullable(string $property): bool
  155. {
  156. return self::openAPINullables()[$property] ?? false;
  157. }
  158. /**
  159. * Checks if a nullable property is set to null.
  160. *
  161. * @param string $property
  162. * @return bool
  163. */
  164. public function isNullableSetToNull(string $property): bool
  165. {
  166. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  167. }
  168. /**
  169. * Array of attributes where the key is the local name,
  170. * and the value is the original name
  171. *
  172. * @var string[]
  173. */
  174. protected static $attributeMap = [
  175. 'run_id' => 'run_id',
  176. 'thread_id' => 'thread_id',
  177. 'device_id' => 'device_id',
  178. 'client_ip' => 'client_ip',
  179. 'client' => 'client',
  180. 'question' => 'question',
  181. 'status' => 'status',
  182. 'improve' => 'improve',
  183. 'steps' => 'steps'
  184. ];
  185. /**
  186. * Array of attributes to setter functions (for deserialization of responses)
  187. *
  188. * @var string[]
  189. */
  190. protected static $setters = [
  191. 'run_id' => 'setRunId',
  192. 'thread_id' => 'setThreadId',
  193. 'device_id' => 'setDeviceId',
  194. 'client_ip' => 'setClientIp',
  195. 'client' => 'setClient',
  196. 'question' => 'setQuestion',
  197. 'status' => 'setStatus',
  198. 'improve' => 'setImprove',
  199. 'steps' => 'setSteps'
  200. ];
  201. /**
  202. * Array of attributes to getter functions (for serialization of requests)
  203. *
  204. * @var string[]
  205. */
  206. protected static $getters = [
  207. 'run_id' => 'getRunId',
  208. 'thread_id' => 'getThreadId',
  209. 'device_id' => 'getDeviceId',
  210. 'client_ip' => 'getClientIp',
  211. 'client' => 'getClient',
  212. 'question' => 'getQuestion',
  213. 'status' => 'getStatus',
  214. 'improve' => 'getImprove',
  215. 'steps' => 'getSteps'
  216. ];
  217. /**
  218. * Array of attributes where the key is the local name,
  219. * and the value is the original name
  220. *
  221. * @return array
  222. */
  223. public static function attributeMap()
  224. {
  225. return self::$attributeMap;
  226. }
  227. /**
  228. * Array of attributes to setter functions (for deserialization of responses)
  229. *
  230. * @return array
  231. */
  232. public static function setters()
  233. {
  234. return self::$setters;
  235. }
  236. /**
  237. * Array of attributes to getter functions (for serialization of requests)
  238. *
  239. * @return array
  240. */
  241. public static function getters()
  242. {
  243. return self::$getters;
  244. }
  245. /**
  246. * The original name of the model.
  247. *
  248. * @return string
  249. */
  250. public function getModelName()
  251. {
  252. return self::$openAPIModelName;
  253. }
  254. public const CLIENT_MOBILE = 'mobile';
  255. public const CLIENT_WEB = 'web';
  256. public const STATUS_OK = 'ok';
  257. public const STATUS_ERROR = 'error';
  258. public const STATUS_CANCELLED = 'cancelled';
  259. public const STATUS_DENIED = 'denied';
  260. /**
  261. * Gets allowable values of the enum
  262. *
  263. * @return string[]
  264. */
  265. public function getClientAllowableValues()
  266. {
  267. return [
  268. self::CLIENT_MOBILE,
  269. self::CLIENT_WEB,
  270. ];
  271. }
  272. /**
  273. * Gets allowable values of the enum
  274. *
  275. * @return string[]
  276. */
  277. public function getStatusAllowableValues()
  278. {
  279. return [
  280. self::STATUS_OK,
  281. self::STATUS_ERROR,
  282. self::STATUS_CANCELLED,
  283. self::STATUS_DENIED,
  284. ];
  285. }
  286. /**
  287. * Associative array for storing property values
  288. *
  289. * @var mixed[]
  290. */
  291. protected $container = [];
  292. /**
  293. * Constructor
  294. *
  295. * @param mixed[]|null $data Associated array of property values
  296. * initializing the model
  297. */
  298. public function __construct(?array $data = null)
  299. {
  300. $this->setIfExists('run_id', $data ?? [], null);
  301. $this->setIfExists('thread_id', $data ?? [], null);
  302. $this->setIfExists('device_id', $data ?? [], null);
  303. $this->setIfExists('client_ip', $data ?? [], null);
  304. $this->setIfExists('client', $data ?? [], null);
  305. $this->setIfExists('question', $data ?? [], null);
  306. $this->setIfExists('status', $data ?? [], null);
  307. $this->setIfExists('improve', $data ?? [], true);
  308. $this->setIfExists('steps', $data ?? [], null);
  309. }
  310. /**
  311. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  312. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  313. * $this->openAPINullablesSetToNull array
  314. *
  315. * @param string $variableName
  316. * @param array $fields
  317. * @param mixed $defaultValue
  318. */
  319. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  320. {
  321. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  322. $this->openAPINullablesSetToNull[] = $variableName;
  323. }
  324. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  325. }
  326. /**
  327. * Show all the invalid properties with reasons.
  328. *
  329. * @return array invalid properties with reasons
  330. */
  331. public function listInvalidProperties()
  332. {
  333. $invalidProperties = [];
  334. if ($this->container['run_id'] === null) {
  335. $invalidProperties[] = "'run_id' can't be null";
  336. }
  337. if ($this->container['thread_id'] === null) {
  338. $invalidProperties[] = "'thread_id' can't be null";
  339. }
  340. $allowedValues = $this->getClientAllowableValues();
  341. if (!is_null($this->container['client']) && !in_array($this->container['client'], $allowedValues, true)) {
  342. $invalidProperties[] = sprintf(
  343. "invalid value '%s' for 'client', must be one of '%s'",
  344. $this->container['client'],
  345. implode("', '", $allowedValues)
  346. );
  347. }
  348. if ($this->container['question'] === null) {
  349. $invalidProperties[] = "'question' can't be null";
  350. }
  351. if ($this->container['status'] === null) {
  352. $invalidProperties[] = "'status' can't be null";
  353. }
  354. $allowedValues = $this->getStatusAllowableValues();
  355. if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
  356. $invalidProperties[] = sprintf(
  357. "invalid value '%s' for 'status', must be one of '%s'",
  358. $this->container['status'],
  359. implode("', '", $allowedValues)
  360. );
  361. }
  362. return $invalidProperties;
  363. }
  364. /**
  365. * Validate all the properties in the model
  366. * return true if all passed
  367. *
  368. * @return bool True if all properties are valid
  369. */
  370. public function valid()
  371. {
  372. return count($this->listInvalidProperties()) === 0;
  373. }
  374. /**
  375. * Gets run_id
  376. *
  377. * @return string
  378. */
  379. public function getRunId()
  380. {
  381. return $this->container['run_id'];
  382. }
  383. /**
  384. * Sets run_id
  385. *
  386. * @param string $run_id AG-UI runId(uuid)
  387. *
  388. * @return self
  389. */
  390. public function setRunId($run_id)
  391. {
  392. if (is_null($run_id)) {
  393. throw new \InvalidArgumentException('non-nullable run_id cannot be null');
  394. }
  395. $this->container['run_id'] = $run_id;
  396. return $this;
  397. }
  398. /**
  399. * Gets thread_id
  400. *
  401. * @return string
  402. */
  403. public function getThreadId()
  404. {
  405. return $this->container['thread_id'];
  406. }
  407. /**
  408. * Sets thread_id
  409. *
  410. * @param string $thread_id AG-UI threadId(uuid)
  411. *
  412. * @return self
  413. */
  414. public function setThreadId($thread_id)
  415. {
  416. if (is_null($thread_id)) {
  417. throw new \InvalidArgumentException('non-nullable thread_id cannot be null');
  418. }
  419. $this->container['thread_id'] = $thread_id;
  420. return $this;
  421. }
  422. /**
  423. * Gets device_id
  424. *
  425. * @return string|null
  426. */
  427. public function getDeviceId()
  428. {
  429. return $this->container['device_id'];
  430. }
  431. /**
  432. * Sets device_id
  433. *
  434. * @param string|null $device_id 设备匿名 id(uuid)。游客必填,登录用户忽略
  435. *
  436. * @return self
  437. */
  438. public function setDeviceId($device_id)
  439. {
  440. if (is_null($device_id)) {
  441. throw new \InvalidArgumentException('non-nullable device_id cannot be null');
  442. }
  443. $this->container['device_id'] = $device_id;
  444. return $this;
  445. }
  446. /**
  447. * Gets client_ip
  448. *
  449. * @return string|null
  450. */
  451. public function getClientIp()
  452. {
  453. return $this->container['client_ip'];
  454. }
  455. /**
  456. * Sets client_ip
  457. *
  458. * @param string|null $client_ip 客户端 IP。只对游客记录
  459. *
  460. * @return self
  461. */
  462. public function setClientIp($client_ip)
  463. {
  464. if (is_null($client_ip)) {
  465. throw new \InvalidArgumentException('non-nullable client_ip cannot be null');
  466. }
  467. $this->container['client_ip'] = $client_ip;
  468. return $this;
  469. }
  470. /**
  471. * Gets client
  472. *
  473. * @return string|null
  474. */
  475. public function getClient()
  476. {
  477. return $this->container['client'];
  478. }
  479. /**
  480. * Sets client
  481. *
  482. * @param string|null $client 客户端
  483. *
  484. * @return self
  485. */
  486. public function setClient($client)
  487. {
  488. if (is_null($client)) {
  489. throw new \InvalidArgumentException('non-nullable client cannot be null');
  490. }
  491. $allowedValues = $this->getClientAllowableValues();
  492. if (!in_array($client, $allowedValues, true)) {
  493. throw new \InvalidArgumentException(
  494. sprintf(
  495. "Invalid value '%s' for 'client', must be one of '%s'",
  496. $client,
  497. implode("', '", $allowedValues)
  498. )
  499. );
  500. }
  501. $this->container['client'] = $client;
  502. return $this;
  503. }
  504. /**
  505. * Gets question
  506. *
  507. * @return string
  508. */
  509. public function getQuestion()
  510. {
  511. return $this->container['question'];
  512. }
  513. /**
  514. * Sets question
  515. *
  516. * @param string $question 用户的提问
  517. *
  518. * @return self
  519. */
  520. public function setQuestion($question)
  521. {
  522. if (is_null($question)) {
  523. throw new \InvalidArgumentException('non-nullable question cannot be null');
  524. }
  525. $this->container['question'] = $question;
  526. return $this;
  527. }
  528. /**
  529. * Gets status
  530. *
  531. * @return string
  532. */
  533. public function getStatus()
  534. {
  535. return $this->container['status'];
  536. }
  537. /**
  538. * Sets status
  539. *
  540. * @param string $status 运行结果(denied=额度不足被拦下)
  541. *
  542. * @return self
  543. */
  544. public function setStatus($status)
  545. {
  546. if (is_null($status)) {
  547. throw new \InvalidArgumentException('non-nullable status cannot be null');
  548. }
  549. $allowedValues = $this->getStatusAllowableValues();
  550. if (!in_array($status, $allowedValues, true)) {
  551. throw new \InvalidArgumentException(
  552. sprintf(
  553. "Invalid value '%s' for 'status', must be one of '%s'",
  554. $status,
  555. implode("', '", $allowedValues)
  556. )
  557. );
  558. }
  559. $this->container['status'] = $status;
  560. return $this;
  561. }
  562. /**
  563. * Gets improve
  564. *
  565. * @return bool|null
  566. */
  567. public function getImprove()
  568. {
  569. return $this->container['improve'];
  570. }
  571. /**
  572. * Sets improve
  573. *
  574. * @param bool|null $improve 用户是否允许用于改进回答(提问那一刻的开关)
  575. *
  576. * @return self
  577. */
  578. public function setImprove($improve)
  579. {
  580. if (is_null($improve)) {
  581. throw new \InvalidArgumentException('non-nullable improve cannot be null');
  582. }
  583. $this->container['improve'] = $improve;
  584. return $this;
  585. }
  586. /**
  587. * Gets steps
  588. *
  589. * @return string[]|null
  590. */
  591. public function getSteps()
  592. {
  593. return $this->container['steps'];
  594. }
  595. /**
  596. * Sets steps
  597. *
  598. * @param string[]|null $steps 每一步(LLM 调用、工具调用、节点事件),最多 500 条
  599. *
  600. * @return self
  601. */
  602. public function setSteps($steps)
  603. {
  604. if (is_null($steps)) {
  605. throw new \InvalidArgumentException('non-nullable steps cannot be null');
  606. }
  607. $this->container['steps'] = $steps;
  608. return $this;
  609. }
  610. /**
  611. * Returns true if offset exists. False otherwise.
  612. *
  613. * @param integer|string $offset Offset
  614. *
  615. * @return boolean
  616. */
  617. public function offsetExists(mixed $offset): bool
  618. {
  619. return isset($this->container[$offset]);
  620. }
  621. /**
  622. * Gets offset.
  623. *
  624. * @param integer|string $offset Offset
  625. *
  626. * @return mixed|null
  627. */
  628. #[\ReturnTypeWillChange]
  629. public function offsetGet(mixed $offset)
  630. {
  631. return $this->container[$offset] ?? null;
  632. }
  633. /**
  634. * Sets value based on offset.
  635. *
  636. * @param int|null $offset Offset
  637. * @param mixed $value Value to be set
  638. *
  639. * @return void
  640. */
  641. public function offsetSet($offset, $value): void
  642. {
  643. if (is_null($offset)) {
  644. $this->container[] = $value;
  645. } else {
  646. $this->container[$offset] = $value;
  647. }
  648. }
  649. /**
  650. * Unsets offset.
  651. *
  652. * @param integer|string $offset Offset
  653. *
  654. * @return void
  655. */
  656. public function offsetUnset(mixed $offset): void
  657. {
  658. unset($this->container[$offset]);
  659. }
  660. /**
  661. * Serializes the object to a value that can be serialized natively by json_encode().
  662. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  663. *
  664. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  665. * of any type other than a resource.
  666. */
  667. #[\ReturnTypeWillChange]
  668. public function jsonSerialize()
  669. {
  670. return ObjectSerializer::sanitizeForSerialization($this);
  671. }
  672. /**
  673. * Gets the string presentation of the object
  674. *
  675. * @return string
  676. */
  677. public function __toString()
  678. {
  679. return json_encode(
  680. ObjectSerializer::sanitizeForSerialization($this),
  681. JSON_PRETTY_PRINT
  682. );
  683. }
  684. /**
  685. * Gets a header-safe presentation of the object
  686. *
  687. * @return string
  688. */
  689. public function toHeaderValue()
  690. {
  691. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  692. }
  693. }