aicosmos-client 0.0.3__py3-none-any.whl → 0.0.4__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.
aicosmos_client/cli.py CHANGED
@@ -1,24 +1,14 @@
1
1
  import asyncio
2
2
  from typing import Dict
3
3
 
4
+ from client import AICosmosClient
4
5
  from textual import on, work
5
6
  from textual.app import App, ComposeResult
6
7
  from textual.containers import Container
7
8
  from textual.reactive import reactive
8
9
  from textual.screen import Screen
9
- from textual.widgets import (
10
- Button,
11
- Footer,
12
- Header,
13
- Input,
14
- Label,
15
- ListItem,
16
- ListView,
17
- LoadingIndicator,
18
- RichLog,
19
- Static,
20
- )
21
- from .client import AICosmosClient
10
+ from textual.widgets import (Button, Footer, Header, Input, Label, ListItem,
11
+ ListView, LoadingIndicator, RichLog, Static)
22
12
 
23
13
 
24
14
  class LoginScreen(Screen):
@@ -178,7 +168,7 @@ class SessionScreen(Screen):
178
168
  self.query_one("#session-list").clear()
179
169
  self.sessions, message = self.app.client.get_my_sessions()
180
170
 
181
- if message != "success":
171
+ if message != "Success":
182
172
  self.query_one("#session-list").append(
183
173
  ListItem(Label(f"{message}"), id="no-sessions")
184
174
  )
@@ -193,9 +183,9 @@ class SessionScreen(Screen):
193
183
  for session in self.sessions:
194
184
  session_id = session["session_id"]
195
185
  clean_id = self.sanitize_id(session_id)
196
- title = session["environment_info"].get(
197
- "title", f"Session {session_id[:6]}"
198
- )
186
+ title = session["title"]
187
+ if not title:
188
+ title = f"Session {session_id[:6]}"
199
189
  self.query_one("#session-list").append(
200
190
  ListItem(Label(title), id=f"session-{clean_id}")
201
191
  )
@@ -203,7 +193,7 @@ class SessionScreen(Screen):
203
193
  @on(Button.Pressed, "#create-session")
204
194
  @work(exclusive=True)
205
195
  async def create_session(self) -> None:
206
- session_id = self.app.client.create_session()
196
+ session_id, message = self.app.client.create_session()
207
197
 
208
198
  if session_id:
209
199
  self.app.current_session = session_id
@@ -211,7 +201,7 @@ class SessionScreen(Screen):
211
201
  self.app.install_screen(ChatScreen(), "chat")
212
202
  self.app.push_screen("chat")
213
203
  else:
214
- self.query_one("#session-error").update("Failed to create session")
204
+ self.query_one("#session-error").update(f"Failed to create session: {message}")
215
205
 
216
206
  @on(ListView.Selected)
217
207
  def session_selected(self, event: ListView.Selected) -> None:
@@ -402,7 +392,7 @@ class ChatScreen(Screen):
402
392
  self.conversation, message = self.app.client.get_session_history(
403
393
  self.app.current_session
404
394
  )
405
- if message != "success":
395
+ if message != "Success":
406
396
  self.query_one("#chat-log").write(f"[red]Error: {message}[/red]")
407
397
  return
408
398
  self.update_message_display()
@@ -437,7 +427,7 @@ class ChatScreen(Screen):
437
427
  self.app.client.chat, self.app.current_session, message
438
428
  )
439
429
 
440
- if message != "success":
430
+ if message != "Success":
441
431
  self.query_one("#chat-log").write(f"[red]Error: {message}[/red]")
442
432
  return
443
433
  new_messages = conversation_history[len(self.conversation) :]
aicosmos_client/client.py CHANGED
@@ -99,7 +99,7 @@ class AICosmosClient:
99
99
  return [
100
100
  {
101
101
  "session_id": session["session_id"],
102
- "title": session["environment_info"].get("title", "unknown"),
102
+ "title": session["environment_info"].get("title", None),
103
103
  }
104
104
  for session in sessions
105
105
  ], "Success"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aicosmos_client
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: client for AICosmos platform
5
5
  Project-URL: Homepage, https://github.com/pypa/sampleproject
6
6
  Project-URL: Issues, https://github.com/pypa/sampleproject/issues
@@ -0,0 +1,7 @@
1
+ aicosmos_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ aicosmos_client/cli.py,sha256=Dv9uNOcc0rMXjCVfaElDxS8p1mnDwFfTt_vnpAwLUuI,13940
3
+ aicosmos_client/client.py,sha256=SSR7THQDvSj9Bnm2ytdJ5Twe3Vy8YdGslbmx71UgLw4,4870
4
+ aicosmos_client-0.0.4.dist-info/METADATA,sha256=a85Gf6H1HTMtUY-YvMuzm_QFnDKT48L8Ngwp_1iwq64,712
5
+ aicosmos_client-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ aicosmos_client-0.0.4.dist-info/licenses/LICENSE,sha256=XBdpsYae127l7YQyMSVQwUUo22FPis7sMts7oBjkN_g,1056
7
+ aicosmos_client-0.0.4.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- aicosmos_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- aicosmos_client/cli.py,sha256=8VzGfvUGPmEbnbK_yqC3-UEcTMCMg8xs_Zy-xQzeDj0,13939
3
- aicosmos_client/client.py,sha256=t3qlfanWG_NngNp9VPwHcJh_JC-2sQR-RRMvXWVQVcM,4875
4
- aicosmos_client-0.0.3.dist-info/METADATA,sha256=mhPwxEWtskK0Umu592yqdgTMf-gstv7zjzL-KuSs17w,712
5
- aicosmos_client-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- aicosmos_client-0.0.3.dist-info/licenses/LICENSE,sha256=XBdpsYae127l7YQyMSVQwUUo22FPis7sMts7oBjkN_g,1056
7
- aicosmos_client-0.0.3.dist-info/RECORD,,