jvcli 2.0.28__py3-none-any.whl → 2.0.30__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.
jvcli/__init__.py CHANGED
@@ -4,5 +4,5 @@ jvcli package initialization.
4
4
  This package provides the CLI tool for Jivas Package Repository.
5
5
  """
6
6
 
7
- __version__ = "2.0.28"
7
+ __version__ = "2.0.30"
8
8
  __supported__jivas__versions__ = ["2.0.0"]
jvcli/client/lib/utils.py CHANGED
@@ -57,6 +57,7 @@ def call_api(
57
57
  json_data: Optional[Dict] = None,
58
58
  files: Optional[List] = None,
59
59
  data: Optional[Dict] = None,
60
+ timeout: int = 10,
60
61
  ) -> Optional[requests.Response]:
61
62
  """Generic function to call an API endpoint."""
62
63
 
@@ -77,6 +78,7 @@ def call_api(
77
78
  json=json_data,
78
79
  files=files,
79
80
  data=data,
81
+ timeout=timeout,
80
82
  )
81
83
 
82
84
  if response.status_code == 401:
@@ -21,9 +21,9 @@ def transcribe_audio(token: str, agent_id: str, file: bytes) -> dict:
21
21
 
22
22
  data = {
23
23
  "args": "{}",
24
- "module_root": "actions.jivas.deepgram_stt_action",
24
+ "module_root": "jivas.agent.action",
25
25
  "agent_id": agent_id,
26
- "walker": "transcribe_audio",
26
+ "walker": "invoke_stt_action",
27
27
  }
28
28
 
29
29
  headers = {"Authorization": f"Bearer {token}"}
@@ -35,7 +35,6 @@ def transcribe_audio(token: str, agent_id: str, file: bytes) -> dict:
35
35
 
36
36
  # Parse JSON response
37
37
  result = response.json()
38
-
39
38
  return result
40
39
 
41
40
 
@@ -47,29 +46,37 @@ def render(router: StreamlitRouter) -> None:
47
46
  st.header("Chat", divider=True)
48
47
  tts_on = st.toggle("TTS")
49
48
 
49
+ message = ""
50
+ # Handle audio input first
50
51
  audio_value = st.audio_input("Record a voice message")
51
- if audio_value:
52
- selected_agent = st.session_state.get("selected_agent")
53
- result = transcribe_audio(ctx["token"], selected_agent, audio_value)
54
- if result.get("success", False):
55
- send_message(
56
- result["transcript"], url, ctx["token"], selected_agent, tts_on
57
- )
52
+ # Get selected agent from query params
53
+ selected_agent = st.query_params.get("agent")
58
54
 
59
- if selected_agent := st.query_params.get("agent"):
55
+ if selected_agent:
60
56
  chat_messages = st.session_state.messages.get(selected_agent, [])
61
57
 
62
58
  # Display chat messages from history on app rerun
63
- for message in chat_messages:
64
- with st.chat_message(message["role"]):
65
- st.markdown(message["content"])
66
- if payload := message.get("payload"):
59
+ for item in chat_messages:
60
+ role = item.get("role", "user")
61
+ content = item.get("content", "")
62
+ with st.chat_message(role):
63
+ st.markdown(content)
64
+ if payload := item.get("payload"):
67
65
  with st.expander("...", False):
68
66
  st.json(payload)
69
67
 
70
- # Accept user input
71
- if prompt := st.chat_input("Type your message here"):
72
- send_message(prompt, url, ctx["token"], selected_agent, tts_on)
68
+ # Process audio input if available
69
+ if audio_value and selected_agent:
70
+ result = transcribe_audio(ctx["token"], selected_agent, audio_value)
71
+ if result and result.get("success", False):
72
+ message = result["transcript"]
73
+
74
+ # Otherwise handle text input
75
+ if input := st.chat_input("Type your message here"):
76
+ message = input
77
+
78
+ if message:
79
+ send_message(message, url, ctx["token"], selected_agent, tts_on)
73
80
 
74
81
 
75
82
  def send_message(
jvcli/commands/create.py CHANGED
@@ -43,14 +43,6 @@ def create() -> None:
43
43
  default="No description provided.",
44
44
  help="Description of the action.",
45
45
  )
46
- @click.option(
47
- "--type",
48
- "--type",
49
- default="action",
50
- type=click.Choice(TYPE_SUFFIX_MAP.keys(), case_sensitive=False),
51
- show_default=True,
52
- help="Type of the action.",
53
- )
54
46
  @click.option(
55
47
  "--singleton",
56
48
  default=True,
@@ -58,6 +50,13 @@ def create() -> None:
58
50
  show_default=True,
59
51
  help="Indicate if the action is singleton.",
60
52
  )
53
+ @click.option(
54
+ "--type",
55
+ default="action",
56
+ type=click.Choice(TYPE_SUFFIX_MAP.keys(), case_sensitive=False),
57
+ show_default=True,
58
+ help="Type of the action.",
59
+ )
61
60
  @click.option(
62
61
  "--path",
63
62
  default="./actions",
@@ -69,19 +68,6 @@ def create() -> None:
69
68
  default=None,
70
69
  help="Namespace for the action. Defaults to the username in the token.",
71
70
  )
72
- @click.option(
73
- "--singleton",
74
- default=True,
75
- type=bool,
76
- show_default=True,
77
- help="Indicate if the action is singleton.",
78
- )
79
- @click.option(
80
- "--path",
81
- default="./actions",
82
- show_default=True,
83
- help="Directory to create the action folder in.",
84
- )
85
71
  def create_action(
86
72
  name: str,
87
73
  version: str,
@@ -244,7 +230,7 @@ def render(router: StreamlitRouter, agent_id: str, action_id: str, info: dict) -
244
230
  \"\"\"
245
231
 
246
232
  # Add app header controls
247
- (model_key, module_root) = app_header(agent_id, action_id, info)
233
+ (model_key, action) = app_header(agent_id, action_id, info)
248
234
 
249
235
  # Add app main controls
250
236
  app_controls(agent_id, action_id)
jvcli/commands/server.py CHANGED
@@ -101,23 +101,49 @@ def createadmin(email: Optional[str] = None, password: Optional[str] = None) ->
101
101
  if password is None:
102
102
  password = click.prompt("Password", hide_input=True)
103
103
 
104
- signup_url = (
105
- f"{os.environ.get('JIVAS_BASE_URL', 'http://localhost:8000')}/user/register"
106
- )
107
-
108
- click.echo("Creating system admin...")
104
+ database_host = os.environ.get("DATABASE_HOST")
109
105
 
110
- try:
111
- response = requests.post(
112
- signup_url, json={"email": email, "password": password}
106
+ if not database_host:
107
+ click.echo("Database host is not set. Using signup endpoint...")
108
+ signup_url = (
109
+ f"{os.environ.get('JIVAS_BASE_URL', 'http://localhost:8000')}/user/register"
113
110
  )
114
- if response.status_code in (200, 201):
115
- click.secho("Admin user created successfully!", fg="green", bold=True)
116
- return response.json()
117
- else:
118
- click.secho(f"Failed to create admin: {response.text}", fg="red", bold=True)
119
- except Exception as e:
120
- click.secho(f"Error connecting to Jivas Server: {str(e)}", fg="red", bold=True)
111
+
112
+ try:
113
+ response = requests.post(
114
+ signup_url, json={"email": email, "password": password}
115
+ )
116
+ if response.status_code in (200, 201):
117
+ click.secho("Admin user created successfully!", fg="green", bold=True)
118
+ return response.json()
119
+ else:
120
+ click.secho(
121
+ f"Failed to create admin: {response.text}", fg="red", bold=True
122
+ )
123
+ except Exception as e:
124
+ click.secho(
125
+ f"Error connecting to Jivas Server: {str(e)}", fg="red", bold=True
126
+ )
127
+ else:
128
+ click.echo("Creating system admin...")
129
+ try:
130
+ result = subprocess.call(
131
+ [
132
+ "jac",
133
+ "create_system_admin",
134
+ "main.jac",
135
+ "--email",
136
+ email,
137
+ "--password",
138
+ password,
139
+ ]
140
+ )
141
+ if result == 0:
142
+ click.secho("Admin user created successfully!", fg="green", bold=True)
143
+ else:
144
+ click.secho("Failed to create admin user", fg="red", bold=True)
145
+ except Exception as e:
146
+ click.secho(f"Error running jac command: {str(e)}", fg="red", bold=True)
121
147
 
122
148
 
123
149
  @server.command()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jvcli
3
- Version: 2.0.28
3
+ Version: 2.0.30
4
4
  Summary: CLI tool for Jivas Package Repository
5
5
  Home-page: https://github.com/TrueSelph/jvcli
6
6
  Author: TrueSelph Inc.
@@ -1,4 +1,4 @@
1
- jvcli/__init__.py,sha256=5FN7vEYSZ-ohKWp6P-aEQCIWGVNvS7-8L8fzRa9gdks,171
1
+ jvcli/__init__.py,sha256=CL8xx6DmfmUG0u-5JNBk1YdppHbCESHCRHIuuEnAwVw,171
2
2
  jvcli/api.py,sha256=gd-EP1e75e7HijyrP-EF6i_jjCo6YUeSbm1l5daKLfQ,10352
3
3
  jvcli/auth.py,sha256=mHP425hvXhNxzeX--cApkrP7SdDPmfG6V0Li5TLHmIg,1953
4
4
  jvcli/cli.py,sha256=ntTkriNGtfxFAdJw5ikdq2wD43pIqDpb7lfXsCMXOWQ,1191
@@ -7,22 +7,22 @@ jvcli/client/__init__.py,sha256=WGP05OBzZHReqENYs1qYqMnYvgAaNVW6KvGQvyB3NGs,85
7
7
  jvcli/client/app.py,sha256=wQhJNfeF7NOx_MzzgnVy8Nfy9OW5fX0si6A34U1Woek,6452
8
8
  jvcli/client/lib/__init__.py,sha256=_Wv8CNIxeIle_x0U9T6w9s5mPuOY9-0u69BvTEPXLUw,38
9
9
  jvcli/client/lib/page.py,sha256=QF53ffO4A2P9QTdPFfi0baCpKyEMmfkLyhJNxm7pTb0,2225
10
- jvcli/client/lib/utils.py,sha256=Z1YJfeu8PnS-Ko2VcvDNu7mP6JrfUP3yJsFdKDf-psg,9692
10
+ jvcli/client/lib/utils.py,sha256=lWJqN0uiAfRRR0jHzeioWPMpR968g2LUX1Qe0Utmo0U,9748
11
11
  jvcli/client/lib/widgets.py,sha256=nWVW6yBh2x75GLkMj7Ck9dVaL2URS97TXgvF5dJsqhM,10166
12
12
  jvcli/client/pages/__init__.py,sha256=sXsBV8cGItWhXtYg8PkfCd1Vi5ibd-rv5LABnPC_St4,51
13
13
  jvcli/client/pages/action_dashboard_page.py,sha256=LvDFUt2-hNSmHTHyN1tDSPaE1sV-m_uyId1sGWuoMsw,5029
14
14
  jvcli/client/pages/analytics_page.py,sha256=TehUi9w6t-m2sW0Q24IfOqsc1WriIoD4_0GqRaYD4kk,8308
15
- jvcli/client/pages/chat_page.py,sha256=HJC2GxqFQhaCyv-3GmrxY6hPsR-i3BjaJyZfxAEwIk4,4769
15
+ jvcli/client/pages/chat_page.py,sha256=qqjP2Lqvvn5vUaDtbrCJsTQy7mcV8-Pr1xzTwjGxazk,4893
16
16
  jvcli/client/pages/graph_page.py,sha256=2ZN-C9eskqICgnZhfP1zc6YOPPsGib_WZw3xHXcA63k,491
17
17
  jvcli/commands/__init__.py,sha256=bjZvM55MC2NugvRlxkEU9CDDP9NnsygcsGZewj1gQcg,57
18
18
  jvcli/commands/auth.py,sha256=lO5G1_TCbxhOfy7xH9EULwvCLqf7iQTF9Q3MrpAtHPY,1611
19
19
  jvcli/commands/clean.py,sha256=AOyssr5MZ_EJ0wW6Q8GoWQ7ve5OGke9W82GusBFoDCg,1006
20
20
  jvcli/commands/client.py,sha256=yIp0wCmoxgxImJrpl0dH9qURGMcVKTxonVd1d-BdsxI,1432
21
- jvcli/commands/create.py,sha256=koPSQcQX4yFtZsmODJmPCevkov3m36JpkDHhLmMgzwg,13390
21
+ jvcli/commands/create.py,sha256=pXfVzfTPEMqK5b0-vd2ZJkhDxLcPMX-F2An5uvwXfnQ,13097
22
22
  jvcli/commands/download.py,sha256=GiLX_43CQOW9d5vF04fAszOWh3AB-7Mgote4tJ9RVng,3416
23
23
  jvcli/commands/info.py,sha256=NyIDpR_AGMMSFPE0tFZv4dIuv_gwqrfd589zQAA_Q3s,2685
24
24
  jvcli/commands/publish.py,sha256=TntkWRK6P4m0aTWRmFQtT5jYeEJqgxWJKvpUiHlrTQA,6637
25
- jvcli/commands/server.py,sha256=5sWW1AzWk378ySzvl-NK_-qE_d-FVT29DxqPI7NWIA4,7207
25
+ jvcli/commands/server.py,sha256=UX0h8ssmDMZBfAP58vzC6gpqkiNefPPOGmsJANAcZ38,8150
26
26
  jvcli/commands/startproject.py,sha256=5qis2Dhed-HhKqZ8e37Xpy__Rmqga8cTwAOmfGVPzmU,3375
27
27
  jvcli/commands/studio.py,sha256=avD5M3Ss7R6AtUMN3Mk6AmTyPJ7LnXcmwQ0mbRzivrQ,8192
28
28
  jvcli/commands/update.py,sha256=LwCLg-W1b8WSdFkiiJ8WwTit2HJXTLpM5OQ4WBTe9C4,1997
@@ -53,9 +53,9 @@ jvcli/templates/2.0.0/project/main.jac,sha256=r37jsaGq-85YvDbHP3bQvBXk0u8w0rtRTZ
53
53
  jvcli/templates/2.0.0/project/actions/README.md,sha256=TU1t-rOBH5WQP_HUWaEBLq5BbPv4jejtjIrwTW4hZwM,1742
54
54
  jvcli/templates/2.0.0/project/daf/README.md,sha256=fO-dcc3j-1E6sFagIvvJsISAth11N-2d64G0yHi7JrY,1682
55
55
  jvcli/templates/2.0.0/project/tests/README.md,sha256=-1ZXkxuUKa6tMw_jlF3rpCvUFq8ijW2L-nSuAkbCANo,917
56
- jvcli-2.0.28.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
- jvcli-2.0.28.dist-info/METADATA,sha256=D3iSi66_25BnsfYUtwIk2XXKiHXGYfRdwVVVRxvC94U,21667
58
- jvcli-2.0.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
- jvcli-2.0.28.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
60
- jvcli-2.0.28.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
61
- jvcli-2.0.28.dist-info/RECORD,,
56
+ jvcli-2.0.30.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
+ jvcli-2.0.30.dist-info/METADATA,sha256=pY0ueMBt_Xv24IqhlYFDSSE5nwhKZQX8_eFj7D2WxCc,21667
58
+ jvcli-2.0.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
+ jvcli-2.0.30.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
60
+ jvcli-2.0.30.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
61
+ jvcli-2.0.30.dist-info/RECORD,,
File without changes