chattermate-cli 0.4.0__tar.gz → 0.6.0__tar.gz
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.
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/PKG-INFO +1 -1
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/__init__.py +1 -1
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/client.py +85 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/agent.py +14 -2
- chattermate_cli-0.6.0/chattermate_cli/commands/customization.py +167 -0
- chattermate_cli-0.6.0/chattermate_cli/commands/help_center.py +507 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/main.py +4 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/mcp_server.py +166 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/PKG-INFO +1 -1
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/SOURCES.txt +4 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/pyproject.toml +1 -1
- chattermate_cli-0.6.0/tests/test_customization.py +55 -0
- chattermate_cli-0.6.0/tests/test_help_center.py +163 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/LICENSE +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/README.md +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/__init__.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/ai.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/auth.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/knowledge.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/lead_capture.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/widget.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/commands/workflow.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/config.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli/context.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/dependency_links.txt +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/entry_points.txt +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/requires.txt +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/chattermate_cli.egg-info/top_level.txt +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/setup.cfg +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_ai.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_client.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_knowledge.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_lead_capture.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_mcp.py +0 -0
- {chattermate_cli-0.4.0 → chattermate_cli-0.6.0}/tests/test_widget.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chattermate-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: ChatterMate CLI and MCP server — sign up, authenticate, and configure agents, workflows and knowledge from the terminal or an AI agent.
|
|
5
5
|
Author: ChatterMate
|
|
6
6
|
License: AGPL-3.0-or-later
|
|
@@ -227,6 +227,12 @@ class Client:
|
|
|
227
227
|
def update_agent(self, agent_id: str, payload: Dict[str, Any]) -> Any:
|
|
228
228
|
return self.request("PUT", f"/agent/{agent_id}", json=payload)
|
|
229
229
|
|
|
230
|
+
# -- chat customization ------------------------------------------------
|
|
231
|
+
|
|
232
|
+
def set_customization(self, agent_id: str, payload: Dict[str, Any]) -> Any:
|
|
233
|
+
"""Create/replace the agent's chat customization (colors, theme, welcome…)."""
|
|
234
|
+
return self.request("POST", f"/agent/{agent_id}/customization", json=payload)
|
|
235
|
+
|
|
230
236
|
# -- lead capture ------------------------------------------------------
|
|
231
237
|
|
|
232
238
|
def get_lead_capture(self, agent_id: str) -> Any:
|
|
@@ -319,3 +325,82 @@ class Client:
|
|
|
319
325
|
|
|
320
326
|
def get_ai_config(self) -> Any:
|
|
321
327
|
return self.request("GET", "/ai/config")
|
|
328
|
+
|
|
329
|
+
# -- help center / FAQ -------------------------------------------------
|
|
330
|
+
# Org is taken from the authenticated user server-side, so no org_id here.
|
|
331
|
+
|
|
332
|
+
def list_faqs(self, params: Optional[Dict[str, Any]] = None) -> Any:
|
|
333
|
+
return self.request("GET", "/help-center/faqs", params=params)
|
|
334
|
+
|
|
335
|
+
def faq_categories(self) -> Any:
|
|
336
|
+
return self.request("GET", "/help-center/faqs/categories")
|
|
337
|
+
|
|
338
|
+
def create_faq(self, payload: Dict[str, Any]) -> Any:
|
|
339
|
+
return self.request("POST", "/help-center/faqs", json=payload)
|
|
340
|
+
|
|
341
|
+
def update_faq(self, faq_id: str, payload: Dict[str, Any]) -> Any:
|
|
342
|
+
return self.request("PUT", f"/help-center/faqs/{faq_id}", json=payload)
|
|
343
|
+
|
|
344
|
+
def delete_faq(self, faq_id: str) -> Any:
|
|
345
|
+
return self.request("DELETE", f"/help-center/faqs/{faq_id}")
|
|
346
|
+
|
|
347
|
+
def bulk_faq_status(self, faq_ids: List[str], status: str) -> Any:
|
|
348
|
+
return self.request(
|
|
349
|
+
"POST", "/help-center/faqs/bulk-status",
|
|
350
|
+
json={"faq_ids": faq_ids, "status": status},
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
def bulk_delete_faqs(self, faq_ids: List[str]) -> Any:
|
|
354
|
+
return self.request("POST", "/help-center/faqs/bulk-delete", json={"faq_ids": faq_ids})
|
|
355
|
+
|
|
356
|
+
def upload_faq_image(self, name: str, content: bytes, content_type: str) -> Any:
|
|
357
|
+
return self.request(
|
|
358
|
+
"POST", "/help-center/faqs/image",
|
|
359
|
+
files={"file": (name, content, content_type)},
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
# settings / branding
|
|
363
|
+
def get_help_center_settings(self) -> Any:
|
|
364
|
+
return self.request("GET", "/help-center/settings")
|
|
365
|
+
|
|
366
|
+
def update_help_center_settings(self, payload: Dict[str, Any]) -> Any:
|
|
367
|
+
return self.request("PUT", "/help-center/settings", json=payload)
|
|
368
|
+
|
|
369
|
+
def upload_help_center_logo(self, name: str, content: bytes, content_type: str) -> Any:
|
|
370
|
+
return self.request(
|
|
371
|
+
"POST", "/help-center/logo",
|
|
372
|
+
files={"file": (name, content, content_type)},
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
def remove_help_center_logo(self) -> Any:
|
|
376
|
+
return self.request("DELETE", "/help-center/logo")
|
|
377
|
+
|
|
378
|
+
# import (URL / PDF) — async, returns a job
|
|
379
|
+
def import_help_center_url(self, url: str, mode: str = "qa") -> Any:
|
|
380
|
+
return self.request("POST", "/help-center/import", json={"url": url, "mode": mode})
|
|
381
|
+
|
|
382
|
+
def import_help_center_pdf(self, name: str, content: bytes) -> Any:
|
|
383
|
+
return self.request(
|
|
384
|
+
"POST", "/help-center/import/pdf",
|
|
385
|
+
files={"file": (name, content, "application/pdf")},
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
# custom domain
|
|
389
|
+
def set_help_center_domain(self, domain: str) -> Any:
|
|
390
|
+
return self.request("POST", "/help-center/domain", json={"domain": domain})
|
|
391
|
+
|
|
392
|
+
def clear_help_center_domain(self) -> Any:
|
|
393
|
+
return self.request("DELETE", "/help-center/domain")
|
|
394
|
+
|
|
395
|
+
def verify_help_center_domain(self) -> Any:
|
|
396
|
+
return self.request("POST", "/help-center/domain/verify")
|
|
397
|
+
|
|
398
|
+
def help_center_domain_status(self) -> Any:
|
|
399
|
+
return self.request("GET", "/help-center/domain/status")
|
|
400
|
+
|
|
401
|
+
# jobs (import/generate status polling)
|
|
402
|
+
def help_center_job(self, active: bool = True) -> Any:
|
|
403
|
+
return self.request("GET", "/help-center/jobs", params={"active": active})
|
|
404
|
+
|
|
405
|
+
def help_center_job_by_id(self, job_id: int) -> Any:
|
|
406
|
+
return self.request("GET", f"/help-center/jobs/{job_id}")
|
|
@@ -102,9 +102,15 @@ def update_agent(
|
|
|
102
102
|
),
|
|
103
103
|
display_name: Optional[str] = typer.Option(None, "--display-name"),
|
|
104
104
|
active: Optional[bool] = typer.Option(None, "--active/--inactive"),
|
|
105
|
+
transfer_to_human: Optional[bool] = typer.Option(
|
|
106
|
+
None, "--transfer-to-human/--no-transfer-to-human",
|
|
107
|
+
help="Allow the agent to hand off to a human agent."),
|
|
108
|
+
ask_for_rating: Optional[bool] = typer.Option(
|
|
109
|
+
None, "--ask-for-rating/--no-ask-for-rating",
|
|
110
|
+
help="Ask the visitor to rate the conversation when it ends."),
|
|
105
111
|
as_json: bool = typer.Option(False, "--json", help="Output raw JSON."),
|
|
106
112
|
):
|
|
107
|
-
"""Update an agent's instructions, display name,
|
|
113
|
+
"""Update an agent's instructions, display name, active state, or behaviour."""
|
|
108
114
|
payload: dict = {}
|
|
109
115
|
if instruction:
|
|
110
116
|
payload["instructions"] = list(instruction)
|
|
@@ -112,8 +118,14 @@ def update_agent(
|
|
|
112
118
|
payload["display_name"] = display_name
|
|
113
119
|
if active is not None:
|
|
114
120
|
payload["is_active"] = active
|
|
121
|
+
if transfer_to_human is not None:
|
|
122
|
+
payload["transfer_to_human"] = transfer_to_human
|
|
123
|
+
if ask_for_rating is not None:
|
|
124
|
+
payload["ask_for_rating"] = ask_for_rating
|
|
115
125
|
if not payload:
|
|
116
|
-
print_error(
|
|
126
|
+
print_error(
|
|
127
|
+
"Nothing to update. Pass --instruction, --display-name, --active/--inactive, "
|
|
128
|
+
"--transfer-to-human/--no-transfer-to-human or --ask-for-rating/--no-ask-for-rating.")
|
|
117
129
|
raise typer.Exit(code=1)
|
|
118
130
|
client = get_client()
|
|
119
131
|
data = run(lambda: client.update_agent(agent_id, payload))
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ChatterMate - CLI Chat Customization Commands
|
|
3
|
+
Copyright (C) 2024 ChatterMate
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as
|
|
7
|
+
published by the Free Software Foundation, either version 3 of the
|
|
8
|
+
License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from typing import List, Optional
|
|
20
|
+
|
|
21
|
+
import typer
|
|
22
|
+
|
|
23
|
+
from ..context import console, get_client, output, print_error, run
|
|
24
|
+
|
|
25
|
+
customization_app = typer.Typer(
|
|
26
|
+
no_args_is_help=True,
|
|
27
|
+
help="Customize an agent's chat widget — colors, theme, welcome message and more.",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Chat design themes and widget positions accepted by the API.
|
|
31
|
+
CHAT_STYLES = [
|
|
32
|
+
"CHATBOT", "ASK_ANYTHING", "GLASS", "TERMINAL",
|
|
33
|
+
"PLAYFUL", "CALM_MINT", "AURORA", "SUNRISE",
|
|
34
|
+
]
|
|
35
|
+
WIDGET_POSITIONS = ["FLOATING", "FIXED"]
|
|
36
|
+
|
|
37
|
+
# Keys the customization endpoint accepts — used to carry over the current
|
|
38
|
+
# settings so a partial `set` never blanks out fields you didn't touch.
|
|
39
|
+
_CUSTOMIZATION_KEYS = [
|
|
40
|
+
"photo_url", "chat_background_color", "chat_bubble_color", "chat_text_color",
|
|
41
|
+
"icon_url", "icon_color", "accent_color", "font_family", "custom_css",
|
|
42
|
+
"customization_metadata", "chat_style", "widget_position",
|
|
43
|
+
"welcome_title", "welcome_subtitle", "welcome_message",
|
|
44
|
+
"chat_initiation_messages", "quick_actions", "show_citations", "collect_email",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@customization_app.command("show")
|
|
49
|
+
def show(
|
|
50
|
+
agent_id: str = typer.Argument(..., help="The agent's ID."),
|
|
51
|
+
as_json: bool = typer.Option(False, "--json", help="Output raw JSON."),
|
|
52
|
+
):
|
|
53
|
+
"""Show an agent's chat customization."""
|
|
54
|
+
client = get_client()
|
|
55
|
+
agent = run(lambda: client.get_agent(agent_id))
|
|
56
|
+
cust = (agent or {}).get("customization") if isinstance(agent, dict) else None
|
|
57
|
+
|
|
58
|
+
def render(_):
|
|
59
|
+
if not isinstance(cust, dict):
|
|
60
|
+
console.print("No customization set (using defaults).")
|
|
61
|
+
return
|
|
62
|
+
console.print(f" chat style: {cust.get('chat_style')}")
|
|
63
|
+
console.print(f" position: {cust.get('widget_position')}")
|
|
64
|
+
console.print(f" accent: {cust.get('accent_color')}")
|
|
65
|
+
console.print(f" background: {cust.get('chat_background_color')}")
|
|
66
|
+
console.print(f" bubble: {cust.get('chat_bubble_color')}")
|
|
67
|
+
console.print(f" text: {cust.get('chat_text_color')}")
|
|
68
|
+
console.print(f" icon color: {cust.get('icon_color')}")
|
|
69
|
+
console.print(f" font: {cust.get('font_family')}")
|
|
70
|
+
console.print(f" welcome: {cust.get('welcome_title') or '-'}")
|
|
71
|
+
console.print(f" citations: {cust.get('show_citations')}")
|
|
72
|
+
console.print(f" collect email:{cust.get('collect_email')}")
|
|
73
|
+
|
|
74
|
+
output(cust, as_json, render)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@customization_app.command("set")
|
|
78
|
+
def set_customization(
|
|
79
|
+
agent_id: str = typer.Argument(..., help="The agent's ID."),
|
|
80
|
+
# Colors (hex, e.g. #f34611)
|
|
81
|
+
accent: Optional[str] = typer.Option(None, "--accent", help="Accent color (hex)."),
|
|
82
|
+
background: Optional[str] = typer.Option(None, "--background", help="Chat background color (hex)."),
|
|
83
|
+
bubble: Optional[str] = typer.Option(None, "--bubble", help="Message bubble color (hex)."),
|
|
84
|
+
text: Optional[str] = typer.Option(None, "--text", help="Chat text color (hex)."),
|
|
85
|
+
icon_color: Optional[str] = typer.Option(None, "--icon-color", help="Launcher icon color (hex)."),
|
|
86
|
+
# Design
|
|
87
|
+
style: Optional[str] = typer.Option(
|
|
88
|
+
None, "--style", help=f"Chat design theme. One of: {', '.join(CHAT_STYLES)}."),
|
|
89
|
+
position: Optional[str] = typer.Option(
|
|
90
|
+
None, "--position", help=f"Widget position. One of: {', '.join(WIDGET_POSITIONS)}."),
|
|
91
|
+
font: Optional[str] = typer.Option(None, "--font", help="Font family."),
|
|
92
|
+
custom_css: Optional[str] = typer.Option(None, "--custom-css", help="Custom CSS."),
|
|
93
|
+
# Welcome / messaging
|
|
94
|
+
welcome_title: Optional[str] = typer.Option(None, "--welcome-title"),
|
|
95
|
+
welcome_subtitle: Optional[str] = typer.Option(None, "--welcome-subtitle"),
|
|
96
|
+
welcome_message: Optional[str] = typer.Option(None, "--welcome-message"),
|
|
97
|
+
quick_action: List[str] = typer.Option(
|
|
98
|
+
[], "--quick-action", help="Quick-action chip (repeatable; replaces the list)."),
|
|
99
|
+
initiation_message: List[str] = typer.Option(
|
|
100
|
+
[], "--initiation-message", help="Proactive initiation message (repeatable; replaces the list)."),
|
|
101
|
+
# Toggles
|
|
102
|
+
show_citations: Optional[bool] = typer.Option(
|
|
103
|
+
None, "--show-citations/--no-show-citations", help="Show knowledge-base citations."),
|
|
104
|
+
collect_email: Optional[bool] = typer.Option(
|
|
105
|
+
None, "--collect-email/--no-collect-email", help="Ask for the visitor's email before chatting."),
|
|
106
|
+
as_json: bool = typer.Option(False, "--json", help="Output raw JSON."),
|
|
107
|
+
):
|
|
108
|
+
"""Update an agent's chat widget appearance and behaviour.
|
|
109
|
+
|
|
110
|
+
Only the options you pass change — everything else keeps its current value.
|
|
111
|
+
Examples:
|
|
112
|
+
|
|
113
|
+
chattermate customization set <agent> --accent "#7c3aed" --style GLASS
|
|
114
|
+
chattermate customization set <agent> --welcome-title "Hi there!" --collect-email
|
|
115
|
+
chattermate customization set <agent> --quick-action "Pricing" --quick-action "Book a demo"
|
|
116
|
+
"""
|
|
117
|
+
# Validate enums up front.
|
|
118
|
+
if style is not None:
|
|
119
|
+
style = style.upper()
|
|
120
|
+
if style not in CHAT_STYLES:
|
|
121
|
+
print_error(f"--style must be one of: {', '.join(CHAT_STYLES)}.")
|
|
122
|
+
raise typer.Exit(code=1)
|
|
123
|
+
if position is not None:
|
|
124
|
+
position = position.upper()
|
|
125
|
+
if position not in WIDGET_POSITIONS:
|
|
126
|
+
print_error(f"--position must be one of: {', '.join(WIDGET_POSITIONS)}.")
|
|
127
|
+
raise typer.Exit(code=1)
|
|
128
|
+
|
|
129
|
+
client = get_client()
|
|
130
|
+
agent = run(lambda: client.get_agent(agent_id))
|
|
131
|
+
current = (agent or {}).get("customization") if isinstance(agent, dict) else None
|
|
132
|
+
# Carry over the current settings (POST is a full replace) so we don't blank fields.
|
|
133
|
+
payload = {k: current[k] for k in _CUSTOMIZATION_KEYS if isinstance(current, dict) and k in current}
|
|
134
|
+
|
|
135
|
+
overrides = {
|
|
136
|
+
"accent_color": accent,
|
|
137
|
+
"chat_background_color": background,
|
|
138
|
+
"chat_bubble_color": bubble,
|
|
139
|
+
"chat_text_color": text,
|
|
140
|
+
"icon_color": icon_color,
|
|
141
|
+
"chat_style": style,
|
|
142
|
+
"widget_position": position,
|
|
143
|
+
"font_family": font,
|
|
144
|
+
"custom_css": custom_css,
|
|
145
|
+
"welcome_title": welcome_title,
|
|
146
|
+
"welcome_subtitle": welcome_subtitle,
|
|
147
|
+
"welcome_message": welcome_message,
|
|
148
|
+
"show_citations": show_citations,
|
|
149
|
+
"collect_email": collect_email,
|
|
150
|
+
}
|
|
151
|
+
for key, value in overrides.items():
|
|
152
|
+
if value is not None:
|
|
153
|
+
payload[key] = value
|
|
154
|
+
if quick_action:
|
|
155
|
+
payload["quick_actions"] = list(quick_action)
|
|
156
|
+
if initiation_message:
|
|
157
|
+
payload["chat_initiation_messages"] = list(initiation_message)
|
|
158
|
+
|
|
159
|
+
if not payload:
|
|
160
|
+
print_error("Nothing to update. Pass at least one option (see --help).")
|
|
161
|
+
raise typer.Exit(code=1)
|
|
162
|
+
|
|
163
|
+
data = run(lambda: client.set_customization(agent_id, payload))
|
|
164
|
+
if as_json:
|
|
165
|
+
output(data, True)
|
|
166
|
+
return
|
|
167
|
+
console.print(f"[green]Chat customization updated[/green] for agent {agent_id}.")
|