Промежуточный коммит. Добавлены методы stream_responce (agent), generate_stream_token (ollamaprovider)
This commit is contained in:
Binary file not shown.
@@ -36,6 +36,7 @@ def init():
|
||||
|
||||
#запрос на генерацию
|
||||
@ui.route("/chat", methods=["POST"])
|
||||
#@ui.route("/stream", methods=["POST"])
|
||||
def chat():
|
||||
|
||||
data = request.json
|
||||
@@ -51,11 +52,12 @@ def chat():
|
||||
})
|
||||
|
||||
|
||||
"""#список персонажей
|
||||
#список персонажей
|
||||
@ui.route("/characters", methods=["GET"])
|
||||
def get_characters():
|
||||
return Agent.get_all_char_info()
|
||||
|
||||
"""
|
||||
#выбор персонажа (не робит)
|
||||
@ui.route("/select_character", methods=["POST"])
|
||||
def select_character():
|
||||
|
||||
@@ -7,12 +7,8 @@ sendBtn.addEventListener("click", async () => {
|
||||
|
||||
const messages = document.getElementById("messages");
|
||||
|
||||
messages.innerHTML += `<p><b>You:</b> ${text}</p>`;
|
||||
const source = new EventSource("/stream");
|
||||
|
||||
source.onmessage = function(event) {
|
||||
messages.innerHTML += event.data;
|
||||
};
|
||||
messages.innerHTML += `<p><b>You:</b> ${text}</p>`; //=> получаем имя пользователя
|
||||
|
||||
const response = await fetch("/chat", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -38,6 +34,6 @@ async function loadChat() {
|
||||
const messages = document.getElementById("messages");
|
||||
|
||||
data.messages.forEach(msg => {
|
||||
messages.innerHTML += `<p><b>${msg.role}:</b> ${msg.content}</p>`;
|
||||
messages.innerHTML += `<p><b>${msg.role}:</b> ${msg.content}</p>`; //добавить проверку role == user => получаем имя пользователя
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user