Skip to content

Commit

Permalink
fix: use correct fields for developer settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Shibani Basava authored and Shibani Basava committed Nov 30, 2023
1 parent 939c8da commit d407b2c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
6 changes: 3 additions & 3 deletions packages/chat-component/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ declare interface ChatRequestOptions {
}

declare interface RequestOverrides {
retrieval_mode?: string;
retrieval_mode?: 'hybrid' | 'text' | 'vectors';
semantic_ranker?: boolean;
semantic_captions?: boolean;
exclude_category?: string;
top?: number;
suggest_followup_questions?: boolean;
temperature?: number;
prompt_template?: string;
prompt_template_prefix?: string;
prompt_template_suffix?: string;
exclude_category?: string[];
suggest_followup_questions?: boolean;
}

declare interface BotResponse {
Expand Down
13 changes: 13 additions & 0 deletions packages/webapp/src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ export const enum RetrievalMode {
Vectors = 'vectors',
Text = 'text',
}

export type RequestOverrides = {
retrieval_mode?: RetrievalMode;
semantic_ranker?: boolean;
semantic_captions?: boolean;
exclude_category?: string;
top?: number;
temperature?: number;
prompt_template?: string;
prompt_template_prefix?: string;
prompt_template_suffix?: string;
suggest_followup_questions?: boolean;
};
20 changes: 10 additions & 10 deletions packages/webapp/src/pages/chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import styles from './Chat.module.css';
import { RetrievalMode, apiBaseUrl } from '../../api/index.js';
import { RetrievalMode, apiBaseUrl, type RequestOverrides } from '../../api/index.js';
import { SettingsButton } from '../../components/SettingsButton/index.js';
import { Checkbox, DefaultButton, Dropdown, Panel, SpinButton, TextField, TooltipHost } from '@fluentui/react';
import type { IDropdownOption } from '@fluentui/react/lib-commonjs/Dropdown';
Expand Down Expand Up @@ -66,16 +66,16 @@ const Chat = () => {
setUseSuggestFollowupQuestions(!!checked);
};

const overrides = {
retrievalMode,
const overrides: RequestOverrides = {
retrieval_mode: retrievalMode,
top: retrieveCount,
useSemanticRanker,
useSemanticCaptions,
excludeCategory,
promptTemplate,
promptTemplatePrefix: '',
promptTemplateSuffix: '',
suggestFollowupQuestions: useSuggestFollowupQuestions,
semantic_ranker: useSemanticRanker,
semantic_captions: useSemanticCaptions,
exclude_category: excludeCategory,
prompt_template: promptTemplate,
prompt_template_prefix: '',
prompt_template_suffix: '',
suggest_followup_questions: useSuggestFollowupQuestions,
};

return (
Expand Down
20 changes: 10 additions & 10 deletions packages/webapp/src/pages/oneshot/OneShot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useState } from 'react';

import styles from './OneShot.module.css';

import { Approaches, RetrievalMode, apiBaseUrl } from '../../api/index.js';
import { Approaches, RetrievalMode, apiBaseUrl, type RequestOverrides } from '../../api/index.js';
import { SettingsButton } from '../../components/SettingsButton/SettingsButton.jsx';

import 'chat-component';
Expand Down Expand Up @@ -92,15 +92,15 @@ export function Component(): JSX.Element {
},
];

const overrides = {
retrievalMode,
retrieveCount,
useSemanticRanker,
useSemanticCaptions,
excludeCategory,
promptTemplate,
promptTemplatePrefix,
promptTemplateSuffix,
const overrides: RequestOverrides = {
retrieval_mode: retrievalMode,
top: retrieveCount,
semantic_ranker: useSemanticRanker,
semantic_captions: useSemanticCaptions,
exclude_category: excludeCategory,
prompt_template: promptTemplate,
prompt_template_prefix: promptTemplatePrefix,
prompt_template_suffix: promptTemplateSuffix,
};

return (
Expand Down

0 comments on commit d407b2c

Please sign in to comment.