Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions codetide/agents/tide/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from aicore.config import Config
from aicore.llm import Llm, LlmConfig
from aicore.models import AuthenticationError, ModelError
from aicore.const import STREAM_END_TOKEN, STREAM_START_TOKEN#, REASONING_START_TOKEN, REASONING_STOP_TOKEN
from aicore.const import STREAM_END_TOKEN, STREAM_START_TOKEN#, REASONING_START_TOKEN, REASONING_STOP_TOKEN
from codetide.agents.tide.ui.utils import process_thread, run_concurrent_tasks, send_reasoning_msg
from codetide.agents.tide.ui.stream_processor import StreamProcessor, MarkerConfig
from codetide.agents.tide.ui.utils import process_thread, run_concurrent_tasks
from codetide.agents.tide.ui.defaults import AGENT_TIDE_PORT, STARTERS
from codetide.agents.tide.ui.agent_tide_ui import AgentTideUi
from chainlit.data.sql_alchemy import SQLAlchemyDataLayer
Expand Down Expand Up @@ -265,28 +265,6 @@ async def on_inspect_context(action :cl.Action):

await inspect_msg.send()

async def send_reasoning_msg(loading_msg :cl.message, context_msg :cl.Message, agent_tide_ui :AgentTideUi, st :float)->bool:
await loading_msg.remove()

context_data = {
key: value for key in ["contextIdentifiers", "modifyIdentifiers"]
if (value := getattr(agent_tide_ui.agent_tide, key, None))
}
context_msg.elements.append(
cl.CustomElement(
name="ReasoningMessage",
props={
"reasoning": agent_tide_ui.agent_tide.reasoning,
"data": context_data,
"title": f"Thought for {time.time()-st:.2f} seconds",
"defaultExpanded": False,
"showControls": False
}
)
)
await context_msg.send()
return True

@cl.on_message
async def agent_loop(message: Optional[cl.Message]=None, codeIdentifiers: Optional[list] = None, agent_tide_ui :Optional[AgentTideUi]=None):

Expand Down Expand Up @@ -510,3 +488,8 @@ def main():
# TODO need to test project path is working as expected...

# TODO need to revisit logic
# TODO there's a bug that is leaving step messages holding for some reason
# TODO check initialzie codetide logic, seems to be deserialzied a bit too often
# TODO review codetide check for updat4es - continously readding untracked files

# TODO check why HF-DEMO-SPACE Auth is being triggereds
26 changes: 25 additions & 1 deletion codetide/agents/tide/ui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
from chainlit.types import ThreadDict
from aicore.logger import _logger
from aicore.llm import LlmConfig
import chainlit as cl
import asyncio
import orjson
import time

def process_thread(thread :ThreadDict)->Tuple[List[dict], Optional[LlmConfig], str]:
### type: tool
Expand Down Expand Up @@ -69,4 +71,26 @@ async def run_concurrent_tasks(agent_tide_ui: AgentTideUi, codeIdentifiers :Opti
asyncio.create_task(_logger.distribute())
while True:
async for chunk in _logger.get_session_logs(agent_tide_ui.agent_tide.llm.session_id):
yield chunk
yield chunk

async def send_reasoning_msg(loading_msg :cl.message, context_msg :cl.Message, agent_tide_ui :AgentTideUi, st :float)->bool:
await loading_msg.remove()

context_data = {
key: value for key in ["contextIdentifiers", "modifyIdentifiers"]
if (value := getattr(agent_tide_ui.agent_tide, key, None))
}
context_msg.elements.append(
cl.CustomElement(
name="ReasoningMessage",
props={
"reasoning": agent_tide_ui.agent_tide.reasoning,
"data": context_data,
"title": f"Thought for {time.time()-st:.2f} seconds",
"defaultExpanded": False,
"showControls": False
}
)
)
await context_msg.send()
return True
3 changes: 1 addition & 2 deletions examples/hf_demo_space/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

from codetide.agents.tide.ui.defaults import AICORE_CONFIG_EXAMPLE, EXCEPTION_MESSAGE, MISSING_CONFIG_MESSAGE, STARTERS
from codetide.agents.tide.ui.stream_processor import StreamProcessor, MarkerConfig
from codetide.agents.tide.ui.utils import run_concurrent_tasks
from codetide.agents.tide.ui.utils import run_concurrent_tasks, send_reasoning_msg
from codetide.agents.tide.ui.agent_tide_ui import AgentTideUi
from codetide.agents.tide.ui.app import send_reasoning_msg
from codetide.core.defaults import DEFAULT_ENCODING
from codetide.core.logs import logger
from codetide.agents.tide.models import Step
Expand Down