entari-plugin-hyw 3.5.0rc7__py3-none-any.whl → 4.0.0rc1__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,20 @@ 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
+ # Fetch Model Config
133
+ fetch_model_name: Optional[str] = None
134
+ fetch_api_key: Optional[str] = None
135
+ fetch_base_url: Optional[str] = None
136
+ fetch_extra_body: Optional[Dict[str, Any]] = None
137
+ fetch_input_price: Optional[float] = None
138
+ fetch_output_price: Optional[float] = None
139
+ # Summary Model Config
140
+ summary_model_name: Optional[str] = None
141
+ summary_api_key: Optional[str] = None
142
+ summary_base_url: Optional[str] = None
143
+ summary_extra_body: Optional[Dict[str, Any]] = None
144
+ summary_input_price: Optional[float] = None
145
+ summary_output_price: Optional[float] = None
132
146
  # UI Theme
133
147
  theme_color: str = "#ef4444" # Tailwind red-500, supports hex/RGB/color names
134
148
 
@@ -295,6 +309,7 @@ async def process_request(
295
309
  render_ok = await render_refuse_answer(
296
310
  renderer=renderer,
297
311
  output_path=output_path,
312
+ reason=final_resp.get('refuse_reason', 'Instruct 专家分配此任务流程失败,请尝试提出其他问题~'),
298
313
  theme_color=conf.theme_color,
299
314
  )
300
315
  else:
@@ -352,8 +367,7 @@ async def process_request(
352
367
  code=display_session_id,
353
368
  )
354
369
 
355
- if conf.save_conversation and sent_id:
356
- history_manager.save_to_disk(sent_id)
370
+
357
371
 
358
372
 
359
373
  except Exception as e:
@@ -370,8 +384,8 @@ async def process_request(
370
384
  # Use a temporary ID for error cases
371
385
  error_id = f"error_{int(time.time())}_{secrets.token_hex(4)}"
372
386
  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}")
387
+ # history_manager.save_to_disk(error_id)
388
+ logger.info(f"Saved error conversation memory to {error_id}")
375
389
  except Exception as save_err:
376
390
  logger.error(f"Failed to save error conversation: {save_err}")
377
391
 
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