forked from bionic-gpt/bionic-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use embeddings model attached to dataset. (bionic-gpt#378)
- Loading branch information
Showing
20 changed files
with
283 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#![allow(non_snake_case)] | ||
use dioxus::prelude::*; | ||
|
||
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)] | ||
pub enum CheckBoxScheme { | ||
#[default] | ||
Default, | ||
Primary, | ||
Outline, | ||
Danger, | ||
} | ||
|
||
impl CheckBoxScheme { | ||
pub fn to_string(&self) -> &'static str { | ||
match self { | ||
CheckBoxScheme::Default => "checkbox-default", | ||
CheckBoxScheme::Primary => "checkbox-primary", | ||
CheckBoxScheme::Outline => "checkbox-outline", | ||
CheckBoxScheme::Danger => "checkbox-warning", | ||
} | ||
} | ||
} | ||
|
||
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)] | ||
pub enum CheckBoxSize { | ||
#[default] | ||
Default, | ||
Small, | ||
ExtraSmall, | ||
Large, | ||
Medium, | ||
} | ||
|
||
impl CheckBoxSize { | ||
pub fn to_string(&self) -> &'static str { | ||
match self { | ||
CheckBoxSize::Default => "checkbox-sm", | ||
CheckBoxSize::ExtraSmall => "checkbox-xs", | ||
CheckBoxSize::Small => "checkbox-sm", | ||
CheckBoxSize::Medium => "checkbox-md", | ||
CheckBoxSize::Large => "checkbox-lg", | ||
} | ||
} | ||
} | ||
|
||
#[derive(Props)] | ||
pub struct CheckBoxProps<'a> { | ||
children: Element<'a>, | ||
id: Option<&'a str>, | ||
checked: Option<bool>, | ||
class: Option<&'a str>, | ||
name: &'a str, | ||
value: &'a str, | ||
checkbox_size: Option<CheckBoxSize>, | ||
checkbox_scheme: Option<CheckBoxScheme>, | ||
} | ||
|
||
pub fn CheckBox<'a>(cx: Scope<'a, CheckBoxProps<'a>>) -> Element { | ||
let checkbox_scheme = if cx.props.checkbox_scheme.is_some() { | ||
cx.props.checkbox_scheme.unwrap() | ||
} else { | ||
Default::default() | ||
}; | ||
|
||
let checkbox_size = if cx.props.checkbox_size.is_some() { | ||
cx.props.checkbox_size.unwrap() | ||
} else { | ||
Default::default() | ||
}; | ||
|
||
let class = if let Some(class) = cx.props.class { | ||
class | ||
} else { | ||
"" | ||
}; | ||
|
||
let checked = if let Some(checked) = cx.props.checked { | ||
if checked { | ||
Some("checked") | ||
} else { | ||
None | ||
} | ||
} else { | ||
None | ||
}; | ||
|
||
let class = format!( | ||
"checkbox {} {} {}", | ||
class, | ||
checkbox_scheme.to_string(), | ||
checkbox_size.to_string() | ||
); | ||
|
||
cx.render(rsx!( | ||
input { | ||
"type": "checkbox", | ||
class: "{class}", | ||
id: cx.props.id, | ||
name: cx.props.name, | ||
value: cx.props.value, | ||
checked: checked, | ||
&cx.props.children, | ||
} | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- migrate:up | ||
ALTER TABLE prompts DROP COLUMN dataset_connection; | ||
ALTER TABLE prompts DROP COLUMN top_p; | ||
DROP TYPE dataset_connection; | ||
|
||
-- migrate:down | ||
CREATE TYPE dataset_connection AS ENUM ( | ||
'All', | ||
'None', | ||
'Selected' | ||
); | ||
COMMENT ON TYPE dataset_connection IS 'A prompt can use all datasets, no datasets or selected datasets.'; | ||
ALTER TABLE prompts ADD COLUMN dataset_connection dataset_connection NOT NULL DEFAULT 'None'; | ||
ALTER TABLE prompts ADD COLUMN top_p REAL CHECK (top_p >= 0 AND top_p <= 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.