Replaces wrong-direction llm_api.py (which served OpenAI endpoints) with llm_client.py -- a client that calls supplier LLM APIs. New module: llm_client.py - llm_chat(messages, model, temperature, ...) -> OpenAI response dict - llm_chat_stream(messages, ...) -> async generator of SSE chunks - llm_simple(prompt, system) -> plain text response - llm_list_models() -> list available models from provider - llm_get_config() -> show current config (key masked) - Supports provider presets: openai, dashscope, deepseek, siliconflow - Retry with exponential backoff (3 attempts) - 429 rate limit handling with Retry-After - Structured logging via appPublic.log Model changes (harnessed_agent_config): - Add llm_provider (preset name: dashscope/openai/deepseek/siliconflow) - Add top_p field - llm_service_url defaults to DashScope compatible endpoint Other: - Remove wrong-direction /v1/ endpoints - Fix pyproject.toml deps: only sqlor + bricks_for_python - Update init/data.json seed data with LLM config fields - Update CRUD view with llm_provider dropdown
49 lines
1.8 KiB
JSON
49 lines
1.8 KiB
JSON
{
|
|
"tblname": "harnessed_agent_config",
|
|
"alias": "harnessed_agent_config_view",
|
|
"title": "Agent Configuration",
|
|
"params": {
|
|
"logined_userid": "user_id",
|
|
"confidential_fields": ["llm_api_key"],
|
|
"browserfields": {
|
|
"exclouded": ["llm_api_key", "available_models"],
|
|
"alters": {
|
|
"auto_cleanup_enabled": {
|
|
"uitype": "code",
|
|
"data": [
|
|
{"value": "1", "text": "Enabled"},
|
|
{"value": "0", "text": "Disabled"}
|
|
]
|
|
},
|
|
"enable_streaming": {
|
|
"uitype": "code",
|
|
"data": [
|
|
{"value": "1", "text": "Enabled"},
|
|
{"value": "0", "text": "Disabled"}
|
|
]
|
|
},
|
|
"llm_provider": {
|
|
"uitype": "code",
|
|
"data": [
|
|
{"value": "dashscope", "text": "阿里云 DashScope"},
|
|
{"value": "openai", "text": "OpenAI"},
|
|
{"value": "deepseek", "text": "DeepSeek"},
|
|
{"value": "siliconflow", "text": "SiliconFlow"},
|
|
{"value": "", "text": "自定义 (Custom URL)"}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"editexclouded": [
|
|
"id",
|
|
"user_id",
|
|
"created_at",
|
|
"updated_at"
|
|
],
|
|
"editable": {
|
|
"new_data_url": "{{entire_url('../api/harnessed_agent_config_view_create.dspy')}}",
|
|
"update_data_url": "{{entire_url('../api/harnessed_agent_config_view_update.dspy')}}",
|
|
"delete_data_url": "{{entire_url('../api/harnessed_agent_config_view_delete.dspy')}}"
|
|
}
|
|
}
|
|
} |