You are viewing a potentially older version of this package. View all versions.
LIghtPeak-PeakChatOps-1.2.1 icon

PeakChatOps

A chat system for PEAK. Basic messaging functionality with UI enhancements. Includes AI assistant support via OpenAI API.

Date uploaded 8 months ago
Version 1.2.1
Download link LIghtPeak-PeakChatOps-1.2.1.zip
Downloads 104
Dependency string LIghtPeak-PeakChatOps-1.2.1

This mod requires the following mods to function

BepInEx-BepInExPack_PEAK-5.4.75301 icon
BepInEx-BepInExPack_PEAK

BepInEx pack for PEAK. Preconfigured and ready to use.

Preferred version: 5.4.75301
Snosz-PhotonCustomPropsUtils-1.1.0 icon
Snosz-PhotonCustomPropsUtils

Helps modders easily synchronize room/player properties across all connected clients through Photon's Custom Properties.

Preferred version: 1.1.0
PEAKModding-PEAKLib_Core-1.6.0 icon
PEAKModding-PEAKLib_Core

Core module of the PEAKLib community API.

Preferred version: 1.6.0
Cysharp-UniTask-2.5.0 icon
Cysharp-UniTask

Provides an efficient allocation free async/await integration for Unity.

Preferred version: 2.5.0

README

PeakChatOps

GitHub Thunderstore Version Thunderstore Downloads

Welcome to PeakChatOps

This mod is a chat enhancement mod with the following features:

  • Multiple extensible chat commands
  • Scrollable message history without lag, with text copying support
  • LLM integration for translation and other AI features
  • Localization support (commands not fully localized yet)

Usage Tips

  • Default key: Press Y to open chat

  • Commands: Start with /

  • Help: /help to view available commands

  • AI Chat: /ai HI - Chat with AI (local display only)

  • Translation: /ai translate 你好 - Translate to English, then @send to broadcast the AI response

  • Command Learning: /ai how to use this cmd: whisper @whisper - Learn how to use commands (useful for foreign language commands)

  • Position: /pos T / R / C - Change chat window position (Top/Right/Center)

Note: While typing, you can freely click on text to copy content

What

' s New in 1.2.0 (vs 1.1.5)

I completely abandoned the old UI system and switched to Unity ' s latest UXML/USS system, solving these issues:

  1. No more lag when sending long texts - significantly improved experience
  2. Smoother scrolling throughout the interface
  3. Better extensibility for future features

Customizing Chat Styles

Here ' s how to customize the chat appearance:

  1. Open the Unity Project

    • Navigate to the unity folder in this project
    • Open with Unity (same version as the project)
  2. Locate the UI Files

    • In the Mod folder, you ' ll find prefab files
    • Use UI Toolkit to open the .uxml files
  3. Customize Styles

    • Edit the UXML/USS files to change appearance
    • Important: Don ' t change component names, or you ' ll need to update the source code bindings
  4. Build the Bundle

    • Enable Unity Addressable System
    • Go to Window → Asset Management → Addressables → Groups → Build
    • Click Build to generate the bundle
  5. Deploy the Bundle

    • Find the largest bundle file in: unity project / Libraries / com.unity.addressables / aa / standalonewindows64 /
    • Rename it to: PeakChatOpsUI.peakbundle
    • Place it in the mod folder

Developing Custom Commands

Here ' s how to create your own commands. Example: Echo.cs

using System;
using PeakChatOps.API;
using Cysharp.Threading.Tasks;
using PeakChatOps.Core;
#nullable enable
namespace PeakChatOps.Commands;

[PCOCommand("echo", "Echo input content", "Usage: /echo <content>\nReturns your input as-is.")]
public class EchoCommand
{
    // New message-driven handler signature. Plugins/commands register handlers
    // on EventBusRegistry.CmdMessageBus with channel "cmd://echo".
    public EchoCommand()
    {
        EventBusRegistry.CmdMessageBus.Subscribe("cmd://echo", Handle);
        DevLog.UI("[Cmd] EchoCommand subscribed to cmd://echo");
    }

    public static async UniTask Handle(CmdMessageEvent evt)
    {
        try
        {
            var args = evt.Args ?? Array.Empty<string>();
            var res = args.Length == 0 ? "Please enter content to echo." : string.Join(" ", args);
            var resultEvt = new CmdExecResultEvent(evt.Command, evt.Args ?? Array.Empty<string>(), evt.UserId, stdout: res, stderr: null, success: true);
            await EventBusRegistry.CmdExecResultBus.Publish("cmd://", resultEvt);
        }
        catch (Exception ex)
        {
            var errEvt = new CmdExecResultEvent(evt.Command, evt.Args ?? Array.Empty<string>(), evt.UserId, stdout: null, stderr: ex.Message, success: false);
            await EventBusRegistry.CmdExecResultBus.Publish("cmd://", errEvt);
        }
        await UniTask.CompletedTask;
    }
}

API Key 安全提示

  • API Key 已安全储存在本地,请放心使用。
  • 如果不放心,建议使用 ollama 提供的云模型。

API Key is securely stored locally. You can use it with confidence. If you have concerns, it is recommended to use the cloud model provided by ollama.

Build

dotnet build -c Release -target:PackTS -v d

Credits (in no particular order)


For questions or suggestions, feel free to open an issue or PR!

CHANGELOG

Changelog

  • 1.2.0

  • UI Improvements:

    • Fixed chat panel occupying entire screen, now only uses actual panel size
    • Fixed input text appearing white and hard to read - now uses proper contrast
    • Improved maximize/minimize functionality using USS styles instead of hardcoded values
    • Fixed long text overflowing horizontally - now properly wraps to new lines
  • Message System Fixes:

    • Fixed remote player messages not displaying properly
    • Fixed null reference exception in /dev mock player command
    • Improved message receiving and display pipeline
  • Code Quality:

    • Removed unnecessary thread switching calls
    • Enhanced error handling and debug logging
    • Fixed compilation errors
  • 1.1.4

  • added command: /ai usage: /ai [prompt] @send : send prompt to OpenAI chat completion API and get response,send to other players if @send is specified : if @send is not specified, only send to yourself

-added config: autoTranslate : if true, automatically translate received messages to your language using OpenAI API.(need test,default: false)

  • 1.0.1
  • Added command: /hide : hide chat box immediately