Skip to content

Commit

Permalink
Fixed horde issues, fixed bundling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Oct 26, 2023
1 parent 78cbafd commit f585efd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
35 changes: 35 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,41 @@ const Home = () => {
}

const hordeResponse = async () => {
if(hordeModels.length === 0) {
ToastAndroid(`No Models Selected`, 2000)
setNowGenerating(false)
return
}
console.log(`Using Horde`)

const request = await fetch(`https://stablehorde.net/api/v2/generate/text/async`, {
method: 'POST',
body: JSON.stringify(constructHordePayload()),
headers: {'apikey' : hordeKey, ...hordeHeader(), 'accept' : 'application/json', 'Content-Type' : 'application/json'}
})
const body = await request.json()
const generation_id = body.id
setHordeID(generation_id)
let result = undefined
do {
await new Promise(resolve => setTimeout(resolve, 5000))
console.log(`Checking...`)
const response = await fetch(`https://stablehorde.net/api/v2/generate/text/status/${generation_id}`, {
method: 'GET',
headers: {...hordeHeader()}
})
if(response.status !== 200) {
console.log(`Response failed.`)
setNowGenerating(false)
return
}
result = await response.json()
} while (!result.done)

setNowGenerating(() => {
insertGeneratedMessage(result.generations[0].text, true)
return false
})
}


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.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"base-64": "^1.0.0",
"eas-cli": "^5.4.0",
"expo": "~49.0.11",
"expo-application": "~5.3.0",
"expo-asset": "~8.10.1",
"expo-build-properties": "~0.8.3",
"expo-crypto": "~12.4.1",
Expand Down Expand Up @@ -53,9 +54,7 @@
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-web": "~0.19.6",
"text-encoding": "^0.7.0",
"undefined": "web-streams-polyfill/ponyfill/es6",
"expo-application": "~5.3.0"
"undefined": "web-streams-polyfill/ponyfill/es6"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down

0 comments on commit f585efd

Please sign in to comment.