Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add some desc in chatbot settings #501

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def rag_tool(retriever_config: dict, query=None):
retriever_params["query"] = query or state[retriever_config.get(
"query_key", "query")]
output = retrieve_fn(retriever_params)
top_k = retriever_config.get("top_k", Threshold.TOP_K)
top_k = retriever_config.get("top_k", Threshold.TOP_K_RETRIEVALS)
score = retriever_config.get("score", Threshold.ALL_KNOWLEDGE_IN_AGENT_THRESHOLD)
filtered_docs = [item for item in output["result"]["docs"] if item["score"] >= score]
sorted_docs = sorted(filtered_docs, key=lambda x: x["score"], reverse=True)
Expand Down
18 changes: 14 additions & 4 deletions source/portal/src/pages/chatbot/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
{/* <SpaceBetween direction="vertical" size="l"> */}
<div style={{fontSize: 16, fontWeight: 700, marginBottom: 15, marginTop: 15}}>{t('common')}</div>
<SpaceBetween size="xs" direction="vertical">
<Grid gridDefinition={[{colspan: 2},{colspan: 6},{colspan: 2},{colspan: 2}]}>
<Grid gridDefinition={[{colspan: 5},{colspan: 6}]}>
{/* <ColumnLayout columns={3} variant="text-grid"> */}
<FormField label={t('scenario')} stretch={true}>
<FormField label={t('scenario')} stretch={true} description={t('scenarioDesc')}>
<Select
options={SCENARIO_LIST}
selectedOption={scenario}
Expand All @@ -750,6 +750,7 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
label={t('modelName')}
stretch={true}
errorText={t(modelError)}
description={t('modelNameDesc')}
>
<Autosuggest
onChange={({ detail }) => {
Expand All @@ -762,10 +763,13 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
empty={t('noModelFound')}
/>
</FormField>
</Grid>
<Grid gridDefinition={[ {colspan: 5},{colspan: 6}]}>
<FormField
label={t('maxTokens')}
stretch={true}
errorText={t(maxTokenError)}
description={t('maxTokenDesc')}
>
<Input
type="number"
Expand All @@ -780,6 +784,7 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
label={t('maxRounds')}
stretch={true}
errorText={t(maxRoundsError)}
description={t('maxRoundsDesc')}
>
<Input
type="number"
Expand All @@ -793,11 +798,12 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
</Grid>

{showEndpoint && (
<Grid gridDefinition={[{colspan: 8}]}>
<Grid gridDefinition={[{colspan: 11}]}>
<FormField
label={t('endPoint')}
stretch={true}
errorText={t(endPointError)}
description={t('endPointDesc')}
>
<Input
onChange={({ detail }) => {
Expand All @@ -811,14 +817,16 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
</Grid>
)
}

</SpaceBetween>
<div style={{fontSize: 16, fontWeight: 700,marginBottom: 15, marginTop: 35}}>{t('rad')}</div>
<SpaceBetween size="xs" direction="vertical">
<Grid gridDefinition={[{colspan: 3},{colspan: 2},{colspan: 3}]}>
<Grid gridDefinition={[{colspan: 3},{colspan: 3},{colspan: 5}]}>
<FormField
label={t('temperature')}
stretch={true}
errorText={t(temperatureError)}
description={t('temperatureDesc')}
>
<Input
type="number"
Expand All @@ -836,6 +844,7 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
<FormField
label={t('topKRetrievals')}
stretch={true}
description={t('topKRetrievalsDesc')}
errorText={t(topKRetrievalsError)}
>
<Input
Expand All @@ -850,6 +859,7 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
<FormField
label={t('score')}
stretch={true}
description={t('scoreDesc')}
errorText={t(scoreError)}
>
<Input
Expand Down
Loading