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

Tooltips in copilot #348

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 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
3 changes: 2 additions & 1 deletion daras_ai_v2/doc_search_settings_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def document_uploader(
key: str = "documents",
accept: typing.Iterable[str] = None,
accept_multiple_files=True,
tooltip: str | None = None,
) -> list[str] | str:
st.write(label, className="gui-input")
st.write(label, tooltip=tooltip, unsafe_allow_html=True)
documents = st.session_state.get(key) or []
if isinstance(documents, str):
documents = [documents]
Expand Down
1 change: 1 addition & 0 deletions daras_ai_v2/text_to_speech_settings_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def elevenlabs_selector(page):
elevenlabs_use_custom_key = st.checkbox(
"Use custom API key + Voice ID",
value=bool(st.session_state.get("elevenlabs_api_key")),
tooltip="[Learn how](https://gooey.ai/docs/guides/lipsync-videos-with-custom-voices) to add custom voices!",
)
if elevenlabs_use_custom_key:
st.session_state["elevenlabs_voice_name"] = None
Expand Down
8 changes: 8 additions & 0 deletions gooey_ui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ def text_area(
placeholder: str = None,
disabled: bool = False,
label_visibility: LabelVisibility = "visible",
tooltip: str | None = None,
reverse_tooltip: bool = False,
**props,
) -> str:
style = props.setdefault("style", {})
Expand Down Expand Up @@ -359,6 +361,8 @@ def text_area(
help=help,
placeholder=placeholder,
disabled=disabled,
tooltip=tooltip,
tooltip_direction="left" if reverse_tooltip else "right",
SanderGi marked this conversation as resolved.
Show resolved Hide resolved
**props,
),
).mount()
Expand Down Expand Up @@ -882,6 +886,7 @@ def checkbox(
key: str = None,
help: str = None,
*,
tooltip: str | None = None,
disabled: bool = False,
label_visibility: LabelVisibility = "visible",
) -> bool:
Expand All @@ -894,6 +899,7 @@ def checkbox(
disabled=disabled,
label_visibility=label_visibility,
default_value_attr="defaultChecked",
tooltip=tooltip,
)
return bool(value)

Expand All @@ -908,6 +914,7 @@ def _input_widget(
disabled: bool = False,
label_visibility: LabelVisibility = "visible",
default_value_attr: str = "defaultValue",
tooltip: str | None = None,
**kwargs,
) -> typing.Any:
# if key:
Expand All @@ -927,6 +934,7 @@ def _input_widget(
default_value_attr: value,
"help": help,
"disabled": disabled,
"tooltip": tooltip,
**kwargs,
},
).mount()
Expand Down
12 changes: 7 additions & 5 deletions recipes/VideoBots.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,12 @@ def render_description(self):

def render_form_v2(self):
st.text_area(
"""
f"""
#### 📝 Instructions
""",
key="bot_script",
height=300,
tooltip="[Learn more](https://gooey.ai/docs/guides/build-your-ai-copilot/craft-your-ai-copilots-personality) about how to prompt your copilot's personality!",
)
prompt_vars_widget(
"bot_script",
Expand All @@ -368,11 +369,9 @@ def render_form_v2(self):
)

document_uploader(
"""
#### 📄 Knowledge
Add documents or links to give your copilot a knowledge base. When asked a question, we'll search them to generate an answer with citations.
""",
"#### 📄 Knowledge",
accept=["audio/*", "application/*", "video/*", "text/*"],
tooltip="Add documents or links to give your copilot a knowledge base. When asked a question, we'll search them to generate an answer with citations. [Learn more](https://gooey.ai/docs/guides/build-your-ai-copilot/curate-your-knowledge-base-documents)",
)

st.markdown("#### Capabilities")
Expand Down Expand Up @@ -507,6 +506,7 @@ def render_settings(self):
st.session_state.get("input_glossary_document")
or st.session_state.get("output_glossary_document")
),
tooltip="[Learn more](https://gooey.ai/docs/guides/build-your-ai-copilot/advanced-settings#fine-tuned-language-understanding-with-custom-glossaries) about how to super-charge your copilots domain specific language understanding!",
)
if enable_glossary:
st.caption(
Expand Down Expand Up @@ -538,6 +538,8 @@ def render_settings(self):
""",
key="task_instructions",
height=300,
tooltip="[Learn how](https://gooey.ai/docs/guides/build-your-ai-copilot/advanced-settings) to get the most out of your copilot with advanced settings.",
reverse_tooltip=True,
)
prompt_vars_widget(
"task_instructions",
Expand Down