entari-plugin-hyw 3.5.0rc7__py3-none-any.whl → 4.0.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of entari-plugin-hyw might be problematic. Click here for more details.

@@ -129,6 +129,28 @@ class HywConfig(BasicConfModel):
129
129
  model_provider: Optional[str] = None
130
130
  vision_model_provider: Optional[str] = None
131
131
  instruct_model_provider: Optional[str] = None
132
+
133
+ # Search/Fetch Settings
134
+ search_timeout: float = 10.0
135
+ search_retries: int = 2
136
+ fetch_timeout: float = 15.0
137
+ fetch_max_results: int = 5
138
+ fetch_blocked_domains: List[str] = field(default_factory=lambda: ["wikipedia.org", "csdn.net", "sohu.com", "sogou.com"])
139
+
140
+ # Fetch Model Config
141
+ fetch_model_name: Optional[str] = None
142
+ fetch_api_key: Optional[str] = None
143
+ fetch_base_url: Optional[str] = None
144
+ fetch_extra_body: Optional[Dict[str, Any]] = None
145
+ fetch_input_price: Optional[float] = None
146
+ fetch_output_price: Optional[float] = None
147
+ # Summary Model Config
148
+ summary_model_name: Optional[str] = None
149
+ summary_api_key: Optional[str] = None
150
+ summary_base_url: Optional[str] = None
151
+ summary_extra_body: Optional[Dict[str, Any]] = None
152
+ summary_input_price: Optional[float] = None
153
+ summary_output_price: Optional[float] = None
132
154
  # UI Theme
133
155
  theme_color: str = "#ef4444" # Tailwind red-500, supports hex/RGB/color names
134
156
 
@@ -295,6 +317,7 @@ async def process_request(
295
317
  render_ok = await render_refuse_answer(
296
318
  renderer=renderer,
297
319
  output_path=output_path,
320
+ reason=final_resp.get('refuse_reason', 'Instruct 专家分配此任务流程失败,请尝试提出其他问题~'),
298
321
  theme_color=conf.theme_color,
299
322
  )
300
323
  else:
@@ -352,8 +375,7 @@ async def process_request(
352
375
  code=display_session_id,
353
376
  )
354
377
 
355
- if conf.save_conversation and sent_id:
356
- history_manager.save_to_disk(sent_id)
378
+
357
379
 
358
380
 
359
381
  except Exception as e:
@@ -370,8 +392,8 @@ async def process_request(
370
392
  # Use a temporary ID for error cases
371
393
  error_id = f"error_{int(time.time())}_{secrets.token_hex(4)}"
372
394
  history_manager.remember(error_id, resp.get("conversation_history", []), [], {"model": model_used if 'model_used' in locals() else "unknown", "error": str(e)}, context_id, code=display_session_id if 'display_session_id' in locals() else None)
373
- history_manager.save_to_disk(error_id)
374
- logger.info(f"Saved error conversation to {error_id}")
395
+ # history_manager.save_to_disk(error_id)
396
+ logger.info(f"Saved error conversation memory to {error_id}")
375
397
  except Exception as save_err:
376
398
  logger.error(f"Failed to save error conversation: {save_err}")
377
399
 
entari_plugin_hyw/misc.py CHANGED
@@ -101,28 +101,35 @@ Instruct 专家分配此任务流程失败,请尝试提出其他问题~
101
101
  async def render_refuse_answer(
102
102
  renderer,
103
103
  output_path: str,
104
+ reason: str = "Instruct 专家分配此任务流程失败,请尝试提出其他问题~",
104
105
  theme_color: str = "#ef4444",
105
106
  ) -> bool:
106
107
  """
107
- Render a refuse-to-answer image using hardcoded markdown.
108
+ Render a refuse-to-answer image using the provided reason.
108
109
 
109
110
  Args:
110
111
  renderer: ContentRenderer instance
111
112
  output_path: Path to save the output image
113
+ reason: The refusal reason to display
112
114
  theme_color: Theme color for the card
113
115
 
114
116
  Returns:
115
117
  True if render succeeded, False otherwise
116
118
  """
119
+ markdown = f"""
120
+ # 任务中止
121
+
122
+ > {reason}
123
+ """
117
124
  return await renderer.render(
118
- markdown_content=REFUSE_ANSWER_MARKDOWN,
125
+ markdown_content=markdown,
119
126
  output_path=output_path,
120
127
  stats={},
121
128
  references=[],
122
129
  page_references=[],
123
130
  image_references=[],
124
131
  stages_used=[],
125
- image_timeout=1000, # No images to load
132
+ image_timeout=1000,
126
133
  theme_color=theme_color,
127
134
  )
128
135