GithubHelp home page GithubHelp logo

akikurisu / unichat Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 7.0 3.88 MB

一个用于在Unity中开发在线和离线聊天机器人的管线。A pipeline designed to create online and offline chat-bot in Unity.

License: MIT License

C# 100.00%
agent ai chat chatbot conversational-ai conversational-bots langchain llm sentis unity

unichat's People

Contributors

akikurisu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

unichat's Issues

Bot duplicate answers

Issue Description

When retrieval is enabled, bot will appear with duplicate answers.

Expected Behavior

Bot should not repeat its response in the same session.

Proposed Solution

Modify filter,or add a preprocessor before it. So we should only allocate tensors among answers that have not been answered.

Implememt tool use

Langchain is a powerful tool to create agent-based workflow. It will be interesting to implement it in Unity for game AI usage.🥰
I will first create a tool use system for quick verification.

记忆没有正常产生

以下是代码
public class RobotController : MonoBehaviour
{
public TMP_InputField inputField;
public TMP_Text TMP_Text;
public string prompt = @"How many planets are there?";
public AudioSource speechAudioSource;

private ChatHistory history;
private ChatMemory memory;
private readonly string template = "{history}\n{prompt}";
public ILargeLanguageModel ollamaChat;
// Start is called before the first frame update
void Start()
{
    ollamaChat = new OllamaChat() { Model = "BobBot" };
    history = new ChatHistory();
    memory = new ChatBufferMemory() { ChatHistory = history};
    inputField.onValueChanged.AddListener((str) => {
        prompt = str;
    });
}

public void OnClick() {
    RunChainlocal();
}

public async UniTask RunChainlocal()
{
    var chain = Chain.Set(prompt, "prompt")
        | Chain.LoadMemory(memory,"history")
        | Chain.Template(template)
        | Chain.LLM(ollamaChat)
        | Chain.UpdateHistory(history,requestKey:"prompt");

    string result = await chain.Run<string>("text");
    TMP_Text.text = result.Replace("\n", string.Empty).Trim();
    //    //AzureTTSStream.Instance.StartTTS(result, speechAudioSource);
    //    //AzureTTSNormal.Instance.StartTTS(result, speechAudioSource);
}

}
以下是log
[chain/start] [1:chain:StackChain > 9:chain:UpdateHistoryChain] Entering chain run with input:
{"prompt":"我叫什么名字","history":"User: 你好,我叫姚大哥,请你记住我\r\nBot: 好的,很高兴认识你!请告诉我你的名字是什么?\r\nUser: 我的名字是姚大哥\r\nBot: 好的,小姚大哥。很高兴与你交谈!有事可以随时找我聊天哦。\r\n","text":"很抱歉,我不知道你的名字。如果你告诉我,你就能听到我的回答了!"}

[chain/end] [1:chain:StackChain > 9:chain:UpdateHistoryChain] [1.0067ms] Exiting chain run with output:
{"prompt":"我叫什么名字","history":"User: 你好,我叫姚大哥,请你记住我\r\nBot: 好的,很高兴认识你!请告诉我你的名字是什么?\r\nUser: 我的名字是姚大哥\r\nBot: 好的,小姚大哥。很高兴与你交谈!有事可以随时找我聊天哦。\r\n","text":"很抱歉,我不知道你的名字。如果你告诉我,你就能听到我的回答了!"}

[chain/end] [1:chain:StackChain] [786.7143ms] Exiting chain run with output:
{"prompt":"我叫什么名字","history":"User: 你好,我叫姚大哥,请你记住我\r\nBot: 好的,很高兴认识你!请告诉我你的名字是什么?\r\nUser: 我的名字是姚大哥\r\nBot: 好的,小姚大哥。很高兴与你交谈!有事可以随时找我聊天哦。\r\n","text":"很抱歉,我不知道你的名字。如果你告诉我,你就能听到我的回答了!"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.