aicosmos-client 0.0.3__tar.gz → 0.0.4__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.
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/PKG-INFO +1 -1
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/aicosmos_client/cli.py +11 -21
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/aicosmos_client/client.py +1 -1
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/pyproject.toml +1 -1
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/.gitignore +0 -0
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/LICENSE +0 -0
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/README.md +0 -0
- {aicosmos_client-0.0.3 → aicosmos_client-0.0.4}/aicosmos_client/__init__.py +0 -0
@@ -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
|
-
|
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 != "
|
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["
|
197
|
-
|
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 != "
|
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 != "
|
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) :]
|
@@ -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",
|
102
|
+
"title": session["environment_info"].get("title", None),
|
103
103
|
}
|
104
104
|
for session in sessions
|
105
105
|
], "Success"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|