Skip to content

Commit

Permalink
push locally stored change + rm log
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Aug 30, 2024
1 parent 90fc30d commit c59c17e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
12 changes: 8 additions & 4 deletions web/src/app/admin/embeddings/RerankingFormPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,19 @@ const RerankingDetailsForm = forwardRef<
>
<div className="w-full px-4">
<TextFormField
placeholder={values.api_key || undefined}
placeholder={values.rerank_api_key || undefined}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
setRerankingDetails({ ...values, api_key: value });
setFieldValue("api_key", value);
setRerankingDetails({
...values,
rerank_api_key: value,
});
setFieldValue("rerank_api_key", value);
console.log("HIII");
}}
type="password"
label="Cohere API Key"
name="api_key"
name="rerank_api_key"
/>
<div className="mt-4 flex justify-between">
<Button
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/admin/embeddings/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NonNullChain } from "typescript";
export interface RerankingDetails {
rerank_model_name: string | null;
rerank_provider_type: RerankerProvider | null;
api_key: string | null;
rerank_api_key: string | null;
num_rerank: number;
}

Expand Down
8 changes: 4 additions & 4 deletions web/src/app/admin/embeddings/pages/EmbeddingFormPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function EmbeddingForm() {
});

const [rerankingDetails, setRerankingDetails] = useState<RerankingDetails>({
api_key: "",
rerank_api_key: "",
num_rerank: 0,
rerank_provider_type: null,
rerank_model_name: "",
Expand Down Expand Up @@ -118,7 +118,7 @@ export default function EmbeddingForm() {
searchSettings.disable_rerank_for_streaming,
});
setRerankingDetails({
api_key: searchSettings.api_key,
rerank_api_key: searchSettings.rerank_api_key,
num_rerank: searchSettings.num_rerank,
rerank_provider_type: searchSettings.rerank_provider_type,
rerank_model_name: searchSettings.rerank_model_name,
Expand All @@ -128,13 +128,13 @@ export default function EmbeddingForm() {

const originalRerankingDetails: RerankingDetails = searchSettings
? {
api_key: searchSettings.api_key,
rerank_api_key: searchSettings.rerank_api_key,
num_rerank: searchSettings.num_rerank,
rerank_provider_type: searchSettings.rerank_provider_type,
rerank_model_name: searchSettings.rerank_model_name,
}
: {
api_key: "",
rerank_api_key: "",
num_rerank: 0,
rerank_provider_type: null,
rerank_model_name: "",
Expand Down
13 changes: 12 additions & 1 deletion web/src/components/admin/connectors/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ export function TextFormField({
if (isTextArea && !heightString) {
heightString = "h-28";
}
const [field, , helpers] = useField(name);
const { setValue } = helpers;

const handleChange = (
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
setValue(e.target.value);
if (onChange) {
onChange(e as React.ChangeEvent<HTMLInputElement>);
}
};

return (
<div className="w-full">
Expand Down Expand Up @@ -200,7 +211,7 @@ export function TextFormField({
disabled={disabled}
placeholder={placeholder}
autoComplete={autoCompleteDisabled ? "off" : undefined}
// onChange={onChange}
onChange={handleChange}
/>
{includeRevert && (
<div className="flex-none mt-auto">
Expand Down

0 comments on commit c59c17e

Please sign in to comment.