per peter's request
Browse files- api_server.py +3 -3
- chat-widget.js +3 -3
api_server.py
CHANGED
@@ -51,7 +51,7 @@ PRICE = {
|
|
51 |
'gemini-2.5-flash': {'input': 0.3, 'output': 2.5, 'thinking': 2.5, 'caching': 0.075},
|
52 |
'gemini-2.5-pro': {'input': 1.25, 'output': 10, 'thinking': 10, 'caching': 0.31},
|
53 |
}
|
54 |
-
|
55 |
|
56 |
# SITE_LANGUAGES = ['繁體中文', '简体中文', 'English']
|
57 |
SUBDOMAINS = ['www', 'sc', 'en']
|
@@ -88,7 +88,7 @@ class ConfigModel(BaseModel):
|
|
88 |
has_hc: bool = True
|
89 |
has_google_search: bool = True
|
90 |
conversation_rounds: int = 1
|
91 |
-
thinking_budget: int =
|
92 |
quality_model: str = 'gemini-2.5-flash'
|
93 |
|
94 |
class SearchRequest(BaseModel):
|
@@ -190,7 +190,7 @@ def get_knowledge():
|
|
190 |
|
191 |
return knowledge
|
192 |
|
193 |
-
def generate_content(user_prompt, system_prompt, response_type, response_schema, tools, token_counter, model=
|
194 |
response = client.models.generate_content(
|
195 |
model=model,
|
196 |
contents=user_prompt,
|
|
|
51 |
'gemini-2.5-flash': {'input': 0.3, 'output': 2.5, 'thinking': 2.5, 'caching': 0.075},
|
52 |
'gemini-2.5-pro': {'input': 1.25, 'output': 10, 'thinking': 10, 'caching': 0.31},
|
53 |
}
|
54 |
+
default_model = 'gemini-2.5-flash'
|
55 |
|
56 |
# SITE_LANGUAGES = ['繁體中文', '简体中文', 'English']
|
57 |
SUBDOMAINS = ['www', 'sc', 'en']
|
|
|
88 |
has_hc: bool = True
|
89 |
has_google_search: bool = True
|
90 |
conversation_rounds: int = 1
|
91 |
+
thinking_budget: int = 500
|
92 |
quality_model: str = 'gemini-2.5-flash'
|
93 |
|
94 |
class SearchRequest(BaseModel):
|
|
|
190 |
|
191 |
return knowledge
|
192 |
|
193 |
+
def generate_content(user_prompt, system_prompt, response_type, response_schema, tools, token_counter, model=default_model, thinking_config=types.ThinkingConfig(thinking_budget=0)):
|
194 |
response = client.models.generate_content(
|
195 |
model=model,
|
196 |
contents=user_prompt,
|
chat-widget.js
CHANGED
@@ -744,7 +744,7 @@ if (window.location.origin === 'https://x1001000-mm-madam-api-widget.hf.space')
|
|
744 |
<div class="mm-config-item">
|
745 |
<label>
|
746 |
🧠 Thinking Budget:
|
747 |
-
<input type="number" id="thinkingBudget" value="
|
748 |
of Quality Model:
|
749 |
<select id="qualityModel" style="width: 120px; margin-left: 10px; padding: 2px 6px; border: 1px solid #ddd; border-radius: 4px;">
|
750 |
<option value="gemini-2.5-flash">gemini-2.5-flash</option>
|
@@ -1105,7 +1105,7 @@ if (window.location.origin === 'https://x1001000-mm-madam-api-widget.hf.space')
|
|
1105 |
getConfig() {
|
1106 |
console.log('thinkingBudget element:', this.configElements.thinkingBudget);
|
1107 |
console.log('thinkingBudget value:', this.configElements.thinkingBudget?.value);
|
1108 |
-
console.log('thinkingBudget parsed:', this.configElements.thinkingBudget?.value !== '' ? parseInt(this.configElements.thinkingBudget?.value) :
|
1109 |
|
1110 |
return {
|
1111 |
is_paid_user: this.configElements.isPaidUser.checked,
|
@@ -1116,7 +1116,7 @@ if (window.location.origin === 'https://x1001000-mm-madam-api-widget.hf.space')
|
|
1116 |
has_hc: this.configElements.hasHc.checked,
|
1117 |
has_google_search: this.configElements.hasGoogleSearch.checked,
|
1118 |
conversation_rounds: parseInt(this.configElements.conversationRounds.value) || 1,
|
1119 |
-
thinking_budget: this.configElements.thinkingBudget.value !== '' ? parseInt(this.configElements.thinkingBudget.value) :
|
1120 |
quality_model: this.configElements.qualityModel.value || 'gemini-2.5-flash'
|
1121 |
};
|
1122 |
}
|
|
|
744 |
<div class="mm-config-item">
|
745 |
<label>
|
746 |
🧠 Thinking Budget:
|
747 |
+
<input type="number" id="thinkingBudget" value="500" min="1000" max="20000" step="1000" style="width: 80px; margin-left: 10px; padding: 2px 6px; border: 1px solid #ddd; border-radius: 4px;">
|
748 |
of Quality Model:
|
749 |
<select id="qualityModel" style="width: 120px; margin-left: 10px; padding: 2px 6px; border: 1px solid #ddd; border-radius: 4px;">
|
750 |
<option value="gemini-2.5-flash">gemini-2.5-flash</option>
|
|
|
1105 |
getConfig() {
|
1106 |
console.log('thinkingBudget element:', this.configElements.thinkingBudget);
|
1107 |
console.log('thinkingBudget value:', this.configElements.thinkingBudget?.value);
|
1108 |
+
console.log('thinkingBudget parsed:', this.configElements.thinkingBudget?.value !== '' ? parseInt(this.configElements.thinkingBudget?.value) : 500);
|
1109 |
|
1110 |
return {
|
1111 |
is_paid_user: this.configElements.isPaidUser.checked,
|
|
|
1116 |
has_hc: this.configElements.hasHc.checked,
|
1117 |
has_google_search: this.configElements.hasGoogleSearch.checked,
|
1118 |
conversation_rounds: parseInt(this.configElements.conversationRounds.value) || 1,
|
1119 |
+
thinking_budget: this.configElements.thinkingBudget.value !== '' ? parseInt(this.configElements.thinkingBudget.value) : 500,
|
1120 |
quality_model: this.configElements.qualityModel.value || 'gemini-2.5-flash'
|
1121 |
};
|
1122 |
}
|