mirror of
https://github.com/morgan9e/chatgpt-web
synced 2026-04-13 16:04:05 +09:00
Fix #36 - added ESlint config with ts-standard + svelte support
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
$: apiKey = $apiKeyStorage;
|
||||
|
||||
// Check if the API key is passed in as a "key" query parameter - if so, save it
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const urlParams: URLSearchParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has("key")) {
|
||||
apiKeyStorage.set(urlParams.get("key")!);
|
||||
apiKeyStorage.set(urlParams.get("key") as string);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { addChat, apiKeyStorage } from "./Storage.svelte";
|
||||
import { apiKeyStorage } from './Storage.svelte'
|
||||
|
||||
$: apiKey = $apiKeyStorage;
|
||||
$: apiKey = $apiKeyStorage
|
||||
</script>
|
||||
|
||||
<article class="message">
|
||||
@@ -22,7 +22,7 @@
|
||||
<form
|
||||
class="field has-addons has-addons-right"
|
||||
on:submit|preventDefault={(event) => {
|
||||
apiKeyStorage.set(event.target[0].value);
|
||||
apiKeyStorage.set(event.target[0].value)
|
||||
}}
|
||||
>
|
||||
<p class="control is-expanded">
|
||||
@@ -52,7 +52,7 @@
|
||||
<article class="message is-info">
|
||||
<div class="message-body">
|
||||
Select an existing chat on the sidebar, or
|
||||
<a href={"#/chat/new"}>create a new chat</a>
|
||||
<a href={'#/chat/new'}>create a new chat</a>
|
||||
</div>
|
||||
</article>
|
||||
{/if}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import logo from "../assets/logo.svg";
|
||||
import logo from '../assets/logo.svg'
|
||||
</script>
|
||||
|
||||
<nav class="navbar" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href={"#/"}>
|
||||
<a class="navbar-item" href={'#/'}>
|
||||
<img src={logo} alt="ChatGPT-web" width="28" height="28" />
|
||||
<p class="ml-2 is-size-4 has-text-weight-bold">ChatGPT-web</p>
|
||||
</a>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { addChat } from "./Storage.svelte";
|
||||
import { addChat } from './Storage.svelte'
|
||||
import { replace } from 'svelte-spa-router'
|
||||
|
||||
// Create the new chat instance then redirect to it
|
||||
const chatId = addChat();
|
||||
replace(`/chat/${chatId}`);
|
||||
const chatId = addChat()
|
||||
replace(`/chat/${chatId}`)
|
||||
</script>
|
||||
|
||||
10
src/main.ts
10
src/main.ts
@@ -1,8 +1,8 @@
|
||||
import "./app.scss";
|
||||
import App from "./App.svelte";
|
||||
import './app.scss'
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById("app"),
|
||||
});
|
||||
target: document.getElementById('app') as HTMLElement
|
||||
})
|
||||
|
||||
export default app;
|
||||
export default app
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Home from "./lib/Home.svelte";
|
||||
import Chat from "./lib/Chat.svelte";
|
||||
import NewChat from "./lib/NewChat.svelte";
|
||||
import Home from './lib/Home.svelte'
|
||||
import Chat from './lib/Chat.svelte'
|
||||
import NewChat from './lib/NewChat.svelte'
|
||||
|
||||
export default {
|
||||
'/': Home,
|
||||
'/': Home,
|
||||
|
||||
'/chat/new': NewChat,
|
||||
'/chat/:chatId': Chat,
|
||||
'/chat/new': NewChat,
|
||||
'/chat/:chatId': Chat,
|
||||
|
||||
'*': Home,
|
||||
};
|
||||
'*': Home
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user