mirror of
https://github.com/kou029w/daraz-llm.git
synced 2025-02-02 07:08:45 +00:00
Compare commits
No commits in common. "efc9f40f77274a40cd3131c81f5676146710a8e8" and "90b8873e2f9b38fa7fa0eb71b9a604a9946884fa" have entirely different histories.
efc9f40f77
...
90b8873e2f
2 changed files with 6 additions and 6 deletions
|
@ -5,7 +5,9 @@ LLM 版だらずさん
|
||||||
## インストール
|
## インストール
|
||||||
|
|
||||||
Step 1
|
Step 1
|
||||||
: [Create New Slack App](https://api.slack.com/apps?new_app=1&manifest_yaml={display_information:%20{name:%20darazllm},%20features:%20{bot_user:%20{display_name:%20darazllm}},%20oauth_config:%20{scopes:%20{bot:%20[%27channels:history%27,%20%27chat:write%27]}},%20settings:%20{event_subscriptions:%20{request_url:%20%27https://darazllm.deno.dev/slack/events%27,%20bot_events:%20[message.channels]}}}) > Select a workspace > Create > Install to Workspace
|
: Slack アプリの作成
|
||||||
|
|
||||||
|
[Create New Slack App](https://api.slack.com/apps?new_app=1&manifest_yaml={display_information:%20{name:%20darazllm},%20features:%20{bot_user:%20{display_name:%20darazllm}},%20oauth_config:%20{scopes:%20{bot:%20[%27channels:history%27,%20%27chat:write%27]}},%20settings:%20{event_subscriptions:%20{request_url:%20%27https://darazllm.deno.dev/slack/events%27,%20bot_events:%20[message.channels]}}}) > Select a workspace > Create > Install to Workspace
|
||||||
|
|
||||||
Step 2
|
Step 2
|
||||||
: [Fork to Edit](https://dash.deno.com/playground/darazllm) > Settings > Environment Variables
|
: [Fork to Edit](https://dash.deno.com/playground/darazllm) > Settings > Environment Variables
|
||||||
|
|
8
main.ts
8
main.ts
|
@ -14,8 +14,7 @@ const system = `\
|
||||||
賢い猫。少しだらしない。趣味はさんぽとねんね。
|
賢い猫。少しだらしない。趣味はさんぽとねんね。
|
||||||
全て鳥取弁で語尾が「にゃん」。`;
|
全て鳥取弁で語尾が「にゃん」。`;
|
||||||
|
|
||||||
const n = 10;
|
const n = 3;
|
||||||
const model = "llama3-70b-8192";
|
|
||||||
const usage = `\
|
const usage = `\
|
||||||
https://dash.deno.com/playground/darazllm
|
https://dash.deno.com/playground/darazllm
|
||||||
|
|
||||||
|
@ -24,8 +23,6 @@ https://dash.deno.com/playground/darazllm
|
||||||
@darazllm /bye すべて忘れる
|
@darazllm /bye すべて忘れる
|
||||||
@darazllm /help このテキストを表示
|
@darazllm /help このテキストを表示
|
||||||
|
|
||||||
使用する会話: 最新${n}件
|
|
||||||
モデル: ${model}
|
|
||||||
システムプロンプト:
|
システムプロンプト:
|
||||||
|
|
||||||
${system}`;
|
${system}`;
|
||||||
|
@ -35,6 +32,7 @@ import { Groq } from "npm:groq-sdk";
|
||||||
|
|
||||||
type Messages = Array<Groq.Chat.CompletionCreateParams.Message>;
|
type Messages = Array<Groq.Chat.CompletionCreateParams.Message>;
|
||||||
|
|
||||||
|
const model = "llama3-70b-8192";
|
||||||
const groq = new Groq({
|
const groq = new Groq({
|
||||||
apiKey: GROQ_API_KEY,
|
apiKey: GROQ_API_KEY,
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
|
@ -81,7 +79,7 @@ app.message(async (c) => {
|
||||||
|
|
||||||
if (isMention || Math.floor(Math.random() * n) === 0) {
|
if (isMention || Math.floor(Math.random() * n) === 0) {
|
||||||
try {
|
try {
|
||||||
const res = await chat(messages.slice(-n));
|
const res = await chat(messages);
|
||||||
|
|
||||||
if (!res) throw new Error("Empty response");
|
if (!res) throw new Error("Empty response");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue