Skip to content

Commit

Permalink
fix: pass the selected approach to the chat component and to the api …
Browse files Browse the repository at this point in the history
…call (#188)

* Pass the selected approach to the chat component and to the api call

* Changed default approach to match old rrr

---------

Co-authored-by: JasonHaley <jason.haley@cloudconstruct.com>
  • Loading branch information
JasonHaley and JasonHaley authored Feb 27, 2024
1 parent 0fec15c commit 8971b1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/chat-component/src/components/chat-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export class ChatComponent extends LitElement {
@property({ type: String, attribute: 'data-use-stream', converter: (value) => value?.toLowerCase() === 'true' })
useStream: boolean = chatHttpOptions.stream;

@property({ type: String, attribute: 'data-approach' })
approach = requestOptions.approach;

@property({ type: String, attribute: 'data-overrides', converter: (value) => JSON.parse(value || '{}') })
overrides: RequestOverrides = {};

Expand Down Expand Up @@ -232,6 +235,7 @@ export class ChatComponent extends LitElement {
await this.chatController.generateAnswer(
{
...requestOptions,
approach: this.approach,
overrides: {
...requestOptions.overrides,
...this.overrides,
Expand Down
4 changes: 2 additions & 2 deletions packages/webapp/src/pages/oneshot/OneShot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { toolTipText, toolTipTextCalloutProps } from '../../i18n/tooltips.js';

export function Component(): JSX.Element {
const [isConfigPanelOpen, setIsConfigPanelOpen] = useState(false);
const [approach, setApproach] = useState<Approaches>(Approaches.RetrieveThenRead);
const [approach, setApproach] = useState<Approaches>(Approaches.ReadRetrieveRead);
const [promptTemplate, setPromptTemplate] = useState<string>('');
const [promptTemplatePrefix, setPromptTemplatePrefix] = useState<string>('');
const [promptTemplateSuffix, setPromptTemplateSuffix] = useState<string>('');
Expand Down Expand Up @@ -113,7 +113,7 @@ export function Component(): JSX.Element {
data-interaction-model="ask"
data-api-url={apiBaseUrl}
data-use-stream="false"
data-approach="rrr"
data-approach={approach}
data-overrides={JSON.stringify(overrides)}
></chat-component>
</div>
Expand Down

0 comments on commit 8971b1e

Please sign in to comment.