-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Falcon * Add Falcon180bBotSettings * housekeeping --------- Co-authored-by: Sunner Sun <[email protected]>
- Loading branch information
1 parent
8ce75a2
commit 80782a4
Showing
7 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import GradioBot from "@/bots/huggingface/GradioBot"; | ||
import AsyncLock from "async-lock"; | ||
import axios from "axios"; | ||
|
||
export default class Falcon180bBot extends GradioBot { | ||
static _brandId = "falcon"; // Brand id of the bot, should be unique. Used in i18n. | ||
static _className = "Falcon180bBot"; // Class name of the bot | ||
static _logoFilename = "falcon-180b-logo.jpeg"; // Place it in public/bots/ | ||
static _loginUrl = "https://tiiuae-falcon-180b-demo.hf.space/"; // Any Gradio URL | ||
static _settingsComponent = "Falcon180bBotSettings"; // Vue component filename for settings | ||
static _model = "falcon-180b"; | ||
static _lock = new AsyncLock(); // Send requests in queue to save LMSYS | ||
static _fnIndexes = [3]; // Indexes of the APIs to call in order. Sniffer it by devtools. | ||
|
||
static _predictUrl = Falcon180bBot._loginUrl + "run/predict"; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
sendPredict(fn_index, session_hash, payload) { | ||
return axios.post(Falcon180bBot._predictUrl, { | ||
fn_index, | ||
data: [], | ||
event_data: null, | ||
session_hash: session_hash, | ||
...payload, | ||
}); | ||
} | ||
|
||
async _sendPrompt(prompt, onUpdateResponse, callbackParam) { | ||
try { | ||
const session_hash = await this.getChatContext(); | ||
await axios.all([ | ||
this.sendPredict(4, session_hash), | ||
this.sendPredict(1, session_hash, { | ||
data: [prompt], | ||
}), | ||
]); | ||
await this.sendPredict(2, session_hash, { data: [null, null] }); | ||
await super._sendPrompt(prompt, onUpdateResponse, callbackParam); | ||
await this.sendPredict(5, session_hash); | ||
} catch (error) { | ||
throw Error(error); | ||
} | ||
} | ||
|
||
/* eslint-disable no-unused-vars */ | ||
makeData(fn_index, prompt) { | ||
let r = null; | ||
if (fn_index === this.constructor._fnIndexes[0]) { | ||
r = [null, null, "", 0.9, 256, 0.9, 1.2]; | ||
} | ||
return r; | ||
} | ||
|
||
parseData(fn_index, data) { | ||
let r = undefined; | ||
if (fn_index === this.constructor._fnIndexes[0]) { | ||
r = data[0][data[0].length - 1][1]; | ||
} | ||
return r; | ||
} | ||
|
||
parseError(errorMsg) { | ||
return errorMsg; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<login-setting :bot="bot"></login-setting> | ||
</template> | ||
|
||
<script> | ||
import Bot from "@/bots/huggingface/Falcon180bBot"; | ||
import LoginSetting from "@/components/BotSettings/LoginSetting.vue"; | ||
export default { | ||
components: { | ||
LoginSetting, | ||
}, | ||
data() { | ||
return { | ||
bot: Bot.getInstance(), | ||
}; | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80782a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chatall – ./
chatall-sunner.vercel.app
chatall-git-main-sunner.vercel.app
chatall-llm.vercel.app