1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// @generated DO NOT EDIT.
//
// Generated from the CNB OpenAPI specification by `cnb-codegen`.
// Run `cargo run -p cnb-codegen --manifest-path codegen/Cargo.toml \
// -- --spec codegen/spec/swagger.json --out src` to refresh.
#![allow(clippy::all)]
#![allow(missing_docs)]
#![allow(unused_imports)]
#![allow(unused_mut)]
use reqwest::Method;
use serde::Serialize;
use crate::error::{ApiError, Result};
use crate::http::HttpInner;
use crate::models;
// `AI` resource client (generated, 1 operations).
/// Resource client.
#[derive(Debug, Clone)]
pub struct AiClient {
inner: HttpInner,
}
impl AiClient {
/// Construct a new resource client. Normally obtained
/// via [`crate::ApiClient`] rather than directly.
pub fn new(inner: HttpInner) -> Self {
Self { inner }
}
/// AI 对话。调用者需有代码写权限(CNB_TOKEN 仅需读权限,部署令牌不检查读写权限)。AI chat completions. Requires caller to have repo write permission.
///
/// `POST /{repo}/-/ai/chat/completions`
pub async fn ai_chat_completions(
&self,
repo: String,
body: &crate::models::AiChatCompletionsReq,
) -> Result<crate::models::AiChatCompletionsResult> {
let path = format!("/{}/-/ai/chat/completions", repo);
let mut url = self.inner.url(&path)?;
self.inner
.execute_with_body::<crate::models::AiChatCompletionsResult, _>(Method::POST, url, body)
.await
}
}