← 返回
沟通协作 中文

Pywayne Llm Chat Ollama Gradio

Gradio-based chat interface for Ollama with multi-session management. Use when working with pywayne.llm.chat_ollama_gradio module to create a web-based chat...
基于 Gradio 的 Ollama 聊天界面,支持多会话管理,适用于使用 pywayne.llm.chat_ollama_gradio 模块构建网页聊天。
wangyendt
沟通协作 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 1,042
下载
💾 16
安装
1
版本
#latest

概述

Pywayne Chat Ollama Gradio

This module provides a Gradio-based web chat interface for Ollama models with multi-session support.

Quick Start

from pywayne.llm.chat_ollama_gradio import OllamaChatGradio

# Create and launch chat interface
app = OllamaChatGradio(
    base_url="http://localhost:11434/v1",
    server_port=7870
)
app.launch()

Configuration

ParameterDefaultDescription
---------------------------------
base_url"http://localhost:11434/v1"Ollama API base URL
server_name"0.0.0.0"Server host name
server_port7870Server port
root_path""Root path for reverse proxy
api_key"ollama"API key (for Ollama compatibility)

Model Discovery

Automatically discovers available Ollama models by running ollama list:

  • Excludes models with 'embed' in the name
  • Falls back to qwen2.5:0.5b if no models found

Session Management

Creating New Sessions

# UI method: Click "新建会话" button
new_chat_id, new_history, new_choices = app.create_new_chat()

Switching Sessions

# UI method: Select from "历史会话" radio list
history = app.switch_chat(selected_chat_id)

API Reference

OllamaChatGradio

MethodDescription
----------------------
get_ollama_models()Get list of available Ollama models
init_chat_manager()Initialize ChatManager instance
create_new_chat()Create new chat session, returns (chat_id, history, radio_update)
switch_chat(chat_id)Switch to specified chat session
format_history(history)Format history for display
chat(message, history, model_name)Process chat message with streaming
create_demo()Create Gradio interface
launch()Launch Gradio server

UI Components

ComponentDescription
------------------------
chatbotMain chat display area
msgMessage input textbox
model_dropdownModel selection dropdown
chat_id_textCurrent session ID (read-only)
new_chat_btnButton to create new session
chat_history_listRadio list for session switching

Requirements

  • gradio - Web UI framework
  • pywayne.llm.chat_bot - ChatManager and LLMConfig
  • ollama CLI - Must be installed and accessible

Notes

  • Uses ChatManager for multi-session support
  • Streaming responses update UI in real-time
  • Session history persists in memory (not persistent)
  • Requires Ollama to be running before launching

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 08:46 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 114 📥 52,461
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,689
productivity

Pywayne Statistics

wangyendt
综合性统计检验库,包含37种以上方法,涵盖正态性检验、位置检验、相关性检验、时间序列检验和模型诊断。
★ 0 📥 1,865