Skip to content

Commit

Permalink
Claude/Command/Gemini apps' architecture modified
Browse files Browse the repository at this point in the history
  • Loading branch information
yohasebe committed Jun 26, 2024
1 parent 4295d8d commit 05657d9
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Change Log

- [Jun, 2024] 0.7.0
- [Jun, 2024] 0.7.1
- Linux (Ubuntu/Debian) installer released
- App file name changed from monadic-chat to Monadic Chat
- [Jun, 2024] Speech Draft Helper app added (with TTS audio file generation)
Expand Down
2 changes: 1 addition & 1 deletion docker/monadic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=$PATH:/usr/local/bin
export SELENIUM_IMAGE="selenium/standalone-chrome:123.0"
# export SELENIUM_IMAGE="seleniarm/standalone-chromium:123.0"

export MONADIC_VERSION=0.7.0
export MONADIC_VERSION=0.7.1

export HOST_OS=$(uname -s)

Expand Down
17 changes: 11 additions & 6 deletions docker/services/ruby/apps/talk_to_claude/code_with_claude_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,19 @@ def settings
"easy_submit": false,
"auto_speech": false,
"mathjax": true,
"app_name": "Talk to Anthropic Claude (Code)",
"app_name": "Talk to Anthropic Claude (Code Interpreter)",
"description": description,
"icon": icon,
"initiate_from_assistant": false,
"pdf": false,
"image": true,
"toggle": true,
"models": [
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307"
],
"tools": [
{
"name": "run_code",
Expand Down Expand Up @@ -485,10 +491,9 @@ def api_request(role, session, call_depth: 0, &block)

begin
api_key = CONFIG["ANTHROPIC_API_KEY"]
model = CONFIG["ANTHROPIC_MODEL"]
raise if api_key.nil? || model.nil?
raise if api_key.nil?
rescue StandardError
puts "ERROR: ANTHROPIC_API_KEY or ANTHROPIC_MODEL not found."
puts "ERROR: ANTHROPIC_API_KEY not found."
exit
end

Expand Down Expand Up @@ -560,15 +565,15 @@ def api_request(role, session, call_depth: 0, &block)
headers = {
"anthropic-version" => "2023-06-01",
# "anthropic-beta" => "messages-2023-12-15",
"anthropic-beta" => "tools-2024-05-16",
# "anthropic-beta" => "tools-2024-05-16",
"content-type" => "application/json",
"x-api-key" => api_key
}

# Set the body for the API request
body = {
"system" => initial_prompt,
"model" => model,
"model" => obj["model"],
"stream" => true,
"tool_choice" => {"type": "auto"}
}
Expand Down
15 changes: 10 additions & 5 deletions docker/services/ruby/apps/talk_to_claude/talk_to_claude_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def settings
"initiate_from_assistant": false,
"toggle": true,
"image": true,
"models": [
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307"
],
"tools": [
{
"name": "fetch_web_content",
Expand Down Expand Up @@ -251,10 +257,9 @@ def api_request(role, session, call_depth: 0, &block)

begin
api_key = CONFIG["ANTHROPIC_API_KEY"]
model = CONFIG["ANTHROPIC_MODEL"]
raise if api_key.nil? || model.nil?
raise if api_key.nil?
rescue StandardError
puts "ERROR: ANTHROPIC_API_KEY or ANTHROPIC_MODEL not found."
puts "ERROR: ANTHROPIC_API_KEY not found."
exit
end

Expand Down Expand Up @@ -326,15 +331,15 @@ def api_request(role, session, call_depth: 0, &block)
headers = {
"anthropic-version" => "2023-06-01",
# "anthropic-beta" => "messages-2023-12-15",
"anthropic-beta" => "tools-2024-05-16",
# "anthropic-beta" => "tools-2024-05-16",
"content-type" => "application/json",
"x-api-key" => api_key
}

# Set the body for the API request
body = {
"system" => initial_prompt,
"model" => model,
"model" => obj["model"],
"stream" => true,
"tool_choice" => {"type": "auto"}
}
Expand Down
17 changes: 12 additions & 5 deletions docker/services/ruby/apps/talk_to_cohere/talk_to_cohere_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ def settings
"easy_submit": false,
"auto_speech": false,
"initiate_from_assistant": false,
"image": false
"image": false,
"models": [
"command-r-plus",
"command-r",
"command",
"command-nightly",
"command-light",
"command-light-nightly",
]
}
end

Expand Down Expand Up @@ -187,10 +195,9 @@ def api_request(role, session, call_depth: 0, &block)

begin
api_key = CONFIG["COHERE_API_KEY"]
model = CONFIG["COHERE_MODEL"]
raise if api_key.nil? || model.nil?
raise if api_key.nil?
rescue StandardError
puts "ERROR: COHERE_API_KEY or COHERE_MODEL not found."
puts "ERROR: COHERE_API_KEY not found."
exit
end

Expand Down Expand Up @@ -264,7 +271,7 @@ def api_request(role, session, call_depth: 0, &block)
# Set the body for the API request
body = {
"preamble" => initial_prompt,
"model" => model,
"model" => obj["model"],
"stream" => true,
"message" => message,
"prompt_truncation" => "AUTO",
Expand Down
12 changes: 7 additions & 5 deletions docker/services/ruby/apps/talk_to_gemini/talk_to_gemini_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def settings
"easy_submit": false,
"auto_speech": false,
"initiate_from_assistant": false,
"image": true
"image": true,
"models": [
"gemini-1.5-pro-001"
]
}
end

Expand Down Expand Up @@ -193,10 +196,9 @@ def api_request(role, session, call_depth: 0, &block)

begin
api_key = CONFIG["GEMINI_API_KEY"]
model = CONFIG["GEMINI_MODEL"]
raise if api_key.nil? || model.nil?
raise if api_key.nil?
rescue StandardError
puts "ERROR: GEMINI_API_KEY or GEMINI_MODEL not found."
puts "ERROR: GEMINI_API_KEY not found."
exit
end

Expand Down Expand Up @@ -330,7 +332,7 @@ def api_request(role, session, call_depth: 0, &block)
}
end

target_uri = "#{API_ENDPOINT}/#{model}:streamGenerateContent?key=#{api_key}"
target_uri = "#{API_ENDPOINT}/model/#{obj['model']}:streamGenerateContent?key=#{api_key}"

http = HTTP.headers(headers)

Expand Down
2 changes: 1 addition & 1 deletion docker/services/ruby/lib/monadic/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Monadic
VERSION = "0.7.0"
VERSION = "0.7.1"
end
13 changes: 12 additions & 1 deletion docker/services/ruby/public/js/monadic.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,21 @@ Do your best to make the conversation as natural as possible. Do not change subj
$("#image-file").hide();
}

if (!apps[$(this).val()]["model"] || apps[$(this).val()]["model"].length === 0) {
// initialize the (OpenAI) model options
if(model_options.length === 0){
model_options = $("#model").html();
}

if (apps[$(this).val()]["models"] && apps[$(this).val()]["models"].length > 0) {
let models_text = apps[$(this).val()]["models"]
let models = JSON.parse(models_text);
let modelList = listModels(models);
$("#model").html(modelList);
} else if (!apps[$(this).val()]["model"] || apps[$(this).val()]["model"].length === 0) {
$("#model_and_file").hide();
$("#model_parameters").hide();
} else {
$("#model").html(model_options);
$("#model_and_file").show();
$("#model_parameters").show();
}
Expand Down
4 changes: 3 additions & 1 deletion docker/services/ruby/public/js/monadic/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,11 @@ function checkParams() {
return true;
}

let model_options = [];

function resetEvent(event) {
audioInit();
event.preventDefault();
$("#model").html(model_options);
$("#message").css("height", "96px").val("");
$("#resetConfirmation").modal("show");
$("#resetConfirmation").on("shown.bs.modal", function () {
Expand Down
2 changes: 1 addition & 1 deletion docker/services/ruby/views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
</form>

<form class="row my-3" id="model_and_file">
<div class="col-4 pe-0">
<div class="col-5">
<label for="model" class="form-label text-nowrap">Model</label>
<select class="form-select me-3" id="model" ></select>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ layout: default

### Linux (Ubuntu/Debian)

1. Install Docker Desktop for Linux
1. Install Docker Desktop for Linux (See [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/)).
2. Install Monadic Chat.

- [📦 Installer package for Linux (Ubuntu/Debian) x64](https://yohasebe.com/assets/apps/monadic-chat_0.7.0_amd64.deb) (0.7.0)
Expand Down
4 changes: 2 additions & 2 deletions docs/installation_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ layout: default

### Linux (Ubuntu/Debian)

1. Docker Desktop for Linuxをインストールします。
2.Monadic Chat のインストーラーをダウンロードしてインストールします。
1. Docker Desktop for Linuxをインストールします。(参考:[LinuxにDocker Desktopをインストール](https://docs.docker.jp/desktop/install/linux-install.html)
2. Monadic Chat のインストーラーをダウンロードしてインストールします。

- [📦 Installer package for Linux (Ubuntu/Debian) x64](https://yohasebe.com/assets/apps/monadic-chat_0.7.0_amd64.deb) (0.7.0)
- [📦 Installer package for Linux (Ubuntu/Debian) arm64](https://yohasebe.com/assets/apps/monadic-chat_0.7.0_arm64.deb) (0.7.0)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "monadic-chat",
"productName": "Monadic Chat",
"version": "0.7.0",
"version": "0.7.1",
"description": "Launcher application responsible for starting and stopping Monadic Chat",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 05657d9

Please sign in to comment.