Compare commits

..

No commits in common. "f7ec002fe66c79ac321530b401de1fd4318102ae" and "af55e94c4fa48c6610c323de8f2f4d5137774005" have entirely different histories.

8 changed files with 26 additions and 52 deletions

View file

@ -12,16 +12,13 @@ on:
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: git.depeuter.dev
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
RUNNER_TOOL_CACHE: /toolcache
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
@ -42,7 +39,7 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.CI_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker images
id: meta

View file

@ -8,19 +8,15 @@ jobs:
name: 'Format Backend'
env:
PUBLIC_API_BASE_URL: ''
RUNNER_TOOL_CACHE: /toolcache
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- latest
python-version: [ '3.12.2' ]
steps:
- uses: actions/checkout@v4
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Use Bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies

View file

@ -293,7 +293,6 @@ def generate_image(
"size": form_data.size if form_data.size else app.state.IMAGE_SIZE,
"response_format": "b64_json",
}
r = requests.post(
url=f"https://api.openai.com/v1/images/generations",
json=data,
@ -301,6 +300,7 @@ def generate_image(
)
r.raise_for_status()
res = r.json()
images = []
@ -356,10 +356,7 @@ def generate_image(
return images
except Exception as e:
error = e
if r != None:
data = r.json()
if "error" in data:
error = data["error"]["message"]
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(error))
print(e)
if r:
print(r.json())
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e))

View file

@ -123,7 +123,6 @@ async def get_all_models():
map(lambda response: response["models"], responses)
)
}
app.state.MODELS = {model["model"]: model for model in models["models"]}
return models
@ -182,17 +181,11 @@ async def get_ollama_versions(url_idx: Optional[int] = None):
responses = await asyncio.gather(*tasks)
responses = list(filter(lambda x: x is not None, responses))
if len(responses) > 0:
lowest_version = min(
responses, key=lambda x: tuple(map(int, x["version"].split(".")))
)
lowest_version = min(
responses, key=lambda x: tuple(map(int, x["version"].split(".")))
)
return {"version": lowest_version["version"]}
else:
raise HTTPException(
status_code=500,
detail=ERROR_MESSAGES.OLLAMA_NOT_FOUND,
)
return {"version": lowest_version["version"]}
else:
url = app.state.OLLAMA_BASE_URLS[url_idx]
try:

View file

@ -52,4 +52,3 @@ class ERROR_MESSAGES(str, Enum):
MODEL_NOT_FOUND = lambda name="": f"Model '{name}' was not found"
OPENAI_NOT_FOUND = lambda name="": f"OpenAI API was not found"
OLLAMA_NOT_FOUND = "WebUI could not connect to Ollama"

View file

@ -140,9 +140,7 @@
};
const scrollToBottom = () => {
if (messagesContainerElement) {
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
}
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
};
//////////////////////////
@ -310,7 +308,7 @@
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
// Add images array only if it contains elements
if (imageUrls && imageUrls.length > 0 && message.role === 'user') {
if (imageUrls && imageUrls.length > 0) {
baseMessage.images = imageUrls;
}
@ -534,8 +532,7 @@
.filter((message) => message)
.map((message, idx, arr) => ({
role: message.role,
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
message.role === 'user'
...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false
? {
content: [
{

View file

@ -160,9 +160,7 @@
};
const scrollToBottom = () => {
if (messagesContainerElement) {
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
}
messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight;
};
//////////////////////////
@ -323,7 +321,7 @@
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
// Add images array only if it contains elements
if (imageUrls && imageUrls.length > 0 && message.role === 'user') {
if (imageUrls && imageUrls.length > 0) {
baseMessage.images = imageUrls;
}
@ -547,8 +545,7 @@
.filter((message) => message)
.map((message, idx, arr) => ({
role: message.role,
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
message.role === 'user'
...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false
? {
content: [
{
@ -691,12 +688,7 @@
if (messages.length == 2) {
window.history.replaceState(history.state, '', `/c/${_chatId}`);
if ($settings?.titleAutoGenerateModel) {
await generateChatTitle(_chatId, userPrompt);
} else {
await setChatTitle(_chatId, userPrompt);
}
await setChatTitle(_chatId, userPrompt);
}
};

View file

@ -3,13 +3,16 @@
@tailwind utilities;
@layer base {
html, pre {
html {
font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu,
Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
pre {
white-space: pre-wrap;
}
pre {
font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu,
Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
white-space: pre-wrap;
}
}