refactor: extract events api
parent
98c50f8050
commit
f45c62af36
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
|
||||
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
||||
pub struct LogEventRequest {
|
||||
/// Event type, should be `view` or `select`.
|
||||
#[schema(example = "view")]
|
||||
#[serde(rename = "type")]
|
||||
pub event_type: String,
|
||||
|
||||
pub completion_id: String,
|
||||
|
||||
pub choice_index: u32,
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
mod code;
|
||||
mod event;
|
||||
|
||||
pub use code::*;
|
||||
pub use event::*;
|
||||
|
|
|
|||
|
|
@ -2,21 +2,11 @@ use std::collections::HashMap;
|
|||
|
||||
use axum::{extract::Query, Json};
|
||||
use hyper::StatusCode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use tabby_common::events::{self, SelectKind};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
||||
pub struct LogEventRequest {
|
||||
/// Event type, should be `view` or `select`.
|
||||
#[schema(example = "view")]
|
||||
#[serde(rename = "type")]
|
||||
event_type: String,
|
||||
|
||||
completion_id: String,
|
||||
|
||||
choice_index: u32,
|
||||
}
|
||||
use crate::api::LogEventRequest;
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
use std::{sync::Arc};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::{extract::State, Json};
|
||||
|
||||
|
||||
use sysinfo::{SystemExt};
|
||||
use sysinfo::SystemExt;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::services::health;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ Install following IDE / Editor extensions to get started with [Tabby](https://gi
|
|||
),
|
||||
paths(routes::log_event, routes::completions, routes::completions, routes::health, routes::search),
|
||||
components(schemas(
|
||||
routes::LogEventRequest,
|
||||
api::LogEventRequest,
|
||||
completions::CompletionRequest,
|
||||
completions::CompletionResponse,
|
||||
completions::Segments,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use std::{env::consts::ARCH};
|
||||
use std::env::consts::ARCH;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use nvml_wrapper::Nvml;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sysinfo::{CpuExt, System, SystemExt};
|
||||
|
|
|
|||
Loading…
Reference in New Issue