Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Change config key name from `cloudflareUserId` to `cloudflareAccountId`
  • Loading branch information
Ranzeplay committed Sep 1, 2024
1 parent d759fa8 commit 5030115
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# SaySomething

A Minecraft Mod that connects villagers to AI models.

## Description

The mod uses `@cf/qwen/qwen1.5-14b-chat-awq` model on Cloudflare AI
to enable players to interact with villagers via text.

## Usage

Put `$` sign at the beginning of your chat message
to talk to villagers in front of you.

Villagers may not respond if your message isn't related to them.

## Configuration

Configurations are in the `config/saysth-config.json`, you will see the content below:

```json
{
"cloudflareApiKey": "",
"cloudflareAccountId": "",
"personalities": [],
"nameCandidates": []
}
```

- `cloudflareApiKey`: A Cloudflare API key generated that has access to AI features.
- `cloudflareAccountId`: Your Cloudflare account ID.
- `personalities`: A list of string that describes the personality of a villager.
- `nameCandidates`: A list of string of names that will be put on villagers.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
public class SaySthConfig {
public SaySthConfig() {
cloudflareApiKey = "";
cloudflareUserId = "";
cloudflareAccountId = "";
personalities = new String[]{};
nameCandidates = new String[]{};
}

String cloudflareApiKey;
String cloudflareUserId;
String cloudflareAccountId;
String[] personalities;
String[] nameCandidates;
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public String sendMessageToVillager(UUID villagerId, UUID playerId, String messa
Main.LOGGER.info(bodyText);

// Send web request
var request = HttpRequest.newBuilder(URI.create("https://api.cloudflare.com/client/v4/accounts/" + Main.CONFIG_MANAGER.getConfig().getCloudflareUserId() + "/ai/run/@cf/qwen/qwen1.5-14b-chat-awq"))
var request = HttpRequest.newBuilder(URI.create("https://api.cloudflare.com/client/v4/accounts/" + Main.CONFIG_MANAGER.getConfig().getCloudflareAccountId() + "/ai/run/@cf/qwen/qwen1.5-14b-chat-awq"))
.POST(HttpRequest.BodyPublishers.ofString(bodyText))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
Expand Down

0 comments on commit 5030115

Please sign in to comment.