Update to 0.9.5 (#59)

This commit is contained in:
kwaroran
2023-05-16 04:01:47 +09:00
committed by GitHub
5 changed files with 47 additions and 27 deletions

View File

@@ -11,7 +11,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [ubuntu-20.04,macos-latest] platform: [ubuntu-latest,macos-latest,windows-latest]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
@@ -32,15 +32,15 @@ jobs:
with: with:
toolchain: stable toolchain: stable
- name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04' if: matrix.platform == 'ubuntu-latest'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies - name: install frontend dependencies
run: pnpm install --no-frozen-lockfile # change this to npm or pnpm depending on which one you use run: pnpm install --no-frozen-lockfile # change this to npm or pnpm depending on which one you use
- if: matrix.platform == 'ubuntu-20.04' - if: matrix.platform == 'ubuntu-latest'
run: pnpm tauri build --target x86_64-unknown-linux-gnu run: pnpm tauri build --target x86_64-unknown-linux-gnu
- if: matrix.platform == 'ubuntu-20.04' - if: matrix.platform == 'ubuntu-latest'
uses: "softprops/action-gh-release@v1" uses: "softprops/action-gh-release@v1"
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" repo_token: "${{ secrets.GITHUB_TOKEN }}"
@@ -53,6 +53,8 @@ jobs:
src-tauri/target/x86_64-unknown-linux-gnu/release/**/*.AppImage src-tauri/target/x86_64-unknown-linux-gnu/release/**/*.AppImage
- if: matrix.platform == 'macos-latest' - if: matrix.platform == 'macos-latest'
run: pnpm tauri build --target x86_64-apple-darwin run: pnpm tauri build --target x86_64-apple-darwin
- if: matrix.platform == 'macos-latest'
run: pnpm tauri build --target aarch64-apple-darwin
- if: matrix.platform == 'macos-latest' - if: matrix.platform == 'macos-latest'
uses: "softprops/action-gh-release@v1" uses: "softprops/action-gh-release@v1"
with: with:

View File

@@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "RisuAI", "productName": "RisuAI",
"version": "0.9.4" "version": "0.9.5"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -7,7 +7,7 @@ import { cloneDeep } from 'lodash';
export const DataBase = writable({} as any as Database) export const DataBase = writable({} as any as Database)
export const loadedStore = writable(false) export const loadedStore = writable(false)
export let appVer = '0.9.4' export let appVer = '0.9.5'
export function setDatabase(data:Database){ export function setDatabase(data:Database){

View File

@@ -87,35 +87,53 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
chunkSize += tokens chunkSize += tokens
} }
const promptbody:OpenAIChat[] = [ const supaPrompt = db.supaMemoryPrompt === '' ?
{ "[Summarize the ongoing role story. It must also remove redundancy and unnecessary content from the prompt so that gpt3 and other sublanguage models]\n"
role: "user", : db.supaMemoryPrompt
content: stringlizedChat
},
{
role: "system",
content: db.supaMemoryPrompt === '' ?
"[Summarize the ongoing role story. It must also remove redundancy and unnecessary content from the prompt so that gpt3 and other sublanguage models]\n"
: db.supaMemoryPrompt
}
]
const da = await requestChatData({ const promptbody = stringlizedChat + '\n\n' + supaPrompt + "\n\nOutput:"
formated: promptbody,
bias: {}
}, 'submodel')
if(da.type === 'fail'){ const da = await fetch("https://api.openai.com/v1/completions",{
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + db.openAIKey
},
method: "POST",
body: JSON.stringify({
"model": "text-davinci-003",
"prompt": promptbody,
"max_tokens": 500,
"temperature": 0
})
})
// const promptbody:OpenAIChat[] = [
// {
// role: "user",
// content: stringlizedChat
// },
// {
// role: "system",
// content: supaPrompt
// }
// ]
// const da = await requestChatData({
// formated: promptbody,
// bias: {}
// }, 'submodel')
const result = (await da.json()).choices[0].text.trim()
if(da.status < 200 || da.status >= 300){
return { return {
currentTokens: currentTokens, currentTokens: currentTokens,
chats: chats, chats: chats,
error: "SupaMemory: HTTP: " + da.result error: "SupaMemory: HTTP: " + await da.text()
} }
} }
const tokenz = await tokenize(da.result + '\n\n') + 5 const tokenz = await tokenize(result + '\n\n') + 5
currentTokens += tokenz currentTokens += tokenz
supaMemory += da.result + '\n\n' supaMemory += result + '\n\n'
console.log(tokenz) console.log(tokenz)
} }

View File

@@ -1 +1 @@
{"version":"0.9.4"} {"version":"0.9.5"}