Merge remote-tracking branch 'origin/main' into r0.3

r0.3
Meng Zhang 2023-10-13 11:39:51 -07:00
commit f9b9a1a174
6 changed files with 17 additions and 41 deletions

View File

@ -11,3 +11,8 @@ update-playground:
cd clients/tabby-playground && yarn build cd clients/tabby-playground && yarn build
rm -rf crates/tabby/playground && cp -R clients/tabby-playground/out crates/tabby/playground rm -rf crates/tabby/playground && cp -R clients/tabby-playground/out crates/tabby/playground
bump-version:
cargo ws version --no-individual-tags --no-git-push
bump-release-version:
cargo ws version --allow-branch "r*" --no-individual-tags --no-git-push

View File

@ -15,7 +15,7 @@ Tabby IntelliJ Platform plugin works with all [IntelliJ Platform IDEs](https://p
1. Fill in the server endpoint URL to connect the plugin to your Tabby server. 1. Fill in the server endpoint URL to connect the plugin to your Tabby server.
* If you are using default port `http://localhost:8080`, you can skip this step. * If you are using default port `http://localhost:8080`, you can skip this step.
* If you are using a Tabby Cloud server endpoint, follow the instructions provided in the popup messages to complete the authorization process. * If you are using a Tabby Cloud server endpoint, follow the instructions provided in the popup messages to complete the authorization process.
2. Fill in node binary path if the node binary. 2. Enter the node binary path into the designated field
* If node binary is already accessible via your `PATH` environment variable, you can skip this step. * If node binary is already accessible via your `PATH` environment variable, you can skip this step.
* Remember to save the settings and restart the IDE if you made changes to this option. * Remember to save the settings and restart the IDE if you made changes to this option.
5. Check the Tabby plugin status bar item, it should display a check mark if the plugin is successfully connected to the Tabby server. 5. Check the Tabby plugin status bar item, it should display a check mark if the plugin is successfully connected to the Tabby server.

View File

@ -18,9 +18,7 @@ pub struct Config {
} }
#[derive(Serialize, Deserialize, Default)] #[derive(Serialize, Deserialize, Default)]
pub struct SwaggerConfig { pub struct SwaggerConfig {}
pub server_url: Option<String>,
}
impl Config { impl Config {
pub fn load() -> Result<Self, Error> { pub fn load() -> Result<Self, Error> {

View File

@ -20,7 +20,7 @@ mod tests {
repositories: vec![Repository { repositories: vec![Repository {
git_url: "https://github.com/TabbyML/interview-questions".to_owned(), git_url: "https://github.com/TabbyML/interview-questions".to_owned(),
}], }],
swagger: SwaggerConfig { server_url: None }, swagger: SwaggerConfig {},
}; };
config.save(); config.save();

View File

@ -39,21 +39,13 @@ pub struct CompletionRequest {
/// reports. /// reports.
user: Option<String>, user: Option<String>,
debug: Option<DebugRequest>, debug_options: Option<DebugOptions>,
} }
#[derive(Serialize, ToSchema, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
pub struct DebugRequest { pub struct DebugOptions {
/// When true, returns debug_data in completion response. /// When true, returns debug_data in completion response.
enabled: bool, enabled: bool,
/// When true, turn off prompt rewrite with source code index.
#[serde(default = "default_false")]
disable_prompt_rewrite: bool,
}
fn default_false() -> bool {
false
} }
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)] #[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
@ -136,15 +128,7 @@ pub async fn completions(
}; };
debug!("PREFIX: {}, SUFFIX: {:?}", segments.prefix, segments.suffix); debug!("PREFIX: {}, SUFFIX: {:?}", segments.prefix, segments.suffix);
let snippets = if !request let snippets = state.prompt_builder.collect(&language, &segments);
.debug
.as_ref()
.is_some_and(|x| x.disable_prompt_rewrite)
{
state.prompt_builder.collect(&language, &segments)
} else {
vec![]
};
let prompt = state let prompt = state
.prompt_builder .prompt_builder
.build(&language, segments.clone(), &snippets); .build(&language, segments.clone(), &snippets);
@ -173,7 +157,7 @@ pub async fn completions(
Ok(Json(CompletionResponse { Ok(Json(CompletionResponse {
id: completion_id, id: completion_id,
choices: vec![Choice { index: 0, text }], choices: vec![Choice { index: 0, text }],
debug_data: if request.debug.is_some_and(|x| x.enabled) { debug_data: if request.debug_options.is_some_and(|x| x.enabled) {
Some(debug_data) Some(debug_data)
} else { } else {
None None

View File

@ -23,7 +23,7 @@ use tabby_download::Downloader;
use tokio::time::sleep; use tokio::time::sleep;
use tower_http::{cors::CorsLayer, timeout::TimeoutLayer}; use tower_http::{cors::CorsLayer, timeout::TimeoutLayer};
use tracing::{info, warn}; use tracing::{info, warn};
use utoipa::{openapi::ServerBuilder, OpenApi}; use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi; use utoipa_swagger_ui::SwaggerUi;
use self::{ use self::{
@ -57,9 +57,9 @@ Install following IDE / Editor extensions to get started with [Tabby](https://gi
completions::CompletionResponse, completions::CompletionResponse,
completions::Segments, completions::Segments,
completions::Choice, completions::Choice,
completions::DebugRequest,
completions::DebugData,
completions::Snippet, completions::Snippet,
completions::DebugOptions,
completions::DebugData,
chat::ChatCompletionRequest, chat::ChatCompletionRequest,
chat::Message, chat::Message,
chat::ChatCompletionChunk, chat::ChatCompletionChunk,
@ -292,18 +292,7 @@ trait OpenApiOverride {
} }
impl OpenApiOverride for utoipa::openapi::OpenApi { impl OpenApiOverride for utoipa::openapi::OpenApi {
fn override_doc(&mut self, args: &ServeArgs, config: &SwaggerConfig) { fn override_doc(&mut self, args: &ServeArgs, _config: &SwaggerConfig) {
if let Some(servers) = self.servers.as_mut() {
if let Some(server_url) = &config.server_url {
servers.push(
ServerBuilder::new()
.url(server_url)
.description(Some("Swagger Server"))
.build(),
);
}
}
if args.chat_model.is_none() { if args.chat_model.is_none() {
self.paths.paths.remove("/v1beta/chat/completions"); self.paths.paths.remove("/v1beta/chat/completions");