File size: 3,393 Bytes
ccded5c
 
 
b5f5dbb
e00a0cb
 
 
 
 
 
 
 
 
 
 
 
ccded5c
13bae54
 
 
 
ccded5c
e00a0cb
13bae54
 
e00a0cb
 
501e2ad
ccded5c
e00a0cb
13bae54
e00a0cb
13bae54
e00a0cb
 
13bae54
501e2ad
 
 
e00a0cb
 
13bae54
 
 
 
 
 
f03baa2
13bae54
e00a0cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13bae54
e00a0cb
13bae54
 
 
 
 
 
e00a0cb
13bae54
e00a0cb
13bae54
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import gradio as gr
from agent.core import run_agent

async def respond_to_issue(issue_url, branch_name):
    logs = []
    async for log_msg in run_agent(issue_url, branch_name):
        logs.append(str(log_msg))

    collapsible_logs = "<details><summary>Click to view agent's used tool logs</summary>\n\n"
    for log in logs:
        collapsible_logs += f"- {log}\n"
    collapsible_logs += "</details>\n\n"

    final_message = f"{collapsible_logs} Agent has successfully processed the issue and posted an update in the comments. Check the GitHub issue for updates."

    return [{"role": "assistant", "content": final_message}]

theme = gr.themes.Soft(
    primary_hue="orange",
    secondary_hue="yellow",
    neutral_hue="zinc",
)

with gr.Blocks(title="OpenSorus – AI Maintainer Agent", theme=theme) as demo:
    gr.Markdown("""
    # OpenSorus – AI Maintainer Agent for GitHub Issues
    
    **Reads the issue. Understands your repo. Replies in seconds.** - _Powered by Mistral AI 🧡 & LlamaIndex 🦙_

    Let OpenSorus handle your first-level triage by autonomously pulling context from your codebase and commenting with a helpful fix/suggestion to help your contributors/customers.

    **Note**: Please [install the agent](https://github.com/apps/opensorus) as a GitHub app for a particular repository before using this tool.

    - **Quickest way to assign issues to OpenSorus**: Just mention @opensorus in the GitHub issue comments.
    - Alternatively, use this space to assign the issue by pasting the issue URL below & specifying the primary branch name of your codebase (e.g., main, master, etc.).

                
     _(Drop a ❤️ if this tool made your day a little easier!)_
                
    ---
    """)

    with gr.Row():
        with gr.Column(scale=1):
            issue_url = gr.Textbox(label="🔗 GitHub Issue URL", placeholder="https://github.com/user/repo/issues/123")
            branch_name = gr.Textbox(label="🌿 Branch Name", placeholder="main or dev or feature/xyz")
            submit_btn = gr.Button("🚀 Run Agent", variant="primary")

        with gr.Column(scale=1):
            chatbot = gr.Chatbot(
                label="Task Status",
                type="messages",
                avatar_images=(
                    None,
                    "https://res.cloudinary.com/ivolve/image/upload/v1749307354/OpenSorus-logo_r2bfzw.jpg",
                ),
                height=250,
                resizable=True,
                max_height=400
            )

        submit_btn.click(
            fn=respond_to_issue,
            inputs=[issue_url, branch_name],
            outputs=chatbot,
            queue=True,
        )

    gr.Markdown("""       
    ---
                
    ### 🛠 How It Works
    1. [Install OpenSorus](https://github.com/apps/opensorus) as a GitHub App.
    2. Configure the app to have access to your particular repository.
    3. Mention @opensorus in any issue's comments.
    4. Alternatively, use this space to paste the issue URL and specify the branch name (e.g., main, master, etc.).
    5. Click Run Agent and OpenSorus will fetch issue details, read your code, and post a helpful comment.
    
    > ### _OpenSorus is just like an L1 dev support assistant of your project that never sleeps — and knows your codebase ✨._
    
    ---
""")

if __name__ == "__main__":
    demo.launch()