mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 05:40:17 +00:00
Rename selected voice model in get config API response for consistency
- Update references in new and old web client settings - Arrange new client settings props and add header comments similar to - config response for code readability
This commit is contained in:
@@ -34,30 +34,34 @@ export interface SyncedContent {
|
|||||||
notion: boolean;
|
notion: boolean;
|
||||||
}
|
}
|
||||||
export interface UserConfig {
|
export interface UserConfig {
|
||||||
|
// user info
|
||||||
username: string | null;
|
username: string | null;
|
||||||
user_photo: string | null;
|
user_photo: string | null;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
has_documents: boolean;
|
|
||||||
khoj_version: string;
|
|
||||||
enabled_content_source: SyncedContent;
|
|
||||||
anonymous_mode: boolean;
|
|
||||||
given_name: string;
|
given_name: string;
|
||||||
|
phone_number: string;
|
||||||
|
is_phone_number_verified: boolean;
|
||||||
|
// user content, model settings
|
||||||
|
enabled_content_source: SyncedContent;
|
||||||
|
has_documents: boolean;
|
||||||
search_model_options: ModelOptions[];
|
search_model_options: ModelOptions[];
|
||||||
selected_search_model_config: number;
|
selected_search_model_config: number;
|
||||||
chat_model_options: ModelOptions[];
|
chat_model_options: ModelOptions[];
|
||||||
selected_chat_model_config: number;
|
selected_chat_model_config: number;
|
||||||
paint_model_options: ModelOptions[];
|
paint_model_options: ModelOptions[];
|
||||||
selected_paint_model_config: number;
|
selected_paint_model_config: number;
|
||||||
billing_enabled: boolean;
|
voice_model_options: ModelOptions[];
|
||||||
|
selected_voice_model_config: number;
|
||||||
|
// user billing info
|
||||||
subscription_state: string;
|
subscription_state: string;
|
||||||
subscription_renewal_date: string;
|
subscription_renewal_date: string;
|
||||||
|
// server settings
|
||||||
khoj_cloud_subscription_url: string | undefined;
|
khoj_cloud_subscription_url: string | undefined;
|
||||||
is_twilio_enabled: boolean;
|
billing_enabled: boolean;
|
||||||
is_eleven_labs_enabled: boolean;
|
is_eleven_labs_enabled: boolean;
|
||||||
voice_model_options: ModelOptions[];
|
is_twilio_enabled: boolean;
|
||||||
selected_voice_config: number;
|
khoj_version: string;
|
||||||
phone_number: string;
|
anonymous_mode: boolean;
|
||||||
is_phone_number_verified: boolean;
|
|
||||||
notion_oauth_url: string;
|
notion_oauth_url: string;
|
||||||
detail: string;
|
detail: string;
|
||||||
}
|
}
|
||||||
@@ -68,6 +72,7 @@ export function useUserConfig(detailed: boolean = false) {
|
|||||||
const { data, error } = useSWR<UserConfig>(url, fetcher, { revalidateOnFocus: false });
|
const { data, error } = useSWR<UserConfig>(url, fetcher, { revalidateOnFocus: false });
|
||||||
|
|
||||||
if (error || !data || data.detail === 'Forbidden') return null;
|
if (error || !data || data.detail === 'Forbidden') return null;
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
<div class="card-description-row">
|
<div class="card-description-row">
|
||||||
<select id="voice-models">
|
<select id="voice-models">
|
||||||
{% for option in voice_model_options %}
|
{% for option in voice_model_options %}
|
||||||
<option value="{{ option.id }}" {% if option.id == selected_voice_config %}selected{% endif %}>{{ option.name }}</option>
|
<option value="{{ option.id }}" {% if option.id == selected_voice_model_config %}selected{% endif %}>{{ option.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1285,7 +1285,7 @@ def get_user_config(user: KhojUser, request: Request, is_detailed: bool = False)
|
|||||||
if len(voice_model_options) == 0:
|
if len(voice_model_options) == 0:
|
||||||
eleven_labs_enabled = False
|
eleven_labs_enabled = False
|
||||||
|
|
||||||
selected_voice_config = ConversationAdapters.get_voice_model_config(user)
|
selected_voice_model_config = ConversationAdapters.get_voice_model_config(user)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"request": request,
|
"request": request,
|
||||||
@@ -1306,7 +1306,7 @@ def get_user_config(user: KhojUser, request: Request, is_detailed: bool = False)
|
|||||||
"paint_model_options": all_paint_model_options,
|
"paint_model_options": all_paint_model_options,
|
||||||
"selected_paint_model_config": selected_paint_model_config.id if selected_paint_model_config else None,
|
"selected_paint_model_config": selected_paint_model_config.id if selected_paint_model_config else None,
|
||||||
"voice_model_options": voice_model_options,
|
"voice_model_options": voice_model_options,
|
||||||
"selected_voice_config": selected_voice_config.model_id if selected_voice_config else None,
|
"selected_voice_model_config": selected_voice_model_config.model_id if selected_voice_model_config else None,
|
||||||
# user billing info
|
# user billing info
|
||||||
"subscription_state": user_subscription_state,
|
"subscription_state": user_subscription_state,
|
||||||
"subscription_renewal_date": subscription_renewal_date,
|
"subscription_renewal_date": subscription_renewal_date,
|
||||||
|
|||||||
Reference in New Issue
Block a user